Skip to:
Content

BuddyPress.org

Changeset 2946


Ignore:
Timestamp:
04/21/2010 11:34:12 AM (16 years ago)
Author:
apeatling
Message:

Merging 1.2 branch with trunk

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-classes.php

    r2919 r2946  
    3535                        $this->component = $row->component;
    3636                        $this->type = $row->type;
    37                         $this->action = $row->type;
     37                        $this->action = $row->action;
    3838                        $this->content = $row->content;
    3939                        $this->date_recorded = $row->date_recorded;
    … …  
    9898                $where_conditions = array();
    9999
     100                /* Filtering */
     101                if ( $filter && $filter_sql = BP_Activity_Activity::get_filter_sql( $filter ) )
     102                        $where_conditions['filter_sql'] = $filter_sql;
     103
     104                /* Sorting */
     105                if ( $sort != 'ASC' && $sort != 'DESC' )
     106                        $sort = 'DESC';
     107
     108                /* Hide Hidden Items? */
     109                if ( !$show_hidden )
     110                        $where_conditions['hidden_sql'] = "a.hide_sitewide = 0";
     111
     112                /* Alter the query based on whether we want to show activity item comments in the stream like normal comments or threaded below the activity */
     113                if ( !$display_comments || 'threaded' == $display_comments ) {
     114                        $where_conditions[] = "a.type != 'activity_comment'";
     115                }
     116
     117                $where_sql = 'WHERE ' . join( ' AND ', $where_conditions );
     118
    100119                /* Searching */
    101120                if ( $search_terms ) {
    102121                        $search_terms = $wpdb->escape( $search_terms );
    103                         $where_conditions['search_sql'] = "a.content LIKE '%%" . like_escape( $search_terms ) . "%%'";
    104                 }
    105 
    106                 /* Filtering */
    107                 if ( $filter && $filter_sql = BP_Activity_Activity::get_filter_sql( $filter ) )
    108                         $where_conditions['filter_sql'] = $filter_sql;
    109 
    110                 /* Sorting */
    111                 if ( $sort != 'ASC' && $sort != 'DESC' )
    112                         $sort = 'DESC';
    113 
    114                 /* Hide Hidden Items? */
    115                 if ( !$show_hidden )
    116                         $where_conditions['hidden_sql'] = "a.hide_sitewide = 0";
    117 
    118                 /* Alter the query based on whether we want to show activity item comments in the stream like normal comments or threaded below the activity */
    119                 if ( !$display_comments || 'threaded' == $display_comments ) {
    120                         $where_conditions[] = "a.type != 'activity_comment'";
    121                 }
    122 
    123                 $where_sql = 'WHERE ' . join( ' AND ', $where_conditions );
     122
     123                        if ( !empty( $filter['user_id'] ) )
     124                                $where_sql .= ' OR ';
     125                        else if ( !empty( $where_conditions ) )
     126                                $where_sql .= ' AND ';
     127
     128                        $where_sql .= "a.content LIKE '%%" . like_escape( $search_terms ) . "%%'";
     129                }
    124130
    125131                if ( $per_page && $page ) {
  • trunk/bp-blogs.php

    r2941 r2946  
    648648        do_action( 'bp_blogs_remove_data', $user_id );
    649649}
    650 add_action( 'wpmu_delete_user', 'bp_blogs_remove_data', 1 );
    651 add_action( 'delete_user', 'bp_blogs_remove_data', 1 );
     650add_action( 'wpmu_delete_user', 'bp_blogs_remove_data' );
     651add_action( 'delete_user', 'bp_blogs_remove_data' );
     652add_action( 'make_spam_user', 'bp_blogs_remove_data' );
    652653
    653654
  • trunk/bp-core.php

    r2941 r2946  
    637637                'css_id' => $item_css_id,
    638638                'show_for_displayed_user' => $show_for_displayed_user,
    639                 'position' => $position
     639                'position' => $position,
     640                'screen_function' => &$screen_function
    640641        );
    641642
    … …  
    685686        $r = wp_parse_args( $args, $defaults );
    686687        extract( $r, EXTR_SKIP );
     688
     689        if ( $function = $bp->bp_nav[$parent_slug]['screen_function'] ) {
     690                if ( !is_object( $function[0] ) )
     691                        remove_action( 'wp', $function, 3 );
     692                else
     693                        remove_action( 'wp', array( &$function[0], $function[1] ), 3 );
     694        }
     695
     696        $bp->bp_nav[$parent_slug]['screen_function'] = &$screen_function;
    687697
    688698        if ( $bp->current_component == $parent_slug && !$bp->current_action ) {
    … …  
    774784                'css_id' => $item_css_id,
    775785                'position' => $position,
    776                 'user_has_access' => $user_has_access
     786                'user_has_access' => $user_has_access,
     787                'screen_function' => &$screen_function
    777788        );
    778789
    … …  
    834845        }
    835846
     847        if ( $function = $bp->bp_nav[$parent_id]['screen_function'] ) {
     848                if ( !is_object( $function[0] ) )
     849                        remove_action( 'wp', $function, 3 );
     850                else
     851                        remove_action( 'wp', array( &$function[0], $function[1] ), 3 );
     852        }
     853
    836854        unset( $bp->bp_nav[$parent_id] );
    837855}
    … …  
    849867        global $bp;
    850868
    851         $function = $bp->bp_options_nav[$parent_id][$slug]['screen_function'];
    852 
    853         if ( $function ) {
    854                 if ( !is_object( $screen_function[0] ) )
    855                         remove_action( 'wp', $screen_function, 3 );
     869        if ( $function = $bp->bp_options_nav[$parent_id][$slug]['screen_function'] ) {
     870                if ( !is_object( $function[0] ) )
     871                        remove_action( 'wp', $function, 3 );
    856872                else
    857                         remove_action( 'wp', array( &$screen_function[0], $screen_function[1] ), 3 );
     873                        remove_action( 'wp', array( &$function[0], $function[1] ), 3 );
    858874        }
    859875
    … …  
    18421858        wp_cache_flush();
    18431859}
    1844 add_action( 'wpmu_delete_user', 'bp_core_remove_data', 1 );
    1845 add_action( 'delete_user', 'bp_core_remove_data', 1 );
    1846 add_action( 'make_spam_user', 'bp_core_remove_data', 1 );
     1860add_action( 'wpmu_delete_user', 'bp_core_remove_data' );
     1861add_action( 'delete_user', 'bp_core_remove_data' );
     1862add_action( 'make_spam_user', 'bp_core_remove_data' );
    18471863
    18481864/**
  • trunk/bp-core/bp-core-adminbar.php

    r2919 r2946  
    77                return false;
    88
    9         if ( (int)$bp->site_options['hide-loggedout-adminbar'] && !is_user_logged_in() )
     9        if ( (int)get_site_option( 'hide-loggedout-adminbar' ) && !is_user_logged_in() )
    1010                return false;
    1111
  • trunk/bp-core/bp-core-avatars.php

    r2925 r2946  
    131131
    132132                if ( $avatar_url )
    133                         return apply_filters( 'bp_core_fetch_avatar', "<img src='{$avatar_url}' alt='{$alt}' class='{$class}'{$css_id}{$html_width}{$html_height} />", $params );
     133                        return apply_filters( 'bp_core_fetch_avatar', "<img src='{$avatar_url}' alt='{$alt}' class='{$class}'{$css_id}{$html_width}{$html_height} />", $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir );
    134134        }
    135135
    … …  
    163163                $gravatar = apply_filters( 'bp_gravatar_url', $host ) . md5( $email ) . '?d=' . $default_grav . '&amp;s=' . $grav_size;
    164164
    165                 return apply_filters( 'bp_core_fetch_avatar', "<img src='{$gravatar}' alt='{$alt}' class='{$class}'{$css_id}{$html_width}{$html_height} />", $params );
    166 
     165                return apply_filters( 'bp_core_fetch_avatar', "<img src='{$gravatar}' alt='{$alt}' class='{$class}'{$css_id}{$html_width}{$html_height} />", $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir );
    167166        } else {
    168                 return false;
     167                return apply_filters( 'bp_core_fetch_avatar', false, $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir );
    169168        }
    170169}
    … …  
    230229function bp_core_avatar_handle_upload( $file, $upload_dir_filter ) {
    231230        global $bp;
     231
     232        /***
     233         * You may want to hook into this filter if you want to override this function.
     234         * Make sure you return false.
     235         */
     236        if ( !apply_filters( 'bp_core_pre_avatar_handle_upload', true, $file, $upload_dir_filter ) )
     237                return true;
    232238
    233239        require_once( ABSPATH . '/wp-admin/includes/image.php' );
    … …  
    304310
    305311        $r = wp_parse_args( $args, $defaults );
     312
     313        /***
     314         * You may want to hook into this filter if you want to override this function.
     315         * Make sure you return false.
     316         */
     317        if ( !apply_filters( 'bp_core_pre_avatar_handle_crop', true, $r ) )
     318                return true;
     319
    306320        extract( $r, EXTR_SKIP );
    307321
  • trunk/bp-core/bp-core-cssjs.php

    r2842 r2946  
    175175        global $bp;
    176176
    177         if ( defined( 'BP_DISABLE_ADMIN_BAR' ) || ( $bp->site_options['hide-loggedout-adminbar'] && !is_user_logged_in() ) ) {
     177        if ( defined( 'BP_DISABLE_ADMIN_BAR' ) || ( (int)get_site_option( 'hide-loggedout-adminbar' ) && !is_user_logged_in() ) ) {
    178178        ?>
    179179<style type="text/css">body { padding-top: 0 !important; } #wp-admin-bar { display: none; }</style>
  • trunk/bp-core/bp-core-signup.php

    r2925 r2946  
    5454                $bp->signup->email = $_POST['signup_email'];
    5555
    56                 if ( !empty( $_POST['signup_profile_field_ids'] ) && function_exists( 'xprofile_check_is_required_field' ) ) {
    57                         /* Now we've checked account details, we can check profile information */
    58                         $profile_field_ids = explode( ',', $_POST['signup_profile_field_ids'] );
    59 
    60                         /* Loop through the posted fields formatting any datebox values then validate the field */
    61                         foreach ( (array) $profile_field_ids as $field_id ) {
    62                                 if ( !isset( $_POST['field_' . $field_id] ) ) {
    63                                         if ( isset( $_POST['field_' . $field_id . '_day'] ) )
    64                                                 $_POST['field_' . $field_id] = strtotime( $_POST['field_' . $field_id . '_day'] . $_POST['field_' . $field_id . '_month'] . $_POST['field_' . $field_id . '_year'] );
     56                /* Now we've checked account details, we can check profile information */
     57                if ( function_exists( 'xprofile_check_is_required_field' ) ) {
     58
     59                        /* Make sure hidden field is passed and populated */
     60                        if ( isset( $_POST['signup_profile_field_ids'] ) && !empty( $_POST['signup_profile_field_ids'] ) ) {
     61
     62                                /* Let's compact any profile field info into an array */
     63                                $profile_field_ids = explode( ',', $_POST['signup_profile_field_ids'] );
     64
     65                                /* Loop through the posted fields formatting any datebox values then validate the field */
     66                                foreach ( (array) $profile_field_ids as $field_id ) {
     67                                        if ( !isset( $_POST['field_' . $field_id] ) ) {
     68                                                if ( isset( $_POST['field_' . $field_id . '_day'] ) )
     69                                                        $_POST['field_' . $field_id] = strtotime( $_POST['field_' . $field_id . '_day'] . $_POST['field_' . $field_id . '_month'] . $_POST['field_' . $field_id . '_year'] );
     70                                        }
     71
     72                                        /* Create errors for required fields without values */
     73                                        if ( xprofile_check_is_required_field( $field_id ) && empty( $_POST['field_' . $field_id] ) )
     74                                                $bp->signup->errors['field_' . $field_id] = __( 'This is a required field', 'buddypress' );
    6575                                }
    6676
    67                                 if ( xprofile_check_is_required_field( $field_id ) && empty( $_POST['field_' . $field_id] ) )
    68                                         $bp->signup->errors['field_' . $field_id] = __( 'This is a required field', 'buddypress' );
     77                        /* This situation doesn't naturally occur so bounce to website root */
     78                        } else {
     79                                bp_core_redirect( $bp->root_domain );
    6980                        }
    7081                }
    … …  
    252263
    253264        if ( empty( $user_name ) )
    254                 $errors->add( 'user_name', __( 'Please enter a username', 'buddypress' ) );
     265                $errors->add( 'user_name', __( 'Please enter a username', 'buddypress' ) );
    255266
    256267        $maybe = array();
    … …  
    260271        $filtered_illegal_names = apply_filters( 'bp_core_illegal_usernames', array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', BP_GROUPS_SLUG, $bp->members->slug, BP_FORUMS_SLUG, BP_BLOGS_SLUG, BP_REGISTER_SLUG, BP_ACTIVATION_SLUG ) );
    261272
    262         $illegal_names = array_merge( (array)$db_illegal_names, (array)$filtered_illegal_names );
     273        /* Safely merge our illegal names into existing site_option */
     274        $common_names                   = array_intersect( (array)$db_illegal_names, (array)$filtered_illegal_names );
     275        $diff_names                             = array_diff( (array)$db_illegal_names, (array)$filtered_illegal_names );
     276        $illegal_names                  = array_merge( (array)$diff_names, (array)$common_names );
     277
    263278        update_site_option( 'illegal_names', $illegal_names );
    264279
    … …  
    267282
    268283        if ( !validate_username( $user_name ) || $user_name != $maybe[0] )
    269             $errors->add( 'user_name', __( 'Only lowercase letters and numbers allowed', 'buddypress' ) );
     284                $errors->add( 'user_name', __( 'Only lowercase letters and numbers allowed', 'buddypress' ) );
    270285
    271286        if( strlen( $user_name ) < 4 )
    272             $errors->add( 'user_name',  __( 'Username must be at least 4 characters', 'buddypress' ) );
     287                $errors->add( 'user_name',  __( 'Username must be at least 4 characters', 'buddypress' ) );
    273288
    274289        if ( strpos( ' ' . $user_name, '_' ) != false )
    … …  
    385400
    386401function bp_core_activate_signup( $key ) {
    387         global $wpdb;
     402        global $bp, $wpdb;
    388403
    389404        $user = false;
    … …  
    558573
    559574        if ( locate_template( array( 'registration/register.php' ), false ) || locate_template( array( 'register.php' ), false ) )
    560                 wp_redirect( bp_get_root_domain() . '/' . BP_REGISTER_SLUG . '/' );
     575                bp_core_redirect( bp_get_root_domain() . '/' . BP_REGISTER_SLUG . '/' );
    561576}
    562577if ( bp_core_is_multisite() )
  • trunk/bp-forums/bp-forums-templatetags.php

    r2842 r2946  
    254254
    255255                $post = bb_get_first_post( (int)$forum_template->topic->topic_id, false );
    256                 return apply_filters( 'bp_get_the_topic_text', $post->post_text );
     256                return apply_filters( 'bp_get_the_topic_text', attribute_escape( $post->post_text ) );
    257257        }
    258258
    … …  
    464464                global $forum_template;
    465465
    466                 return $forum_template->topic->topic_posts;
     466                return apply_filters( 'bp_get_the_topic_total_posts', $forum_template->topic->topic_posts );
    467467        }
    468468
    … …  
    938938
    939939                $post = bp_forums_get_post( $bp->action_variables[4] );
    940                 return attribute_escape( $post->post_text );
     940                return apply_filters( 'bp_get_the_topic_post_edit_text', attribute_escape( $post->post_text ) );
    941941        }
    942942
  • trunk/bp-friends.php

    r2941 r2946  
    566566        do_action( 'friends_remove_data', $user_id );
    567567}
    568 add_action( 'wpmu_delete_user', 'friends_remove_data', 1 );
    569 add_action( 'delete_user', 'friends_remove_data', 1 );
    570 add_action( 'make_spam_user', 'friends_remove_data', 1 );
     568add_action( 'wpmu_delete_user', 'friends_remove_data' );
     569add_action( 'delete_user', 'friends_remove_data' );
     570add_action( 'make_spam_user', 'friends_remove_data' );
    571571
    572572
  • trunk/bp-groups.php

    r2941 r2946  
    24172417        do_action( 'groups_remove_data_for_user', $user_id );
    24182418}
    2419 add_action( 'wpmu_delete_user', 'groups_remove_data_for_user', 1 );
    2420 add_action( 'delete_user', 'groups_remove_data_for_user', 1 );
    2421 add_action( 'make_spam_user', 'groups_remove_data_for_user', 1 );
     2419add_action( 'wpmu_delete_user', 'groups_remove_data_for_user' );
     2420add_action( 'delete_user', 'groups_remove_data_for_user' );
     2421add_action( 'make_spam_user', 'groups_remove_data_for_user' );
    24222422
    24232423
  • trunk/bp-groups/bp-groups-classes.php

    r2925 r2946  
    129129
    130130                /* Modify group count usermeta for members */
    131                 $wpdb->query( $wpdb->prepare( "UPDATE {$bp->groups->table_name_groupmeta} SET meta_value = meta_value - 1 WHERE meta_key = 'total_group_count' AND user_id IN ( {$user_ids} )" ) );
     131                $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->usermeta} SET meta_value = meta_value - 1 WHERE meta_key = 'total_group_count' AND user_id IN ( {$user_ids} )" ) );
    132132
    133133                /* Now delete all group member entries */
  • trunk/bp-groups/bp-groups-templatetags.php

    r2944 r2946  
    6565
    6666                $this->pag_links = paginate_links( array(
    67                         'base' => add_query_arg( array( 'grpage' => '%#%', 'num' => $this->pag_num, 's' => $_REQUEST['s'], 'sortby' => $this->sort_by, 'order' => $this->order ) ),
     67                        'base' => add_query_arg( array( 'grpage' => '%#%', 'num' => $this->pag_num, 's' => $search_terms, 'sortby' => $this->sort_by, 'order' => $this->order ) ),
    6868                        'format' => '',
    6969                        'total' => ceil($this->total_group_count / $this->pag_num),
  • trunk/bp-themes/bp-default/comments.php

    r2576 r2946  
    2020
    2121                        <span class="title"><?php the_title() ?></span>
    22                         <h3 id="comments"><?php comments_number( 'No Comments', 'One Comment', $numComments . ' Comments' );?></h3>
     22                        <h3 id="comments"><?php comments_number( '', '', $numComments );?></h3>
    2323
    2424                        <?php do_action( 'bp_before_blog_comment_list' ) ?>
  • trunk/bp-xprofile.php

    r2866 r2946  
    892892        delete_usermeta( $user_id, 'bp_core_avatar_v2_path' );
    893893}
    894 add_action( 'wpmu_delete_user', 'xprofile_remove_data', 1 );
    895 add_action( 'delete_user', 'xprofile_remove_data', 1 );
     894add_action( 'wpmu_delete_user', 'xprofile_remove_data' );
     895add_action( 'delete_user', 'xprofile_remove_data' );
     896add_action( 'make_spam_user', 'xprofile_remove_data' );
    896897
    897898
Note: See TracChangeset for help on using the changeset viewer.