Skip to:
Content

BuddyPress.org

Changeset 1021


Ignore:
Timestamp:
02/06/2009 03:07:48 AM (18 years ago)
Author:
apeatling
Message:

Converted $bp as an array to $bp as an object. See this post for more info: http://buddypress.org/forums/topic.php?id=1125

Location:
trunk
Files:
58 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity.php

    r1017 r1021  
    2727        global $wpdb, $bp;
    2828       
    29         if ( !$bp['current_userid'] )
     29        if ( !$bp->displayed_user->id )
    3030                return false;
    3131       
    … …  
    3333                $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
    3434       
    35         $sql[] = "CREATE TABLE ". $bp['activity']['table_name_current_user'] ." (
     35        $sql[] = "CREATE TABLE ". $bp->activity->table_name_current_user ." (
    3636                                id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    3737                                item_id int(11) NOT NULL,
    … …  
    4949                           ) {$charset_collate};";
    5050
    51         $sql[] = "CREATE TABLE ". $bp['activity']['table_name_current_user_cached'] ." (
     51        $sql[] = "CREATE TABLE ". $bp->activity->table_name_current_user_cached ." (
    5252                                id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    5353                                item_id int(11) NOT NULL,
    … …  
    6767                           ) {$charset_collate};";
    6868       
    69         $sql[] = "CREATE TABLE ". $bp['activity']['table_name_current_user_friends_cached'] ." (
     69        $sql[] = "CREATE TABLE ". $bp->activity->table_name_current_user_friends_cached ." (
    7070                                id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    7171                                user_id int(11) NOT NULL,
    … …  
    8585        dbDelta($sql);
    8686       
    87         update_usermeta( $bp['current_userid'], 'bp-activity-db-version', BP_ACTIVITY_DB_VERSION );
     87        update_usermeta( $bp->displayed_user->id, 'bp-activity-db-version', BP_ACTIVITY_DB_VERSION );
    8888}
    8989
    … …  
    9494                $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
    9595       
    96         $sql[] = "CREATE TABLE ". $bp['activity']['table_name_sitewide'] ." (
     96        $sql[] = "CREATE TABLE ". $bp->activity->table_name_sitewide ." (
    9797                                id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    9898                                user_id int(11) NOT NULL,
    … …  
    117117        // dbDelta won't change character sets, so we need to do this seperately.
    118118        // This will only be in here pre v1.0
    119         $wpdb->query( $wpdb->prepare( "ALTER TABLE " . $bp['activity']['table_name_sitewide'] . " DEFAULT CHARACTER SET %s", $wpdb->charset ) );
     119        $wpdb->query( $wpdb->prepare( "ALTER TABLE " . $bp->activity->table_name_sitewide . " DEFAULT CHARACTER SET %s", $wpdb->charset ) );
    120120
    121121        update_site_option( 'bp-activity-db-version', BP_ACTIVITY_DB_VERSION );
    … …  
    132132        global $bp, $wpdb, $current_blog;
    133133
    134         $bp['activity'] = array(
    135                 'table_name_loggedin_user' => $wpdb->base_prefix . 'user_' . $bp['loggedin_userid'] . '_activity',
    136                 'table_name_loggedin_user_cached' => $wpdb->base_prefix . 'user_' . $bp['loggedin_userid'] . '_activity_cached',
    137                
    138                 'table_name_current_user' => $wpdb->base_prefix . 'user_' . $bp['current_userid'] . '_activity',
    139                 'table_name_current_user_cached' => $wpdb->base_prefix . 'user_' . $bp['current_userid'] . '_activity_cached',
    140                
    141                 'table_name_loggedin_user_friends_cached' => $wpdb->base_prefix . 'user_' . $bp['loggedin_userid'] . '_friends_activity_cached',
    142                 'table_name_current_user_friends_cached' => $wpdb->base_prefix . 'user_' . $bp['current_userid'] . '_friends_activity_cached',
    143                
    144                 'table_name_sitewide' => $wpdb->base_prefix . 'bp_activity_sitewide',
    145                
    146                 'image_base' => site_url( MUPLUGINDIR . '/bp-activity/images' ),
    147                 'slug'           => BP_ACTIVITY_SLUG
    148         );
    149        
    150         $bp['version_numbers'][$bp['activity']['slug']] = BP_ACTIVITY_VERSION;
    151 
    152         if ( $bp['current_userid'] ) {
     134        $bp->activity->table_name_loggedin_user = $wpdb->base_prefix . 'user_' . $bp->loggedin_user->id . '_activity';
     135        $bp->activity->table_name_loggedin_user_cached = $wpdb->base_prefix . 'user_' . $bp->loggedin_user->id . '_activity_cached';
     136       
     137        $bp->activity->table_name_current_user = $wpdb->base_prefix . 'user_' . $bp->displayed_user->id . '_activity';
     138        $bp->activity->table_name_current_user_cached = $wpdb->base_prefix . 'user_' . $bp->displayed_user->id . '_activity_cached';
     139       
     140        $bp->activity->table_name_loggedin_user_friends_cached = $wpdb->base_prefix . 'user_' . $bp->loggedin_user->id . '_friends_activity_cached';
     141        $bp->activity->table_name_current_user_friends_cached = $wpdb->base_prefix . 'user_' . $bp->displayed_user->id . '_friends_activity_cached';
     142       
     143        $bp->activity->table_name_sitewide = $wpdb->base_prefix . 'bp_activity_sitewide';
     144       
     145        $bp->activity->image_base = site_url( MUPLUGINDIR . '/bp-activity/images' );
     146        $bp->activity->slug = BP_ACTIVITY_SLUG;
     147       
     148        $bp->version_numbers->activity = BP_ACTIVITY_VERSION;
     149
     150        if ( $bp->displayed_user->id ) {
    153151                /* Check to see if the current user has their activity table set up. If not, set them up. */
    154                 if ( !$wpdb->get_var("SHOW TABLES LIKE '%" . $bp['activity']['table_name_current_user'] . "%'") || get_usermeta( $bp['current_userid'], 'bp-activity-db-version' ) < BP_ACTIVITY_VERSION  )
     152                if ( !$wpdb->get_var("SHOW TABLES LIKE '%" . $bp->activity->table_name_current_user . "%'") || get_usermeta( $bp->displayed_user->id, 'bp-activity-db-version' ) < BP_ACTIVITY_VERSION  )
    155153                        bp_activity_user_install();
    156154        }
    … …  
    158156        if ( is_site_admin() && $current_blog->blog_id == 1 ) {
    159157                /* Check to see if the site wide activity table is set up. */
    160                 if ( !$wpdb->get_var("SHOW TABLES LIKE '%" . $bp['activity']['table_name_sitewide'] . "%'") || get_site_option( 'bp-activity-db-version' ) < BP_ACTIVITY_VERSION  )
     158                if ( !$wpdb->get_var("SHOW TABLES LIKE '%" . $bp->activity->table_name_sitewide . "%'") || get_site_option( 'bp-activity-db-version' ) < BP_ACTIVITY_VERSION  )
    161159                        bp_activity_sitewide_install();
    162160        }
    … …  
    176174       
    177175        /* Add 'Activity' to the main navigation */
    178         bp_core_add_nav_item( __('Activity', 'buddypress'), $bp['activity']['slug'] );
    179         bp_core_add_nav_default( $bp['activity']['slug'], 'bp_activity_screen_my_activity', 'just-me' );
     176        bp_core_add_nav_item( __('Activity', 'buddypress'), $bp->activity->slug );
     177        bp_core_add_nav_default( $bp->activity->slug, 'bp_activity_screen_my_activity', 'just-me' );
    180178               
    181         $activity_link = $bp['loggedin_domain'] . $bp['activity']['slug'] . '/';
     179        $activity_link = $bp->loggedin_user->domain . $bp->activity->slug . '/';
    182180       
    183181        /* Add the subnav items to the activity nav item */
    184         bp_core_add_subnav_item( $bp['activity']['slug'], 'just-me', __('Just Me', 'buddypress'), $activity_link, 'bp_activity_screen_my_activity' );
    185         bp_core_add_subnav_item( $bp['activity']['slug'], 'my-friends', __('My Friends', 'buddypress'), $activity_link, 'bp_activity_screen_friends_activity', 'activity-my-friends', bp_is_home() );
    186        
    187         if ( $bp['current_component'] == $bp['activity']['slug'] ) {
     182        bp_core_add_subnav_item( $bp->activity->slug, 'just-me', __('Just Me', 'buddypress'), $activity_link, 'bp_activity_screen_my_activity' );
     183        bp_core_add_subnav_item( $bp->activity->slug, 'my-friends', __('My Friends', 'buddypress'), $activity_link, 'bp_activity_screen_friends_activity', 'activity-my-friends', bp_is_home() );
     184       
     185        if ( $bp->current_component == $bp->activity->slug ) {
    188186                if ( bp_is_home() ) {
    189                         $bp['bp_options_title'] = __('My Activity', 'buddypress');
     187                        $bp->bp_options_title = __( 'My Activity', 'buddypress' );
    190188                } else {
    191                         $bp['bp_options_avatar'] = bp_core_get_avatar( $bp['current_userid'], 1 );
    192                         $bp['bp_options_title'] = $bp['current_fullname'];
     189                        $bp->bp_options_avatar = bp_core_get_avatar( $bp->displayed_user->id, 1 );
     190                        $bp->bp_options_title = $bp->displayed_user->fullname;
    193191                }
    194192        }
    … …  
    215213       
    216214        if ( !$user_id )
    217                 $user_id = $bp['loggedin_userid'];
     215                $user_id = $bp->loggedin_user->id;
    218216
    219217        $recorded_time = time();
    … …  
    255253        global $bp;
    256254
    257         if ( $bp['current_component'] != $bp['activity']['slug'] || $bp['current_action'] != 'feed' || $bp['current_userid'] )
     255        if ( $bp->current_component != $bp->activity->slug || $bp->current_action != 'feed' || $bp->displayed_user->id )
    258256                return false;
    259257
    … …  
    266264        global $bp;     
    267265
    268         if ( $bp['current_component'] != $bp['activity']['slug'] || !$bp['current_userid'] || $bp['current_action'] != 'feed' )
     266        if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != 'feed' )
    269267                return false;
    270268
    … …  
    277275        global $bp;
    278276
    279         if ( $bp['current_component'] != $bp['activity']['slug'] || !$bp['current_userid'] || $bp['current_action'] != 'my-friends' || $bp['action_variables'][0] != 'feed' )
     277        if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != 'my-friends' || $bp->action_variables[0] != 'feed' )
    280278                return false;
    281279       
  • trunk/bp-activity/bp-activity-classes.php

    r909 r1021  
    3131                global $wpdb, $bp;
    3232               
    33                 $activity = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $this->table_name . " WHERE id = %d", $this->id ) );
     33                $activity = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$this->table_name} WHERE id = %d", $this->id ) );
    3434
    3535                $this->item_id = $activity->item_id;
    … …  
    5555                if ( !$this->exists() ) {
    5656                        // Insert the new activity into the activity table.
    57                         $activity = $wpdb->query( $wpdb->prepare( "INSERT INTO " . $this->table_name . " ( item_id, secondary_item_id, user_id, component_name, component_action, date_recorded, is_private, no_sitewide_cache ) VALUES ( %d, %d, %d, %s, %s, FROM_UNIXTIME(%d), %d, %d )", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_recorded, $this->is_private, $this->no_sitewide_cache ) );
     57                        $activity = $wpdb->query( $wpdb->prepare( "INSERT INTO {$this->table_name} ( item_id, secondary_item_id, user_id, component_name, component_action, date_recorded, is_private, no_sitewide_cache ) VALUES ( %d, %d, %d, %s, %s, FROM_UNIXTIME(%d), %d, %d )", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_recorded, $this->is_private, $this->no_sitewide_cache ) );
    5858
    5959                        // Fetch the formatted activity content so we can add it to the cache.
    60                         if ( function_exists( $bp[$this->component_name]['format_activity_function'] ) ) {
    61                                 if ( !$activity_content = call_user_func($bp[$this->component_name]['format_activity_function'], $this->item_id, $this->user_id, $this->component_action, $this->secondary_item_id, $this->for_secondary_user ) )
     60                        if ( function_exists( $bp->{$this->component_name}->format_activity_function ) ) {
     61                                if ( !$activity_content = call_user_func( $bp->{$this->component_name}->format_activity_function, $this->item_id, $this->user_id, $this->component_action, $this->secondary_item_id, $this->for_secondary_user ) )
    6262                                        return false;
    6363                        }
    6464                       
    6565                        // Add the cached version of the activity to the cached activity table.
    66                         $activity_cached = $wpdb->query( $wpdb->prepare( "INSERT INTO " . $this->table_name_cached . " ( item_id, secondary_item_id, content, primary_link, component_name, component_action, date_cached, date_recorded, is_private ) VALUES ( %d, %d, %s, %s, %s, %s, FROM_UNIXTIME(%d), FROM_UNIXTIME(%d), %d )", $this->item_id, $this->secondary_item_id, $activity_content['content'], $activity_content['primary_link'], $this->component_name, $this->component_action, time(), $this->date_recorded, $this->is_private ) );
     66                        $activity_cached = $wpdb->query( $wpdb->prepare( "INSERT INTO {$this->table_name_cached} ( item_id, secondary_item_id, content, primary_link, component_name, component_action, date_cached, date_recorded, is_private ) VALUES ( %d, %d, %s, %s, %s, %s, FROM_UNIXTIME(%d), FROM_UNIXTIME(%d), %d )", $this->item_id, $this->secondary_item_id, $activity_content['content'], $activity_content['primary_link'], $this->component_name, $this->component_action, time(), $this->date_recorded, $this->is_private ) );
    6767                       
    6868                        // Add the cached version of the activity to the sitewide activity table.
    6969                        if ( !$this->no_sitewide_cache )
    70                                 $sitewide_cached = $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp['activity']['table_name_sitewide'] . " ( user_id, item_id, secondary_item_id, content, primary_link, component_name, component_action, date_cached, date_recorded ) VALUES ( %d, %d, %d, %s, %s, %s, %s, FROM_UNIXTIME(%d), FROM_UNIXTIME(%d) )", $this->user_id, $this->item_id, $this->secondary_item_id, $activity_content['content'], $activity_content['primary_link'], $this->component_name, $this->component_action, time(), $this->date_recorded ) );
     70                                $sitewide_cached = $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->activity->table_name_sitewide} ( user_id, item_id, secondary_item_id, content, primary_link, component_name, component_action, date_cached, date_recorded ) VALUES ( %d, %d, %d, %s, %s, %s, %s, FROM_UNIXTIME(%d), FROM_UNIXTIME(%d) )", $this->user_id, $this->item_id, $this->secondary_item_id, $activity_content['content'], $activity_content['primary_link'], $this->component_name, $this->component_action, time(), $this->date_recorded ) );
    7171                       
    7272                        if ( $activity && $activity_cached )
    … …  
    7979        function exists() {
    8080                global $wpdb, $bp;
    81                 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM " . $this->table_name . " WHERE item_id = %d AND secondary_item_id = %d AND user_id = %d AND component_name = %s AND component_action = %s", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action ) );               
     81                return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$this->table_name} WHERE item_id = %d AND secondary_item_id = %d AND user_id = %d AND component_name = %s AND component_action = %s", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action ) );             
    8282        }
    8383       
    … …  
    9090                        return false;
    9191               
    92                 if ( !$bp['activity'] )
     92                if ( !$bp->activity )
    9393                        bp_activity_setup_globals();
    9494               
    … …  
    9898                //error_log($wpdb->prepare( "DELETE FROM {$wpdb->base_prefix}user_{$user_id}_activity WHERE item_id = %d{$secondary_sql} AND user_id = %d AND component_name = %s AND component_action = %s", $item_id, $user_id, $component_name, $component_action ) );
    9999                //error_log($wpdb->prepare( "DELETE FROM {$wpdb->base_prefix}user_{$user_id}_activity_cached WHERE item_id = %d{$secondary_sql} AND component_name = %s AND component_action = %s", $item_id, $component_name, $component_action ) );
    100                 //error_log($wpdb->prepare( "DELETE FROM " . $bp['activity']['table_name_sitewide'] . " WHERE item_id = %d{$secondary_sql} AND user_id = %d AND component_name = %s AND component_action = %s", $item_id, $user_id, $component_name, $component_action ) );
     100                //error_log($wpdb->prepare( "DELETE FROM " . $bp->activity->table_name_sitewide . " WHERE item_id = %d{$secondary_sql} AND user_id = %d AND component_name = %s AND component_action = %s", $item_id, $user_id, $component_name, $component_action ) );
    101101               
    102102                $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->base_prefix}user_{$user_id}_activity WHERE item_id = %d{$secondary_sql} AND user_id = %d AND component_name = %s AND component_action = %s", $item_id, $user_id, $component_name, $component_action ) );
    … …  
    104104                // Delete this entry from the users' cache table and the sitewide cache table
    105105                $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->base_prefix}user_{$user_id}_activity_cached WHERE item_id = %d{$secondary_sql} AND component_name = %s AND component_action = %s", $item_id, $component_name, $component_action ) );
    106                 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['activity']['table_name_sitewide'] . " WHERE item_id = %d{$secondary_sql} AND user_id = %d AND component_name = %s AND component_action = %s", $item_id, $user_id, $component_name, $component_action ) );
     106                $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name_sitewide} WHERE item_id = %d{$secondary_sql} AND user_id = %d AND component_name = %s AND component_action = %s", $item_id, $user_id, $component_name, $component_action ) );
    107107               
    108108                return true;
    … …  
    113113               
    114114                if ( !$user_id )
    115                         $user_id = $bp['current_userid'];
     115                        $user_id = $bp->displayed_user->id;
    116116               
    117117                if ( !$user_id )
    … …  
    127127               
    128128                /* Determine whether or not to use the cached activity stream, or re-select and cache a new stream */
    129                 $last_cached = get_usermeta( $bp['current_userid'], 'bp_activity_last_cached' );
     129                $last_cached = get_usermeta( $bp->displayed_user->id, 'bp_activity_last_cached' );
    130130               
    131131                if ( strtotime( BP_ACTIVITY_CACHE_LENGTH, (int)$last_cached ) >= time() ) {
    … …  
    134134                       
    135135                        // Use the cached activity stream.
    136                         $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $bp['activity']['table_name_current_user_cached'] . " WHERE date_recorded >= FROM_UNIXTIME(%d) $privacy_sql ORDER BY date_recorded DESC $limit_sql", $since ) );
     136                        $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name_current_user_cached} WHERE date_recorded >= FROM_UNIXTIME(%d) $privacy_sql ORDER BY date_recorded DESC $limit_sql", $since ) );
    137137       
    138138                        for ( $i = 0; $i < count( $activities ); $i++ ) {
    … …  
    152152                       
    153153                        // Reselect, format and cache a new activity stream. Override the limit otherwise we might only cache 5 items when viewing a profile page.
    154                         $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $bp['activity']['table_name_current_user'] . " WHERE date_recorded >= FROM_UNIXTIME(%d) $privacy_sql ORDER BY date_recorded DESC LIMIT 30", $since ) );
     154                        $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name_current_user} WHERE date_recorded >= FROM_UNIXTIME(%d) $privacy_sql ORDER BY date_recorded DESC LIMIT 30", $since ) );
    155155
    156156                        for ( $i = 0; $i < count( $activities ); $i++ ) {                       
    157                                 if ( function_exists( $bp[$activities[$i]->component_name]['format_activity_function'] ) ) {   
    158                                         if ( !$content = call_user_func($bp[$activities[$i]->component_name]['format_activity_function'], $activities[$i]->item_id, $activities[$i]->user_id, $activities[$i]->component_action, $activities[$i]->secondary_item_id ) )
     157                                if ( function_exists( $bp->{$activities[$i]->component_name}->format_activity_function ) ) {   
     158                                        if ( !$content = call_user_func( $bp->{$activities[$i]->component_name}->format_activity_function, $activities[$i]->item_id, $activities[$i]->user_id, $activities[$i]->component_action, $activities[$i]->secondary_item_id ) )
    159159                                                continue;
    160160                                       
    … …  
    199199               
    200200                /* Determine whether or not to use the cached friends activity stream, or re-select and cache a new stream */
    201                 $last_cached = get_usermeta( $bp['loggedin_userid'], 'bp_activity_friends_last_cached' );
     201                $last_cached = get_usermeta( $bp->loggedin_user->id, 'bp_activity_friends_last_cached' );
    202202               
    203203                if ( strtotime( BP_ACTIVITY_CACHE_LENGTH, (int)$last_cached ) >= time() ) {
    … …  
    206206                       
    207207                        // Use the cached activity stream.
    208                         $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $bp['activity']['table_name_loggedin_user_friends_cached'] . " ORDER BY date_recorded DESC $limit_sql" ) );
     208                        $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name_loggedin_user_friends_cached} ORDER BY date_recorded DESC $limit_sql" ) );
    209209               
    210210                        for ( $i = 0; $i < count( $activities ); $i++ ) {
    … …  
    231231                                $table_name = $wpdb->base_prefix . 'user_' . $friend_ids[$i] . '_activity_cached';
    232232
    233                                 $activities[$i]['activity'] = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $table_name . " WHERE is_private = 0 ORDER BY date_recorded $limit_sql" ) );
     233                                $activities[$i]['activity'] = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$table_name} WHERE is_private = 0 ORDER BY date_recorded $limit_sql" ) );
    234234                                $activities[$i]['full_name'] = bp_fetch_user_fullname( $friend_ids[$i], false );
    235235                        }
    … …  
    265265               
    266266                /* Remove entries that are older than 6 months */
    267                 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['activity']['table_name_sitewide'] . " WHERE DATE_ADD(date_recorded, INTERVAL 6 MONTH) <= NOW()" ) );
    268                
    269                 $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $bp['activity']['table_name_sitewide'] . " ORDER BY date_recorded DESC $limit_sql" ) );
     267                $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp->activity->table_name_sitewide . " WHERE DATE_ADD(date_recorded, INTERVAL 6 MONTH) <= NOW()" ) );
     268               
     269                $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $bp->activity->table_name_sitewide . " ORDER BY date_recorded DESC $limit_sql" ) );
    270270               
    271271                for ( $i = 0; $i < count( $activities ); $i++ ) {
    … …  
    289289                                $activity_feed[$i]['title'] = trim( strip_tags( $title[0] ) );
    290290                                $activity_feed[$i]['link'] = $activities[$i]['primary_link'];
    291                                 $activity_feed[$i]['description'] = sprintf ( $activities[$i]['content'], '' );
     291                                $activity_feed[$i]['description'] = sprintf( $activities[$i]['content'], '' );
    292292                                $activity_feed[$i]['pubdate'] = $activities[$i]['date_recorded'];
    293293                }
    … …  
    300300               
    301301                /* Empty the cache */
    302                 $wpdb->query( "TRUNCATE TABLE " . $bp['activity']['table_name_loggedin_user_friends_cached'] );
     302                $wpdb->query( "TRUNCATE TABLE {$bp->activity->table_name_loggedin_user_friends_cached}" );
    303303               
    304304                for ( $i = 0; $i < count($activity_array); $i++ ) {
    305305                        // Cache that sucka...
    306                         $cached = $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp['activity']['table_name_loggedin_user_friends_cached'] . " ( user_id, content, primary_link, component_name, component_action, date_cached, date_recorded ) VALUES ( %d, %s, %s, %s, %s, FROM_UNIXTIME(%d), %s )", $activity_array[$i]['user_id'], $activity_array[$i]['content'], $activity_array[$i]['primary_link'], $activity_array[$i]['component_name'], $activity_array[$i]['component_action'], time(), $activity_array[$i]['date_recorded'] ) );
    307                 }
    308                
    309                 update_usermeta( $bp['loggedin_userid'], 'bp_activity_friends_last_cached', time() );
     306                        $cached = $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->activity->table_name_loggedin_user_friends_cached} ( user_id, content, primary_link, component_name, component_action, date_cached, date_recorded ) VALUES ( %d, %s, %s, %s, %s, FROM_UNIXTIME(%d), %s )", $activity_array[$i]['user_id'], $activity_array[$i]['content'], $activity_array[$i]['primary_link'], $activity_array[$i]['component_name'], $activity_array[$i]['component_action'], time(), $activity_array[$i]['date_recorded'] ) );
     307                }
     308               
     309                update_usermeta( $bp->loggedin_user->id, 'bp_activity_friends_last_cached', time() );
    310310        }
    311311       
    … …  
    314314
    315315                /* Empty the cache */
    316                 $wpdb->query( "TRUNCATE TABLE " . $bp['activity']['table_name_current_user_cached'] );
     316                $wpdb->query( "TRUNCATE TABLE {$bp->activity->table_name_current_user_cached}" );
    317317               
    318318                /* Empty user's activities from the sitewide stream */
    319                 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['activity']['table_name_sitewide'] . " WHERE user_id = %d", $user_id ) );
     319                $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp->activity->table_name_sitewide . " WHERE user_id = %d", $user_id ) );
    320320               
    321321                for ( $i = 0; $i < count($activity_array); $i++ ) {
    … …  
    323323                       
    324324                        // Cache that sucka...
    325                         $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp['activity']['table_name_current_user_cached'] . " ( content, item_id, secondary_item_id, primary_link, component_name, component_action, date_cached, date_recorded, is_private ) VALUES ( %s, %d, %d, %s, %s, %s, FROM_UNIXTIME(%d), %s, %d )", $activity_array[$i]['content'], $activity_array[$i]['item_id'], $activity_array[$i]['secondary_item_id'], $activity_array[$i]['primary_link'], $activity_array[$i]['component_name'], $activity_array[$i]['component_action'], time(), $activity_array[$i]['date_recorded'], $activity_array[$i]['is_private'] ) );
     325                        $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp->activity->table_name_current_user_cached . " ( content, item_id, secondary_item_id, primary_link, component_name, component_action, date_cached, date_recorded, is_private ) VALUES ( %s, %d, %d, %s, %s, %s, FROM_UNIXTIME(%d), %s, %d )", $activity_array[$i]['content'], $activity_array[$i]['item_id'], $activity_array[$i]['secondary_item_id'], $activity_array[$i]['primary_link'], $activity_array[$i]['component_name'], $activity_array[$i]['component_action'], time(), $activity_array[$i]['date_recorded'], $activity_array[$i]['is_private'] ) );
    326326                       
    327327                        // Add to the sitewide activity stream
    328328                        if ( !$activity_array[$i]['is_private'] && !$activity_array[$i]['no_sitewide_cache'] )
    329                                 $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp['activity']['table_name_sitewide'] . " ( user_id, content, item_id, secondary_item_id, primary_link, component_name, component_action, date_cached, date_recorded ) VALUES ( %d, %s, %d, %d, %s, %s, %s, FROM_UNIXTIME(%d), %s )", $user_id, $activity_array[$i]['content'], $activity_array[$i]['item_id'], $activity_array[$i]['secondary_item_id'], $activity_array[$i]['primary_link'], $activity_array[$i]['component_name'], $activity_array[$i]['component_action'], time(), $activity_array[$i]['date_recorded'] ) );
    330                 }
    331                
    332                 update_usermeta( $bp['current_userid'], 'bp_activity_last_cached', time() );
     329                                $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp->activity->table_name_sitewide . " ( user_id, content, item_id, secondary_item_id, primary_link, component_name, component_action, date_cached, date_recorded ) VALUES ( %d, %s, %d, %d, %s, %s, %s, FROM_UNIXTIME(%d), %s )", $user_id, $activity_array[$i]['content'], $activity_array[$i]['item_id'], $activity_array[$i]['secondary_item_id'], $activity_array[$i]['primary_link'], $activity_array[$i]['component_name'], $activity_array[$i]['component_action'], time(), $activity_array[$i]['date_recorded'] ) );
     330                }
     331               
     332                update_usermeta( $bp->displayed_user->id, 'bp_activity_last_cached', time() );
    333333        }
    334334       
    … …  
    337337
    338338                /* Empty user's activities from the sitewide stream */
    339                 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['activity']['table_name_sitewide'] . " WHERE user_id = %d", $user_id ) );
     339                $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp->activity->table_name_sitewide . " WHERE user_id = %d", $user_id ) );
    340340
    341341                /* Empty the user's activity items and cached activity items */
    … …  
    349349                global $bp, $wpdb;
    350350               
    351                 return $wpdb->get_var( $wpdb->prepare( "SELECT date_recorded FROM " . $bp['activity']['table_name_sitewide'] . " ORDER BY date_recorded ASC LIMIT 1" ) );
     351                return $wpdb->get_var( $wpdb->prepare( "SELECT date_recorded FROM " . $bp->activity->table_name_sitewide . " ORDER BY date_recorded ASC LIMIT 1" ) );
    352352        }
    353353       
  • trunk/bp-activity/bp-activity-templatetags.php

    r933 r1021  
    2424               
    2525                if ( !$user_id )
    26                         $user_id = $bp['current_userid'];
    27 
    28                 if ( $bp['current_component'] != $bp['activity']['slug'] || ( $bp['current_component'] == $bp['activity']['slug'] && $bp['current_action'] == 'just-me' || $bp['current_action'] == 'feed' ) ) {
     26                        $user_id = $bp->displayed_user->id;
     27
     28                if ( $bp->current_component != $bp->activity->slug || ( $bp->current_component == $bp->activity->slug && $bp->current_action == 'just-me' || $bp->current_action == 'feed' ) ) {
    2929                        $this->activities = BP_Activity_Activity::get_activity_for_user( $user_id, $limit );
    3030                } else {
    … …  
    3434                $this->activity_count = count($this->activities);
    3535       
    36                 $this->full_name = $bp['current_fullname'];
     36                $this->full_name = $bp->displayed_user->fullname;
    3737
    3838                $this->is_home = bp_is_home();
    … …  
    9999        global $bp, $activities_template, $bp_activity_user_id, $bp_activity_limit;
    100100       
    101         if ( $bp['current_action'] == 'my-friends' )
     101        if ( $bp->current_action == 'my-friends' )
    102102                $filter_content = false;
    103103        else
    … …  
    105105       
    106106        if ( !$bp_activity_user_id )
    107                 $bp_activity_user_id = $bp['current_userid'];
     107                $bp_activity_user_id = $bp->displayed_user->id;
    108108       
    109109        if ( !$bp_activity_limit )
    … …  
    200200        global $bp;
    201201       
    202         echo apply_filters( 'bp_sitewide_activity_feed_link', site_url() . '/' . $bp['activity']['slug'] . '/feed' );
     202        echo apply_filters( 'bp_sitewide_activity_feed_link', site_url() . '/' . $bp->activity->slug . '/feed' );
    203203}
    204204
    … …  
    206206        global $bp;
    207207       
    208         if ( ( $bp['current_component'] == $bp['profile']['slug'] ) || $bp['current_action'] == 'just-me' )
    209                 echo apply_filters( 'bp_activities_member_rss_link', $bp['current_domain'] . $bp['activity']['slug'] . '/feed' );
     208        if ( ( $bp->current_component == $bp->profile->slug ) || $bp->current_action == 'just-me' )
     209                echo apply_filters( 'bp_activities_member_rss_link', $bp->displayed_user->domain . $bp->activity->slug . '/feed' );
    210210        else
    211                 echo apply_filters( 'bp_activities_member_rss_link', $bp['current_domain'] . $bp['activity']['slug'] . '/my-friends/feed' );           
     211                echo apply_filters( 'bp_activities_member_rss_link', $bp->displayed_user->domain . $bp->activity->slug . '/my-friends/feed' );         
    212212}
    213213
  • trunk/bp-activity/bp-activity-widgets.php

    r954 r1021  
    3333        <?php if ( $activity ) : ?>
    3434                <div class="item-options" id="activity-list-options">
    35                         <img src="<?php echo $bp['activity']['image_base'] ?>/rss.png" alt="<?php _e( 'RSS Feed', 'buddypress' ) ?>" /> <a href="<?php bp_sitewide_activity_feed_link() ?>" title="<?php _e( 'Site Wide Activity RSS Feed', 'buddypress' ) ?>"><?php _e( 'RSS Feed', 'buddypress' ) ?></a>
     35                        <img src="<?php echo $bp->activity->image_base; ?>/rss.png" alt="<?php _e( 'RSS Feed', 'buddypress' ) ?>" /> <a href="<?php bp_sitewide_activity_feed_link() ?>" title="<?php _e( 'Site Wide Activity RSS Feed', 'buddypress' ) ?>"><?php _e( 'RSS Feed', 'buddypress' ) ?></a>
    3636                </div>
    3737                <ul id="site-wide-stream" class="activity-list">
  • trunk/bp-activity/feeds/bp-activity-friends-feed.php

    r608 r1021  
    2020
    2121<channel>
    22         <title><?php echo $bp['current_fullname']; ?> - <?php _e( 'Friends Activity', 'buddypress' ) ?></title>
     22        <title><?php echo $bp->displayed_user->fullname; ?> - <?php _e( 'Friends Activity', 'buddypress' ) ?></title>
    2323        <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
    24         <link><?php $bp['current_domain'] . '/' . $bp['activity']['slug'] . '/my-friends/feed' ?></link>
    25         <description><?php _e( sprintf( '%s - Friends Activity Feed', $bp['current_fullname'] ), 'buddypress' ) ?></description>
     24        <link><?php $bp->displayed_user->domain . '/' . $bp->activity->slug . '/my-friends/feed' ?></link>
     25        <description><?php _e( sprintf( '%s - Friends Activity Feed', $bp->displayed_user->fullname ), 'buddypress' ) ?></description>
    2626        <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', bp_activity_get_last_updated(), false); ?></pubDate>
    2727        <generator>http://buddypress.org/?bp-activity-version=<?php echo BP_ACTIVITY_VERSION ?></generator>
  • trunk/bp-activity/feeds/bp-activity-personal-feed.php

    r601 r1021  
    1919
    2020<channel>
    21         <title><?php echo $bp['current_fullname']; ?> - <?php _e( 'Activity', 'buddypress' ) ?></title>
     21        <title><?php echo $bp->displayed_user->fullname; ?> - <?php _e( 'Activity', 'buddypress' ) ?></title>
    2222        <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
    23         <link><?php echo $bp['current_domain'] . $bp['activity']['slug'] . '/feed' ?></link>
    24         <description><?php _e( sprintf( '%s - Activity Feed', $bp['current_fullname'] ), 'buddypress' ) ?></description>
     23        <link><?php echo $bp->displayed_user->domain . $bp->activity->slug . '/feed' ?></link>
     24        <description><?php _e( sprintf( '%s - Activity Feed', $bp->displayed_user->fullname ), 'buddypress' ) ?></description>
    2525        <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', bp_activity_get_last_updated(), false); ?></pubDate>
    2626        <generator>http://buddypress.org/?bp-activity-version=<?php echo BP_ACTIVITY_VERSION ?></generator>
  • trunk/bp-activity/feeds/bp-activity-sitewide-feed.php

    r601 r1021  
    2222        <title><?php echo get_site_option( 'site_name' ); ?> - <?php _e( 'Site Wide Activity', 'buddypress' ) ?></title>
    2323        <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
    24         <link><?php echo site_url() . '/' . $bp['activity']['slug'] . '/feed' ?></link>
     24        <link><?php echo site_url() . '/' . $bp->activity->slug . '/feed' ?></link>
    2525        <description><?php _e( 'Site Wide Activity Feed', 'buddypress' ) ?></description>
    2626        <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', bp_activity_get_last_updated(), false); ?></pubDate>
  • trunk/bp-blogs.php

    r1017 r1021  
    3131                $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
    3232       
    33         $sql[] = "CREATE TABLE ". $bp['blogs']['table_name'] ." (
     33        $sql[] = "CREATE TABLE {$bp->blogs->table_name} (
    3434                                id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    3535                                user_id int(11) NOT NULL,
    … …  
    3939                         ) {$charset_collate};";
    4040
    41         $sql[] = "CREATE TABLE ". $bp['blogs']['table_name_blog_posts'] ." (
     41        $sql[] = "CREATE TABLE {$bp->blogs->table_name_blog_posts} (
    4242                                id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    4343                                user_id int(11) NOT NULL,
    … …  
    5050                         ) {$charset_collate};";
    5151
    52         $sql[] = "CREATE TABLE ". $bp['blogs']['table_name_blog_comments'] ." (
     52        $sql[] = "CREATE TABLE {$bp->blogs->table_name_blog_comments} (
    5353                                id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    5454                                user_id int(11) NOT NULL,
    … …  
    6363                         ) {$charset_collate};";
    6464       
    65         $sql[] = "CREATE TABLE ". $bp['blogs']['table_name_blogmeta'] ." (
     65        $sql[] = "CREATE TABLE {$bp->blogs->table_name_blogmeta} (
    6666                        id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    6767                        blog_id int(11) NOT NULL,
    … …  
    8787                // Import blog titles and descriptions into the blogmeta table 
    8888                if ( get_site_option( 'bp-blogs-version' ) <= '0.1.5' ) {
    89                         $blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM " . $bp['blogs']['table_name'] ) );
     89                        $blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM " . $bp->blogs->table_name ) );
    9090
    9191                        for ( $i = 0; $i < count($blog_ids); $i++ ) {
    … …  
    110110        if ( is_site_admin() ) {
    111111                /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    112                 if ( ( $wpdb->get_var("SHOW TABLES LIKE '%" . $bp['blogs']['table_name'] . "%'") == false ) || ( get_site_option('bp-blogs-db-version') < BP_BLOGS_DB_VERSION )  )
     112                if ( ( $wpdb->get_var("SHOW TABLES LIKE '%" . $bp->blogs->table_name . "%'") == false ) || ( get_site_option('bp-blogs-db-version') < BP_BLOGS_DB_VERSION )  )
    113113                        bp_blogs_install();
    114114        }
    … …  
    127127        global $bp, $wpdb;
    128128
    129         $bp['blogs'] = array(
    130                 'table_name' => $wpdb->base_prefix . 'bp_user_blogs',
    131                 'table_name_blog_posts' => $wpdb->base_prefix . 'bp_user_blogs_posts',
    132                 'table_name_blog_comments' => $wpdb->base_prefix . 'bp_user_blogs_comments',
    133                 'table_name_blogmeta' => $wpdb->base_prefix . 'bp_user_blogs_blogmeta',
    134                 'format_activity_function' => 'bp_blogs_format_activity',
    135                 'image_base' => site_url( MUPLUGINDIR . '/bp-groups/images' ),
    136                 'slug'           => BP_BLOGS_SLUG
    137         );
    138        
    139         $bp['version_numbers'][$bp['blogs']['slug']] = BP_BLOGS_VERSION;
    140        
    141         /* Register 'groups' as a root component */
    142         bp_core_add_root_component( $bp['blogs']['slug'] );
     129        $bp->blogs->table_name = $wpdb->base_prefix . 'bp_user_blogs';
     130        $bp->blogs->table_name_blog_posts = $wpdb->base_prefix . 'bp_user_blogs_posts';
     131        $bp->blogs->table_name_blog_comments = $wpdb->base_prefix . 'bp_user_blogs_comments';
     132        $bp->blogs->table_name_blogmeta = $wpdb->base_prefix . 'bp_user_blogs_blogmeta';
     133        $bp->blogs->format_activity_function = 'bp_blogs_format_activity';
     134        $bp->blogs->image_base = site_url( MUPLUGINDIR . '/bp-groups/images' );
     135        $bp->blogs->slug = BP_BLOGS_SLUG;
     136
     137        $bp->version_numbers->blogs = BP_BLOGS_VERSION;
    143138}
    144139add_action( 'wp', 'bp_blogs_setup_globals', 1 );       
    … …  
    155150 *
    156151 * Adds "Blog" to the navigation arrays for the current and logged in user.
    157  * $bp['bp_nav'] represents the main component navigation
    158  * $bp['bp_users_nav'] represents the sub navigation when viewing a users
    159  * profile other than that of the current logged in user.
    160152 *
    161153 * @package BuddyPress Blogs
    … …  
    167159       
    168160        /* Add 'Blogs' to the main navigation */
    169         bp_core_add_nav_item( __('Blogs', 'buddypress'), $bp['blogs']['slug'] );
    170 
    171         if ( $bp['current_userid'] )
    172                 bp_core_add_nav_default( $bp['blogs']['slug'], 'bp_blogs_screen_my_blogs', 'my-blogs' );
    173        
    174         $blogs_link = $bp['loggedin_domain'] . $bp['blogs']['slug'] . '/';
     161        bp_core_add_nav_item( __( 'Blogs', 'buddypress' ), $bp->blogs->slug );
     162
     163        if ( $bp->displayed_user->id )
     164                bp_core_add_nav_default( $bp->blogs->slug, 'bp_blogs_screen_my_blogs', 'my-blogs' );
     165       
     166        $blogs_link = $bp->loggedin_user->domain . $bp->blogs->slug . '/';
    175167       
    176168        /* Add the subnav items to the blogs nav item */
    177         bp_core_add_subnav_item( $bp['blogs']['slug'], 'my-blogs', __('My Blogs', 'buddypress'), $blogs_link, 'bp_blogs_screen_my_blogs', 'my-blogs-list' );
    178         bp_core_add_subnav_item( $bp['blogs']['slug'], 'recent-posts', __('Recent Posts', 'buddypress'), $blogs_link, 'bp_blogs_screen_recent_posts' );
    179         bp_core_add_subnav_item( $bp['blogs']['slug'], 'recent-comments', __('Recent Comments', 'buddypress'), $blogs_link, 'bp_blogs_screen_recent_comments' );
    180         bp_core_add_subnav_item( $bp['blogs']['slug'], 'create-a-blog', __('Create a Blog', 'buddypress'), $blogs_link, 'bp_blogs_screen_create_a_blog' );
     169        bp_core_add_subnav_item( $bp->blogs->slug, 'my-blogs', __('My Blogs', 'buddypress'), $blogs_link, 'bp_blogs_screen_my_blogs', 'my-blogs-list' );
     170        bp_core_add_subnav_item( $bp->blogs->slug, 'recent-posts', __('Recent Posts', 'buddypress'), $blogs_link, 'bp_blogs_screen_recent_posts' );
     171        bp_core_add_subnav_item( $bp->blogs->slug, 'recent-comments', __('Recent Comments', 'buddypress'), $blogs_link, 'bp_blogs_screen_recent_comments' );
     172        bp_core_add_subnav_item( $bp->blogs->slug, 'create-a-blog', __('Create a Blog', 'buddypress'), $blogs_link, 'bp_blogs_screen_create_a_blog' );
    181173       
    182174        /* Set up the component options navigation for Blog */
    183         if ( $bp['current_component'] == 'blogs' ) {
     175        if ( $bp->current_component == 'blogs' ) {
    184176                if ( bp_is_home() ) {
    185177                        if ( function_exists('xprofile_setup_nav') ) {
    186                                 $bp['bp_options_title'] = __('My Blogs', 'buddypress');
     178                                $bp->bp_options_title = __('My Blogs', 'buddypress');
    187179                        }
    188180                } else {
    189181                        /* If we are not viewing the logged in user, set up the current users avatar and name */
    190                         $bp['bp_options_avatar'] = bp_core_get_avatar( $bp['current_userid'], 1 );
    191                         $bp['bp_options_title'] = $bp['current_fullname'];
     182                        $bp->bp_options_avatar = bp_core_get_avatar( $bp->displayed_user->id, 1 );
     183                        $bp->bp_options_title = $bp->displayed_user->fullname;
    192184                }
    193185        }
    … …  
    229221        /* Because blog, comment, and blog post code execution happens before anything else
    230222           we need to manually instantiate the activity component globals */
    231         if ( !$bp['activity'] && function_exists('bp_activity_setup_globals') )
     223        if ( !$bp->activity && function_exists('bp_activity_setup_globals') )
    232224                bp_activity_setup_globals();
    233225
    … …  
    364356       
    365357        if ( !$user_id )
    366                 $user_id = $bp['loggedin_userid'];
     358                $user_id = $bp->loggedin_user->id;
    367359               
    368360        $name = get_blog_option( $blog_id, 'blogname' );
    … …  
    577569       
    578570        // Delete activity stream item
    579         bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component_name' => 'blogs', 'component_action' => 'new_blog', 'user_id' => $bp['loggedin_userid'] ) );
     571        bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component_name' => 'blogs', 'component_action' => 'new_blog', 'user_id' => $bp->loggedin_user->id ) );
    580572       
    581573        do_action( 'bp_blogs_remove_blog', $blog_id );
    … …  
    635627
    636628        // Delete activity stream item
    637         bp_blogs_delete_activity( array( 'item_id' => $comment_id, 'component_name' => 'blogs', 'component_action' => 'new_blog_comment', 'user_id' => $bp['loggedin_userid'] ) );
     629        bp_blogs_delete_activity( array( 'item_id' => $comment_id, 'component_name' => 'blogs', 'component_action' => 'new_blog_comment', 'user_id' => $bp->loggedin_user->id ) );
    638630
    639631        do_action( 'bp_blogs_remove_comment', $blog_id, $comment_id );
    … …  
    699691        global $bp, $wpdb;
    700692       
    701         if ( $bp['current_component'] == $bp['blogs']['slug'] && isset( $_GET['random-blog'] ) ) {
     693        if ( $bp->current_component == $bp->blogs->slug && isset( $_GET['random-blog'] ) ) {
    702694                $blog = bp_blogs_get_random_blog();
    703695
    … …  
    729721
    730722        if ( !$meta_key ) {
    731                 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['blogs']['table_name_blogpmeta'] . " WHERE blog_id = %d", $blog_id ) );             
     723                $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp->blogs->table_name_blogpmeta . " WHERE blog_id = %d", $blog_id ) );         
    732724        } else if ( !$meta_value ) {
    733                 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['blogs']['table_name_blogmeta'] . " WHERE blog_id = %d AND meta_key = %s AND meta_value = %s", $blog_id, $meta_key, $meta_value ) );
     725                $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->blogs->table_name_blogmeta} WHERE blog_id = %d AND meta_key = %s AND meta_value = %s", $blog_id, $meta_key, $meta_value ) );
    734726        } else {
    735                 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['blogs']['table_name_blogmeta'] . " WHERE blog_id = %d AND meta_key = %s", $blog_id, $meta_key ) );
     727                $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->blogs->table_name_blogmeta} WHERE blog_id = %d AND meta_key = %s", $blog_id, $meta_key ) );
    736728        }
    737729       
    … …  
    760752                //      $metas = array($user->$meta_key);
    761753                //else
    762                 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM " . $bp['blogs']['table_name_blogmeta'] . " WHERE blog_id = %d AND meta_key = %s", $blog_id, $meta_key) );
     754                $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM {$bp->blogs->table_name_blogmeta} WHERE blog_id = %d AND meta_key = %s", $blog_id, $meta_key) );
    763755        } else {
    764                 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM " . $bp['blogs']['table_name_blogmeta'] . " WHERE blog_id = %d", $blog_id) );
     756                $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM {$bp->blogs->table_name_blogmeta} WHERE blog_id = %d", $blog_id) );
    765757        }
    766758
    … …  
    797789        }
    798790
    799         $cur = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $bp['blogs']['table_name_blogmeta'] . " WHERE blog_id = %d AND meta_key = %s", $blog_id, $meta_key ) );
     791        $cur = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->blogs->table_name_blogmeta} WHERE blog_id = %d AND meta_key = %s", $blog_id, $meta_key ) );
    800792       
    801793        if ( !$cur ) {
    802                 $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp['blogs']['table_name_blogmeta'] . " ( blog_id, meta_key, meta_value ) VALUES ( %d, %s, %s )", $blog_id, $meta_key, $meta_value ) );
     794                $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->blogs->table_name_blogmeta} ( blog_id, meta_key, meta_value ) VALUES ( %d, %s, %s )", $blog_id, $meta_key, $meta_value ) );
    803795        } else if ( $cur->meta_value != $meta_value ) {
    804                 $wpdb->query( $wpdb->prepare( "UPDATE " . $bp['blogs']['table_name_blogmeta'] . " SET meta_value = %s WHERE blog_id = %d AND meta_key = %s", $meta_value, $blog_id, $meta_key ) );
     796                $wpdb->query( $wpdb->prepare( "UPDATE {$bp->blogs->table_name_blogmeta} SET meta_value = %s WHERE blog_id = %d AND meta_key = %s", $meta_value, $blog_id, $meta_key ) );
    805797        } else {
    806798                return false;
  • trunk/bp-blogs/bp-blogs-ajax.php

    r926 r1021  
    3535                <div id="blog-dir-count" class="pag-count">
    3636                        <?php echo sprintf( __( 'Viewing blog %d to %d (%d total active blogs)', 'buddypress' ), $from_num, $to_num, $blogs['total'] ); ?> &nbsp;
    37                         <img id="ajax-loader-blogs" src="<?php echo $bp['core']['image_base'] ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" />
     37                        <img id="ajax-loader-blogs" src="<?php echo $bp->core->image_base ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" />
    3838                </div>
    3939       
    … …  
    4646                        <li>
    4747                                <div class="item-avatar">
    48                                         <img src="<?php echo 'http://www.gravatar.com/avatar/' . md5( $blog->blog_id . '.blogs@' . $bp['root_domain'] ) . '?d=identicon&amp;s=50'; ?>" class="avatar" alt="Blog Identicon" />
     48                                        <img src="<?php echo 'http://www.gravatar.com/avatar/' . md5( $blog->blog_id . '.blogs@' . $bp->root_domain ) . '?d=identicon&amp;s=50'; ?>" class="avatar" alt="Blog Identicon" />
    4949                                </div>
    5050
  • trunk/bp-blogs/bp-blogs-templatetags.php

    r833 r1021  
    1919               
    2020                if ( !$user_id )
    21                         $user_id = $bp['current_userid'];
     21                        $user_id = $bp->displayed_user->id;
    2222
    2323                $this->pag_page = isset( $_GET['fpage'] ) ? intval( $_GET['fpage'] ) : 1;
    … …  
    137137               
    138138                if ( !$user_id )
    139                         $user_id = $bp['current_userid'];
     139                        $user_id = $bp->displayed_user->id;
    140140
    141141                $this->pag_page = isset( $_GET['fpage'] ) ? intval( $_GET['fpage'] ) : 1;
    … …  
    485485               
    486486                if ( !$user_id )
    487                         $user_id = $bp['current_userid'];
     487                        $user_id = $bp->displayed_user->id;
    488488
    489489                $this->pag_page = isset( $_GET['fpage'] ) ? intval( $_GET['fpage'] ) : 1;
    … …  
    684684                <p><?php _e("If you&#8217;re not going to use a great blog domain, leave it for a new user. Now have at it!", 'buddypress') ?></p>
    685685
    686                 <form id="setupform" method="post" action="<?php echo $bp['loggedin_domain'] . $bp['blogs']['slug'] . '/create-a-blog' ?>">
     686                <form id="setupform" method="post" action="<?php echo $bp->loggedin_user->domain . $bp->blogs->slug . '/create-a-blog' ?>">
    687687
    688688                        <input type="hidden" name="stage" value="gimmeanotherblog" />
    … …  
    804804       
    805805        if ( bp_is_home() )     {
    806                 echo apply_filters( 'bp_create_blog_link', '<a href="' . $bp['loggedin_domain'] . $bp['blogs']['slug'] . '/create-a-blog">' . __('Create a Blog', 'buddypress') . '</a>' );
     806                echo apply_filters( 'bp_create_blog_link', '<a href="' . $bp->loggedin_user->domain . $bp->blogs->slug . '/create-a-blog">' . __('Create a Blog', 'buddypress') . '</a>' );
    807807        }
    808808}
    … …  
    815815                return false;
    816816       
    817         $current_tab = $bp['current_action'];
     817        $current_tab = $bp->current_action
    818818?>
    819819        <ul class="content-header-nav">
    820                 <li<?php if ( $current_tab == 'my-blogs' || $current_tab == '' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['current_domain'] . $bp['blogs']['slug'] ?>/my-blogs"><?php printf( __( "%s's Blogs", 'buddypress' ), $bp['current_fullname'] )  ?></a></li>
    821                 <li<?php if ( $current_tab == 'recent-posts' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['current_domain'] . $bp['blogs']['slug'] ?>/recent-posts"><?php printf( __( "%s's Recent Posts", 'buddypress' ), $bp['current_fullname'] )  ?></a></li>
    822                 <li<?php if ( $current_tab == 'recent-comments' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['current_domain'] . $bp['blogs']['slug'] ?>/recent-comments"><?php printf( __( "%s's Recent Comments", 'buddypress' ), $bp['current_fullname'] )  ?></a></li>     
     820                <li<?php if ( $current_tab == 'my-blogs' || $current_tab == '' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->blogs->slug ?>/my-blogs"><?php printf( __( "%s's Blogs", 'buddypress' ), $bp->displayed_user->fullname )  ?></a></li>
     821                <li<?php if ( $current_tab == 'recent-posts' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->blogs->slug ?>/recent-posts"><?php printf( __( "%s's Recent Posts", 'buddypress' ), $bp->displayed_user->fullname )  ?></a></li>
     822                <li<?php if ( $current_tab == 'recent-comments' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->blogs->slug ?>/recent-comments"><?php printf( __( "%s's Recent Comments", 'buddypress' ), $bp->displayed_user->fullname )  ?></a></li>     
    823823        </ul>
    824824<?php
  • trunk/bp-blogs/directories/bp-blogs-directory-blogs.php

    r926 r1021  
    33        global $bp, $current_blog;
    44       
    5         if ( $bp['current_component'] == $bp['blogs']['slug'] && $bp['current_action'] == '' ) {
     5        if ( $bp->current_component == $bp->blogs->slug && $bp->current_action == '' ) {
    66                add_action( 'bp_template_content', 'bp_blogs_directory_blogs_content' );
    77                add_action( 'bp_template_sidebar', 'bp_blogs_directory_blogs_sidebar' );
    … …  
    8888                        <div id="blog-dir-count" class="pag-count">
    8989                                <?php echo sprintf( __( 'Viewing blog %d to %d (%d total active blogs)', 'buddypress' ), $from_num, $to_num, $blogs['total'] ); ?> &nbsp;
    90                                 <img id="ajax-loader-blogs" src="<?php echo $bp['core']['image_base'] ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" />
     90                                <img id="ajax-loader-blogs" src="<?php echo $bp->core->image_base ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" />
    9191                        </div>
    9292                       
    … …  
    9999                                <li>
    100100                                        <div class="item-avatar">
    101                                                 <img src="<?php echo 'http://www.gravatar.com/avatar/' . md5( $blog->blog_id . '.blogs@' . $bp['root_domain'] ) . '?d=identicon&amp;s=50'; ?>" class="avatar" alt="Blog Identicon" />
     101                                                <img src="<?php echo 'http://www.gravatar.com/avatar/' . md5( $blog->blog_id . '.blogs@' . $bp->root_domain ) . '?d=identicon&amp;s=50'; ?>" class="avatar" alt="Blog Identicon" />
    102102                                        </div>
    103103
    … …  
    154154        <div class="widget">
    155155                <h2 class="widgettitle"><?php _e( 'Find Blogs', 'buddypress' ) ?></h2>
    156                 <form action="<?php echo site_url() . '/' . $bp['blogs']['slug']  . '/search/' ?>" method="post" id="search-blogs-form">
     156                <form action="<?php echo site_url() . '/' . $bp->blogs->slug  . '/search/' ?>" method="post" id="search-blogs-form">
    157157                        <label><input type="text" name="blogs_search" id="blogs_search" value="<?php if ( isset( $_GET['s'] ) ) { echo $_GET['s']; } else { _e('Search anything...', 'buddypress' ); } ?>"  onfocus="if (this.value == '<?php _e('Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e('Search anything...', 'buddypress' ) ?>';}" /></label>
    158158                        <input type="submit" id="blogs_search_submit" name="blogs_search_submit" value="Search" />
  • trunk/bp-core.php

    r1017 r1021  
    5555require_once( 'bp-core/bp-core-activation.php' );
    5656
    57 /* Define the slug for member pages and the members directory (e.g. example.com/[members] ) */
     57/* Define the slug for member pages and the members directory (e.g. domain.com/[members] ) */
    5858define( 'MEMBERS_SLUG', apply_filters( 'bp_members_slug', 'members' ) );
    5959
    … …  
    9191        global $bp, $wpdb;
    9292        global $current_user, $current_component, $current_action, $current_blog;
    93         global $current_userid;
     93        global $displayed_user_id;
    9494        global $action_variables;
    9595
    9696        /* The domain for the root of the site where the main blog resides */   
    97         $bp['root_domain'] = bp_core_get_root_domain();
     97        $bp->root_domain = bp_core_get_root_domain();
    9898       
    9999        /* The user ID of the user who is currently logged in. */
    100         $bp['loggedin_userid'] = $current_user->ID;
     100        $bp->loggedin_user->id = $current_user->ID;
     101
     102        /* The domain for the user currently logged in. eg: http://domain.com/members/andy */
     103        $bp->loggedin_user->domain = bp_core_get_user_domain($current_user->ID);
    101104       
    102105        /* The user id of the user currently being viewed, set in /bp-core/bp-core-catchuri.php */
    103         $bp['current_userid'] = $current_userid;
    104        
    105         /* The domain for the user currently logged in. eg: http://example.com/members/andy */
    106         $bp['loggedin_domain'] = bp_core_get_user_domain($current_user->ID);
    107        
    108         /* The domain for the user currently being viewed */
    109         $bp['current_domain'] = bp_core_get_user_domain($current_userid);
    110        
    111         /* The component being used eg: http://andy.example.com/ [profile] */
    112         $bp['current_component'] = $current_component; // type: string
    113        
    114         /* The current action for the component eg: http://andy.example.com/profile/ [edit] */
    115         $bp['current_action'] = $current_action; // type: string
    116        
    117         /* The action variables for the current action eg: http://andy.example.com/profile/edit/ [group] / [6] */
    118         $bp['action_variables'] = $action_variables; // type: array
    119        
    120         /* Only used where a component has a sub item, e.g. groups: http://andy.example.com/groups/ [my-group] / home - manipulated in the actual component not in catch uri code.*/
    121         $bp['current_item'] = ''; // type: string
    122 
    123         /* The default component to use if none are set and someone visits: http://andy.example.com/ */
    124         $bp['default_component'] = 'profile';
     106        $bp->displayed_user->id = $displayed_user_id;
     107       
     108        /* The domain for the user currently being displayed */
     109        $bp->displayed_user->domain = bp_core_get_user_domain($displayed_user_id);
     110       
     111        /* The component being used eg: http://andy.domain.com/ [profile] */
     112        $bp->current_component = $current_component; // type: string
     113       
     114        /* The current action for the component eg: http://andy.domain.com/profile/ [edit] */
     115        $bp->current_action = $current_action; // type: string
     116       
     117        /* The action variables for the current action eg: http://andy.domain.com/profile/edit/ [group] / [6] */
     118        $bp->action_variables = $action_variables; // type: array
     119       
     120        /* Only used where a component has a sub item, e.g. groups: http://andy.domain.com/groups/ [my-group] / home - manipulated in the actual component not in catch uri code.*/
     121        $bp->current_item = ''; // type: string
     122
     123        /* The default component to use if none are set and someone visits: http://andy.domain.com/ */
     124        $bp->default_component = 'profile';
    125125       
    126126        /* Sets up the array container for the component navigation rendered by bp_get_nav() */
    127         $bp['bp_nav'] = array();
     127        $bp->bp_nav = array();
    128128
    129129        /* Sets up the array container for the user navigation rendered by bp_get_user_nav() */
    130         $bp['bp_users_nav'] = array();
     130        $bp->bp_users_nav = array();
    131131       
    132132        /* Sets up the array container for the component options navigation rendered by bp_get_options_nav() */
    133         $bp['bp_options_nav'] = array();
     133        $bp->bp_options_nav = array();
    134134       
    135135        /* Sets up container used for the title of the current component option and rendered by bp_get_options_title() */
    136         $bp['bp_options_title'] = '';
     136        $bp->bp_options_title = '';
    137137       
    138138        /* Sets up container used for the avatar of the current component being viewed. Rendered by bp_get_options_avatar() */
    139         $bp['bp_options_avatar'] = '';
     139        $bp->bp_options_avatar = '';
    140140
    141141        /* Fetch the full name for the logged in and current user */
    142         $bp['loggedin_fullname'] = bp_core_global_user_fullname( $bp['loggedin_userid'] );
    143         $bp['current_fullname'] = bp_core_global_user_fullname( $bp['current_userid'] );
     142        $bp->loggedin_user->fullname = bp_core_global_user_fullname( $bp->loggedin_user->id );
     143        $bp->displayed_user->fullname = bp_core_global_user_fullname( $bp->displayed_user->id );
    144144
    145145        /* Used to determine if user has admin rights on current content. If the logged in user is viewing
    … …  
    147147           generic variable so it can be used in other components. It can also be modified, so when viewing a group
    148148           'is_item_admin' would be 1 if they are a group admin, 0 if they are not. */
    149         $bp['is_item_admin'] = bp_is_home();
     149        $bp->is_item_admin = bp_is_home();
    150150       
    151151        /* Used to determine if the logged in user is a moderator for the current content. */
    152         $bp['is_item_mod'] = false;
    153        
    154         $bp['core'] = array(
    155                 'image_base' => site_url( MUPLUGINDIR . '/bp-core/images' ),
    156                 'table_name_notifications' => $wpdb->base_prefix . 'bp_notifications'
    157         );
     152        $bp->is_item_mod = false;
     153       
     154        $bp->core->image_base = site_url( MUPLUGINDIR . '/bp-core/images' );
     155        $bp->core->table_name_notifications = $wpdb->base_prefix . 'bp_notifications';
    158156       
    159157        /* Used to print version numbers in the footer for reference */
    160         $bp['version_numbers']['core'] = BP_CORE_VERSION;
    161        
    162         if ( !$bp['current_component'] )
    163                 $bp['current_component'] = $bp['default_component'];
     158        $bp->version_numbers = new stdClass;
     159        $bp->version_numbers->core = BP_CORE_VERSION;
     160       
     161        if ( !$bp->current_component )
     162                $bp->current_component = $bp->default_component;
    164163}
    165164add_action( 'wp', 'bp_core_setup_globals', 1 );
    … …  
    193192                $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
    194193       
    195         $sql[] = "CREATE TABLE ". $bp['core']['table_name_notifications'] ." (
     194        $sql[] = "CREATE TABLE $bp->core->table_name_notifications (
    196195                                id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    197196                                user_id int(11) NOT NULL,
    198197                                item_id int(11) NOT NULL,
    199                                 secondary_item_id int(11) NOT NULL,
     198                                secondary_item_id int(11),
    200199                                component_name varchar(75) NOT NULL,
    201200                                component_action varchar(75) NOT NULL,
    … …  
    218217        // dbDelta won't change character sets, so we need to do this seperately.
    219218        // This will only be in here pre v1.0
    220         $wpdb->query( $wpdb->prepare( "ALTER TABLE " . $bp['core']['table_name_notifications'] . " DEFAULT CHARACTER SET %s", $wpdb->charset ) );
     219        $wpdb->query( $wpdb->prepare( "ALTER TABLE $bp->core->table_name_notifications DEFAULT CHARACTER SET %s", $wpdb->charset ) );
    221220       
    222221        update_site_option( 'bp-core-db-version', BP_CORE_DB_VERSION );
    … …  
    241240        if ( is_site_admin() ) {
    242241                /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    243                 if ( ( $wpdb->get_var("SHOW TABLES LIKE '%" . $bp['core']['table_name_notifications'] . "%'") == false ) || ( get_site_option('bp-core-db-version') < BP_CORE_DB_VERSION )  )
     242                if ( ( $wpdb->get_var("show tables like '%{$bp->core->table_name_notifications}%'") == false ) || ( get_site_option('bp-core-db-version') < BP_CORE_DB_VERSION )  )
    244243                        bp_core_install();
    245244        }
    … …  
    263262        if ( is_site_admin() ) {
    264263                /* Add the administration tab under the "Site Admin" tab for site administrators */
    265                 add_submenu_page( 'wpmu-admin.php', __('BuddyPress', 'buddypress'), __('BuddyPress', 'buddypress'), 1, 'bp_core_admin_settings', 'bp_core_admin_settings' );
     264                add_submenu_page( 'wpmu-admin.php', __("BuddyPress", 'buddypress'), __("BuddyPress", 'buddypress'), 1, "bp_core_admin_settings", "bp_core_admin_settings" );
    266265        }
    267266}
    … …  
    272271 *
    273272 * Checks to see if a component's URL should be in the root, not under a member page:
    274  * eg: http://example.com/groups/the-group NOT http://example.com/members/andy/groups/the-group
     273 * eg: http://domain.com/groups/the-group NOT http://domain.com/members/andy/groups/the-group
    275274 *
    276275 * @package BuddyPress Core
    … …  
    280279        global $bp;
    281280
    282         return in_array( $component_name, $bp['root_components'] );
     281        return in_array( $component_name, $bp->root_components );
    283282}
    284283
    … …  
    304303                bp_core_add_nav_default( 'profile', 'bp_core_catch_profile_uri', 'public' );
    305304
    306                 $profile_link = $bp['loggedin_domain'] . '/profile/';
     305                $profile_link = $bp->loggedin_user->domain . '/profile/';
    307306
    308307                /* Add the subnav items to the profile */
    309308                bp_core_add_subnav_item( 'profile', 'public', __('Public', 'buddypress'), $profile_link, 'xprofile_screen_display_profile' );
    310309
    311                 if ( $bp['current_component'] == 'profile' ) {
     310                if ( $bp->current_component == 'profile' ) {
    312311                        if ( bp_is_home() ) {
    313                                 $bp['bp_options_title'] = __('My Profile', 'buddypress');
     312                                $bp->bp_options_title = __('My Profile', 'buddypress');
    314313                        } else {
    315                                 $bp['bp_options_avatar'] = bp_core_get_avatar( $bp['current_userid'], 1 );
    316                                 $bp['bp_options_title'] = $bp['current_fullname'];
     314                                $bp->bp_options_avatar = bp_core_get_avatar( $bp->displayed_user->id, 1 );
     315                                $bp->bp_options_title = $bp->displayed_user->fullname;
    317316                        }
    318317                }
    … …  
    326325 *
    327326 * Returns the domain for the passed user:
    328  * e.g. http://example.com/members/andy/
     327 * e.g. http://domain.com/members/andy/
    329328 *
    330329 * @package BuddyPress Core
    … …  
    338337        if ( !$user_id ) return;
    339338       
    340         $ud = get_userdata( $user_id );
    341        
    342         return $bp['root_domain'] . '/' . MEMBERS_SLUG . '/' . $ud->user_login . '/';
     339        $ud = get_userdata($user_id);
     340       
     341        return $bp->root_domain . '/' . MEMBERS_SLUG . '/' . $ud->user_login . '/';
    343342}
    344343
    … …  
    347346 *
    348347 * Returns the domain for the root blog.
    349  * eg: http://example.com/ OR https://example.com
     348 * eg: http://domain.com/ OR https://domain.com
    350349 *
    351350 * @package BuddyPress Core
    … …  
    364363
    365364/**
    366  * bp_core_get_current_userid()
    367  *
    368  * Returns the user id for the user that is currently being viewed.
    369  * eg: http://andy.example.com/ or http://example.com/andy/
     365 * bp_core_get_displayed_userid()
     366 *
     367 * Returns the user id for the user that is currently being displayed.
     368 * eg: http://andy.domain.com/ or http://domain.com/andy/
    370369 *
    371370 * @package BuddyPress Core
    372371 * @global $current_blog WordPress global containing information and settings for the current blog being viewed.
    373372 * @uses bp_core_get_userid_from_user_login() Returns the user id for the username passed
    374  * @return $current_userid The user id for the user that is currently being viewed, return zero if this is not a user home and just a normal blog.
    375  */
    376 function bp_core_get_current_userid( $user_login ) {
     373 * @return The user id for the user that is currently being displayed, return zero if this is not a user home and just a normal blog.
     374 */
     375function bp_core_get_displayed_userid( $user_login ) {
    377376        return bp_core_get_userid_from_user_login( $user_login );
    378377}
    … …  
    395394        global $bp;
    396395       
    397         $nav_key = count($bp['bp_nav']) + 1;
    398         $user_nav_key = count($bp['bp_users_nav']) + 1;
     396        $nav_key = count($bp->bp_nav) + 1;
     397        $user_nav_key = count($bp->bp_users_nav) + 1;
    399398       
    400399        if ( !$css_id )
    401400                $css_id = $slug;
    402401
    403         $bp['bp_nav'][$nav_key] = array(
     402        $bp->bp_nav[$nav_key] = array(
    404403                'name'   => $name,
    405                 'link'   => $bp['loggedin_domain'] . $slug,
     404                'link'   => $bp->loggedin_user->domain . $slug,
    406405                'css_id' => $css_id
    407406        );
    408407       
    409408        if ( $add_to_usernav ) {
    410                 $bp['bp_users_nav'][$user_nav_key] = array(
     409                $bp->bp_users_nav[$user_nav_key] = array(
    411410                        'name'   => $name,
    412                         'link'   => $bp['current_domain'] . $slug,
     411                        'link'   => $bp->displayed_user->domain . $slug,
    413412                        'css_id' => $css_id
    414413                );
    … …  
    441440                $css_id = $slug;
    442441
    443         $bp['bp_options_nav'][$parent_id][$slug] = array(
     442        $bp->bp_options_nav[$parent_id][$slug] = array(
    444443                'name' => $name,
    445444                'link' => $link . $slug,
    … …  
    447446        );
    448447       
    449         if ( function_exists($function) && $user_has_access && $bp['current_action'] == $slug && $bp['current_component'] == $parent_id )
     448        if ( function_exists($function) && $user_has_access && $bp->current_action == $slug && $bp->current_component == $parent_id )
    450449                add_action( 'wp', $function, 3 );
    451450}
    … …  
    464463        global $bp;
    465464
    466         unset($bp['bp_options_nav'][$parent_id]);
     465        unset($bp->bp_options_nav[$parent_id]);
    467466}
    468467
    … …  
    489488                return false;
    490489
    491         if ( $bp['current_component'] == $parent_id && !$bp['current_action'] ) {
     490        if ( $bp->current_component == $parent_id && !$bp->current_action ) {
    492491                if ( function_exists($function) ) {
    493492                        add_action( 'wp', $function, 3 );
    … …  
    495494               
    496495                if ( $slug )
    497                         $bp['current_action'] = $slug;
     496                        $bp->current_action = $slug;
    498497        }
    499498}
    … …  
    522521 * bp_core_add_root_component()
    523522 *
    524  * Adds a component to the $bp['root_components'] global.
     523 * Adds a component to the $bp->root_components global.
    525524 * Any component that runs in the "root" of an install should be added.
    526525 * The "root" as in, it can or always runs outside of the /members/username/ path.
    527526 *
    528527 * Example of a root component:
    529  *  Groups: http://example.com/groups/group-name
    530  *          http://community.example.com/groups/group-name
    531  *          http://example.com/wpmu/groups/group-name
     528 *  Groups: http://domain.com/groups/group-name
     529 *          http://community.domain.com/groups/group-name
     530 *          http://domain.com/wpmu/groups/group-name
    532531 *
    533532 * Example of a component that is NOT a root component:
    534  *  Friends: http://example.com/members/andy/friends
    535  *           http://community.example.com/members/andy/friends
    536  *           http://example.com/wpmu/members/andy/friends
     533 *  Friends: http://domain.com/members/andy/friends
     534 *           http://community.domain.com/members/andy/friends
     535 *           http://domain.com/wpmu/members/andy/friends
    537536 *
    538537 * @package BuddyPress Core
    … …  
    543542        global $bp;
    544543
    545         $bp['root_components'][] = $slug;
     544        $bp->root_components[] = $slug;
    546545}
    547546
    … …  
    560559        global $bp, $wpdb;
    561560       
    562         if ( $bp['current_component'] == MEMBERS_SLUG && isset( $_GET['random'] ) ) {
     561        if ( $bp->current_component == MEMBERS_SLUG && isset( $_GET['random'] ) ) {
    563562                $user = BP_Core_User::get_random_users(1);
    564563
    565564                $ud = get_userdata( $user['users'][0]->user_id );
    566                 bp_core_redirect( $bp['root_domain'] . '/' . MEMBERS_SLUG . '/' . $ud->user_login );
     565                bp_core_redirect( $bp->root_domain . '/' . MEMBERS_SLUG . '/' . $ud->user_login );
    567566        }
    568567}
    … …  
    647646        $ud = get_userdata($uid);
    648647               
    649         return $bp['root_domain'] . '/' . MEMBERS_SLUG . '/' . $ud->user_login . '/';
     648        return $bp->root_domain . '/' . MEMBERS_SLUG . '/' . $ud->user_login . '/';
    650649}
    651650
    … …  
    670669 *
    671670 * Returns a HTML formatted link for a user with the user's full name as the link text.
    672  * eg: <a href="http://andy.example.com/">Andy Peatling</a>
     671 * eg: <a href="http://andy.domain.com/">Andy Peatling</a>
    673672 * Optional parameters will return just the name, or just the URL, or disable "You" text when
    674673 * user matches the logged in user.
    … …  
    980979        global $bp;
    981980       
    982         if ( !is_user_logged_in() || !get_usermeta( $bp['loggedin_userid'], 'last_activity') )
     981        if ( !is_user_logged_in() )
    983982                return false;
    984983       
    985         if ( time() >= strtotime('+5 minutes', get_usermeta( $bp['loggedin_userid'], 'last_activity') ) || get_usermeta( $bp['loggedin_userid'], 'last_activity') == '' ) {
     984        if ( time() >= strtotime( '+5 minutes', get_usermeta( $bp->loggedin_user->id, 'last_activity' ) ) || '' == get_usermeta( $bp->loggedin_user->id, 'last_activity' ) ) {
    986985                // Updated last site activity for this user.
    987                 update_usermeta( $bp['loggedin_userid'], 'last_activity', time() );
     986                update_usermeta( $bp->loggedin_user->id, 'last_activity', time() );
    988987        }
    989988}
    … …  
    10031002 */
    10041003function bp_core_get_last_activity( $last_activity_date, $string ) {
    1005         if ( !$last_activity_date || $last_activity_date == '' ) {
     1004        if ( !$last_activity_date || empty( $last_activity_date ) ) {
    10061005                $last_active = __('not recently active', 'buddypress');
    10071006        } else {
    … …  
    10321031       
    10331032        if ( !$user_id )
    1034                 $user_id = $bp['current_userid'];
     1033                $user_id = $bp->displayed_user->id;
    10351034       
    10361035        return $wpdb->get_col( $wpdb->prepare( "SELECT post_id FROM $wpdb->posts WHERE post_author = %d AND post_status = 'publish' AND post_type = 'post'", $user_id ) );
    … …  
    11031102        foreach ( (array)$nav_array as $key => $value ) {
    11041103                switch ( $nav_array[$key]['css_id'] ) {
    1105                         case $bp['activity']['slug']:
     1104                        case $bp->activity->slug:
    11061105                                $new_nav[0] = $nav_array[$key];
    11071106                                unset($nav_array[$key]);
    11081107                        break;
    1109                         case $bp['profile']['slug']:
     1108                        case $bp->profile->slug:
    11101109                                $new_nav[1] = $nav_array[$key];
    11111110                                unset($nav_array[$key]);
    … …  
    11151114                                unset($nav_array[$key]);
    11161115                        break;
    1117                         case $bp['blogs']['slug']:
     1116                        case $bp->blogs->slug:
    11181117                                $new_nav[2] = $nav_array[$key];
    11191118                                unset($nav_array[$key]);
    11201119                        break;
    1121                         case $bp['wire']['slug']:
     1120                        case $bp->wire->slug:
    11221121                                $new_nav[3] = $nav_array[$key];
    11231122                                unset($nav_array[$key]);
    11241123                        break;
    1125                         case $bp['messages']['slug']:
     1124                        case $bp->messages->slug:
    11261125                                $new_nav[4] = $nav_array[$key];
    11271126                                unset($nav_array[$key]);
    11281127                        break;
    1129                         case $bp['friends']['slug']:
     1128                        case $bp->friends->slug:
    11301129                                $new_nav[5] = $nav_array[$key];
    11311130                                unset($nav_array[$key]);
    11321131                        break;
    1133                         case $bp['groups']['slug']:
     1132                        case $bp->groups->slug:
    11341133                                $new_nav[6] = $nav_array[$key];
    11351134                                unset($nav_array[$key]);
    11361135                        break;
    1137                         case $bp['photos']['slug']:
     1136                        case $bp->photos->slug:
    11381137                                $new_nav[7] = $nav_array[$key];
    11391138                                unset($nav_array[$key]);
    11401139                        break;
    1141                         case $bp['account']['slug']:
     1140                        case $bp->account->slug:
    11421141                                $new_nav[8] = $nav_array[$key];
    11431142                                unset($nav_array[$key]);
    … …  
    11971196       
    11981197        $current = maybe_unserialize( get_site_option( 'illegal_names' ) );
    1199         $bp_illegal_names = $bp['root_components'];
     1198        $bp_illegal_names = $bp->root_components;
    12001199       
    12011200        if ( is_array( $current ) ) {
    … …  
    12521251        require_once( ABSPATH . '/wp-admin/includes/user.php' );
    12531252
    1254         return wpmu_delete_user( $bp['loggedin_userid'] );
     1253        return wpmu_delete_user( $bp->loggedin_user->id );
    12551254}
    12561255
    … …  
    12581257        global $bp;
    12591258       
    1260         if ( $bp['current_component'] == SEARCH_SLUG ) {
     1259        if ( $bp->current_component == SEARCH_SLUG ) {
    12611260                $search_terms = $_POST['search-terms'];
    12621261                $search_which = $_POST['search-which'];
    … …  
    13031302        global $bp;
    13041303       
    1305         foreach ( $bp['version_numbers'] as $name => $version ) {
     1304        foreach ( $bp->version_numbers as $name => $version ) {
    13061305                echo ucwords($name) . ': <b>' . $version . '</b> / ';
    13071306        }
  • trunk/bp-core/bp-core-admin.php

    r940 r1021  
    1515                        if ( function_exists( 'xprofile_install' ) ) {
    1616                                if ( $key == 'bp-xprofile-base-group-name' ) {
    17                                         $wpdb->query( $wpdb->prepare( "UPDATE " . $bp['profile']['table_name_groups'] . " SET name = %s WHERE name = %s AND id = 1", $value, stripslashes( get_site_option('bp-xprofile-base-group-name') ) ) );
     17                                        $wpdb->query( $wpdb->prepare( "UPDATE $bp->profile->table_name_groups SET name = %s WHERE name = %s AND id = 1", $value, stripslashes( get_site_option('bp-xprofile-base-group-name') ) ) );
    1818                                }
    1919                               
    2020                                if ( $key == 'bp-xprofile-fullname-field-name' ) {
    21                                         $wpdb->query( $wpdb->prepare( "UPDATE " . $bp['profile']['table_name_fields'] . " SET name = %s WHERE name = %s AND group_id = 1", $value, stripslashes( get_site_option('bp-xprofile-fullname-field-name') ) ) );
     21                                        $wpdb->query( $wpdb->prepare( "UPDATE $bp->profile->table_name_fields SET name = %s WHERE name = %s AND group_id = 1", $value, stripslashes( get_site_option('bp-xprofile-fullname-field-name') ) ) );
    2222                                }
    2323                        }
  • trunk/bp-core/bp-core-adminbar.php

    r969 r1021  
    2727        global $bp;
    2828       
    29         echo '<a href="' . $bp['root_domain'] . '"><img id="admin-bar-logo" src="' . apply_filters( 'bp_admin_bar_logo_src', site_url( MUPLUGINDIR . '/bp-core/images/admin_bar_logo.gif' ) ) . '" alt="' . apply_filters( 'bp_admin_bar_logo_alt_text', __( 'BuddyPress', 'buddypress' ) ) . '" /></a>';
     29        echo '<a href="' . $bp->root_domain . '"><img id="admin-bar-logo" src="' . apply_filters( 'bp_admin_bar_logo_src', site_url( MUPLUGINDIR . '/bp-core/images/admin_bar_logo.gif' ) ) . '" alt="' . apply_filters( 'bp_admin_bar_logo_alt_text', __( 'BuddyPress', 'buddypress' ) ) . '" /></a>';
    3030}
    3131
    … …  
    4949       
    5050        /* Sort the nav by key as the array has been put together in different locations */
    51         $bp['bp_nav'] = bp_core_sort_nav_items( $bp['bp_nav'] );
     51        $bp->bp_nav = bp_core_sort_nav_items( $bp->bp_nav );
    5252       
    5353        if ( is_user_logged_in() ) {
    … …  
    6060                /* Loop through each navigation item */
    6161                $counter = 0;
    62                 foreach( $bp['bp_nav'] as $nav_item ) {
     62                foreach( $bp->bp_nav as $nav_item ) {
    6363                        $alt = ( $counter % 2 == 0 ) ? ' class="alt"' : '';
    6464                       
    … …  
    6666                        echo '<a id="bp-admin-' . $nav_item['css_id'] . '" href="' . $nav_item['link'] . '">' . $nav_item['name'] . '</a>';
    6767
    68                         if ( is_array( $bp['bp_options_nav'][$nav_item['css_id']] ) ) {
     68                        if ( is_array( $bp->bp_options_nav[$nav_item['css_id']] ) ) {
    6969                                echo '<ul>';
    7070                                $sub_counter = 0;
    71                                 foreach( $bp['bp_options_nav'][$nav_item['css_id']] as $subnav_item ) {
     71                                foreach( $bp->bp_options_nav[$nav_item['css_id']] as $subnav_item ) {
    7272                                        $alt = ( $sub_counter % 2 == 0 ) ? ' class="alt"' : '';
    7373                                        echo '<li' . $alt . '><a id="bp-admin-' . $subnav_item['css_id'] . '" href="' . $subnav_item['link'] . '">' . $subnav_item['name'] . '</a></li>';                               
    … …  
    126126       
    127127                if ( function_exists('bp_blogs_install') ) {
    128                         $blogs = get_blogs_of_user( $bp['loggedin_userid'] ); // find *all* blogs with any kind of role
    129 
    130                         echo '<li><a href="' . $bp['loggedin_domain'] . $bp['blogs']['slug'] . '/my-blogs">';
     128                        $blogs = get_blogs_of_user( $bp->loggedin_user->id ); // find *all* blogs with any kind of role
     129
     130                        echo '<li><a href="' . $bp->loggedin_user->domain . $bp->blogs->slug . '/my-blogs">';
    131131                       
    132132                        _e( 'My Blogs', 'buddypress' );
    … …  
    139139                                $counter = 0;
    140140                                foreach( $blogs as $blog ) {
    141                                         $role = get_blog_role_for_user( $bp['loggedin_userid'], $blog->userblog_id );
     141                                        $role = get_blog_role_for_user( $bp->loggedin_user->id, $blog->userblog_id );
    142142
    143143                                        $alt = ( $counter % 2 == 0 ) ? ' class="alt"' : '';
    … …  
    163163
    164164                        echo '<li' . $alt . '>';
    165                         echo '<a href="' . $bp['loggedin_domain'] . $bp['blogs']['slug'] . '/create-a-blog">' . __('Create a Blog!', 'buddypress') . '</a>';
     165                        echo '<a href="' . $bp->loggedin_user->domain . $bp->blogs->slug . '/create-a-blog">' . __('Create a Blog!', 'buddypress') . '</a>';
    166166                        echo '</li>';
    167167       
    … …  
    177177                global $bp;
    178178               
    179                 echo '<li id="bp-admin-notifications_menu"><a href="' . $bp['loggedin_domain'] . '">';
     179                echo '<li id="bp-admin-notifications_menu"><a href="' . $bp->loggedin_user->domain . '">';
    180180                _e( 'Notifications', 'buddypress' );
    181181       
    182                 if ( $notifications = bp_core_get_notifications_for_user( $bp['loggedin_userid']) ) { ?>
     182                if ( $notifications = bp_core_get_notifications_for_user( $bp->loggedin_user->id ) ) { ?>
    183183                        <span><?php echo count($notifications) ?></span>
    184184                <?php
    … …  
    196196                        <?php } ?>
    197197                <?php } else { ?>
    198                         <li><a href="<?php echo $bp['loggedin_domain'] ?>"><?php _e( 'No new notifications.', 'buddypress' ); ?></a></li>
     198                        <li><a href="<?php echo $bp->loggedin_user->domain ?>"><?php _e( 'No new notifications.', 'buddypress' ); ?></a></li>
    199199                <?php
    200200                }
    … …  
    243243                <a href="#"><?php _e( 'Visit', 'buddypress' ) ?></a>
    244244                <ul class="random-list">
    245                         <li><a href="<?php echo $bp['root_domain'] . '/' . MEMBERS_SLUG . '/?random' ?>"><?php _e( 'Random Member', 'buddypress' ) ?></a></li>
     245                        <li><a href="<?php echo $bp->root_domain . '/' . MEMBERS_SLUG . '/?random' ?>"><?php _e( 'Random Member', 'buddypress' ) ?></a></li>
    246246
    247247                        <?php if ( function_exists('groups_install') ) : ?>
    248                         <li class="alt"><a href="<?php echo $bp['root_domain'] . '/' . $bp['groups']['slug'] . '/?random' ?>"><?php _e( 'Random Group', 'buddypress' ) ?></a></li>
     248                        <li class="alt"><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug . '/?random' ?>"><?php _e( 'Random Group', 'buddypress' ) ?></a></li>
    249249                        <?php endif; ?>
    250250
    251251                        <?php if ( function_exists('bp_blogs_install') ) : ?>
    252                         <li><a href="<?php echo $bp['root_domain'] . '/' . $bp['blogs']['slug'] . '/?random-blog' ?>"><?php _e( 'Random Blog', 'buddypress' ) ?></a></li>
     252                        <li><a href="<?php echo $bp->root_domain . '/' . $bp->blogs->slug . '/?random-blog' ?>"><?php _e( 'Random Blog', 'buddypress' ) ?></a></li>
    253253                       
    254254                        <?php endif; ?>
  • trunk/bp-core/bp-core-ajax.php

    r692 r1021  
    9292                <div id="member-dir-count" class="pag-count">
    9393                        <?php echo sprintf( __( 'Viewing member %d to %d (%d total active members)', 'buddypress' ), $from_num, $to_num, $users['total'] ); ?> &nbsp;
    94                         <img id="ajax-loader-members" src="<?php echo $bp['core']['image_base'] ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" />
     94                        <img id="ajax-loader-members" src="<?php echo $bp->core->image_base ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" />
    9595                </div>
    9696       
  • trunk/bp-core/bp-core-avatars.php

    r1011 r1021  
    3535       
    3636        $avatar_file = get_usermeta( $user, "bp_core_avatar_v$version" );
    37         $url = $bp['root_domain'] . '/' . $avatar_file;
     37        $url = $bp->root_domain . '/' . $avatar_file;
    3838       
    3939        if ( strlen($avatar_file) ) {
    … …  
    4646                $grav_option = get_site_option('user-avatar-default');
    4747               
    48                 if ( $grav_option == '' ) {
     48                if ( empty( $grav_option ) ) {
    4949                        $default_grav = 'wavatar';
    5050                } else if ( $grav_option == 'mystery' ) {
    … …  
    226226
    227227        if ( !$user_id )
    228                 $user_id = $bp['loggedin_userid'];
     228                $user_id = $bp->loggedin_user->id;
    229229
    230230        $path  = get_blog_option( 1, 'upload_path' );
    … …  
    271271       
    272272        if ( !$user_id )
    273                 $user_id = $bp['loggedin_userid'];
     273                $user_id = $bp->loggedin_user->id;
    274274
    275275        $src = str_replace( array(ABSPATH), array(site_url() . '/'), $new );
    … …  
    477477        global $bp;
    478478        echo '<p><strong>' . $msg . '</strong></p>';
    479         echo '<p><a href="' . $bp['loggedin_domain'] . $bp['profile']['slug'] . '/change-avatar">' . __('Try Again', 'buddypress') . '</a></p>';
     479        echo '<p><a href="' . $bp->loggedin_user->domain . $bp->profile->slug . '/change-avatar">' . __('Try Again', 'buddypress') . '</a></p>';
    480480        echo '</div>';
    481481        exit;
  • trunk/bp-core/bp-core-catchuri.php

    r1017 r1021  
    1515 *
    1616 * The URI's are broken down as follows:
    17  *   - http:// example.com / members / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ...
    18  *   - OUTSIDE ROOT: http:// example.com / sites / buddypress / members / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ...
     17 *   - http:// domain.com / members / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ...
     18 *   - OUTSIDE ROOT: http:// domain.com / sites / buddypress / members / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ...
    1919 *
    2020 *      Example:
    21  *    - http://example.com/members/andy/profile/edit/group/5/
     21 *    - http://domain.com/members/andy/profile/edit/group/5/
    2222 *    - $current_component: string 'profile'
    2323 *    - $current_action: string 'edit'
    … …  
    2828function bp_core_set_uri_globals() {
    2929        global $current_component, $current_action, $action_variables;
    30         global $current_userid;
     30        global $displayed_user_id;
    3131        global $is_member_page, $is_new_friend;
    3232        global $bp_unfiltered_uri;
    … …  
    8585
    8686        /* Catch a member page and set the current member ID */
    87         if ( $bp_uri[0] == MEMBERS_SLUG && $bp_uri[1] != '' ) {
     87        if ( $bp_uri[0] == MEMBERS_SLUG && !empty( $bp_uri[1] ) ) {
    8888                $is_member_page = true;
    8989                $is_root_component = true;
    9090               
    9191                // We are within a member page, set up user id globals
    92                 $current_userid = bp_core_get_current_userid( $bp_uri[1] );
     92                $displayed_user_id = bp_core_get_displayed_userid( $bp_uri[1] );
    9393                               
    9494                unset($bp_uri[0]);
    … …  
    105105                $bp_uri = array_merge( array(), $bp_uri );
    106106        }
    107        
     107
    108108        /* This is used to determine where the component and action indexes should start */
    109         $root_components = $bp['root_components'];
     109        $root_components = $bp->root_components;
    110110       
    111111        if ( !isset($is_root_component) )
    … …  
    160160
    161161        $bp_path = $pages;
    162        
     162
    163163        if ( !bp_is_blog_page() )
    164164                remove_action( 'template_redirect', 'redirect_canonical' );
    … …  
    227227               
    228228        // If this user does not exist, redirect to the root domain.
    229         if ( !$bp['current_userid'] && $bp_unfiltered_uri[0] == MEMBERS_SLUG && isset($bp_unfiltered_uri[1]) )
    230                 bp_core_redirect( $bp['root_domain'] );
     229        if ( !$bp->displayed_user->id && $bp_unfiltered_uri[0] == MEMBERS_SLUG && isset($bp_unfiltered_uri[1]) )
     230                bp_core_redirect( $bp->root_domain );
    231231
    232232        if ( !$bp_path && !bp_is_blog_page() ) {
    233233                if ( is_user_logged_in() ) {
    234                         wp_redirect( $bp['loggedin_domain'] );
     234                        wp_redirect( $bp->loggedin_user->domain );
    235235                } else {
    236236                        wp_redirect( site_url( 'wp-login.php?redirect_to=' . site_url() . $_SERVER['REQUEST_URI'] ) );
    … …  
    264264        $member_theme = get_site_option('active-member-theme');
    265265       
    266         if ( $member_theme == '' )
     266        if ( empty( $member_theme ) )
    267267                $member_theme = 'buddypress-member';
    268268       
    … …  
    283283        $member_theme = get_site_option('active-member-theme');
    284284       
    285         if ( $member_theme == '' )
     285        if ( empty( $member_theme ) )
    286286                $member_theme = 'buddypress-member';
    287287
    … …  
    297297add_filter( 'stylesheet', 'bp_core_force_buddypress_stylesheet', 1, 1 );
    298298
    299 
    300 
    301299?>
  • trunk/bp-core/bp-core-classes.php

    r973 r1021  
    9191                                        $this->total_friends .= ' ' . __( 'friends', 'buddypress' );
    9292                       
    93                                 $this->total_friends = '<a href="' . $this->user_url . $bp['friends']['slug'] . '" title="' . sprintf( __( "%s's friend list", 'buddypress' ), $this->fullname ) . '">' . $this->total_friends . '</a>';
     93                                $this->total_friends = '<a href="' . $this->user_url . $bp->friends->slug . '" title="' . sprintf( __( "%s's friend list", 'buddypress' ), $this->fullname ) . '">' . $this->total_friends . '</a>';
    9494                        }
    9595                }
    … …  
    102102                                        $this->total_blogs .= ' ' . __( 'blogs', 'buddypress' );                       
    103103                               
    104                                 $this->total_blogs = '<a href="' . $this->user_url . $bp['blogs']['slug'] . '" title="' . sprintf( __( "%s's blog list", 'buddypress' ), $this->fullname ) . '">' . $this->total_blogs . '</a>';
     104                                $this->total_blogs = '<a href="' . $this->user_url . $bp->blogs->slug . '" title="' . sprintf( __( "%s's blog list", 'buddypress' ), $this->fullname ) . '">' . $this->total_blogs . '</a>';
    105105                        }
    106106                }
    … …  
    115115                                        $this->total_groups .= ' ' . __( 'groups', 'buddypress' );
    116116
    117                                 $this->total_groups = '<a href="' . $this->user_url . $bp['groups']['slug'] . '" title="' . sprintf( __( "%s's group list", 'buddypress' ), $this->fullname ) . '">' . $this->total_groups . '</a>';
     117                                $this->total_groups = '<a href="' . $this->user_url . $bp->groups->slug . '" title="' . sprintf( __( "%s's group list", 'buddypress' ), $this->fullname ) . '">' . $this->total_groups . '</a>';
    118118                        }
    119119                }
    … …  
    167167                        $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
    168168
    169                 $total_users = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(um.user_id) FROM {$wpdb->base_prefix}usermeta um LEFT JOIN {$wpdb->base_prefix}users u ON u.ID = um.user_id WHERE u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND u.ID != %d ORDER BY RAND() DESC", $bp['loggedin_userid'] ) );
    170                 $paged_users = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT um.user_id FROM {$wpdb->base_prefix}usermeta um LEFT JOIN {$wpdb->base_prefix}users u ON u.ID = um.user_id WHERE u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND u.ID != %d ORDER BY RAND(){$pag_sql}", $bp['loggedin_userid'] ) );
     169                $total_users = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(um.user_id) FROM {$wpdb->base_prefix}usermeta um LEFT JOIN {$wpdb->base_prefix}users u ON u.ID = um.user_id WHERE u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND u.ID != %d ORDER BY RAND() DESC", $bp->loggedin_user->id ) );
     170                $paged_users = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT um.user_id FROM {$wpdb->base_prefix}usermeta um LEFT JOIN {$wpdb->base_prefix}users u ON u.ID = um.user_id WHERE u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND u.ID != %d ORDER BY RAND(){$pag_sql}", $bp->loggedin_user->id ) );
    171171               
    172172                return array( 'users' => $paged_users, 'total' => $total_users );
    … …  
    181181                $total_users = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(um.user_id) FROM {$wpdb->base_prefix}usermeta um LEFT JOIN {$wpdb->base_prefix}users u ON u.ID = um.user_id WHERE um.meta_key = 'last_activity' AND u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND DATE_ADD( FROM_UNIXTIME(um.meta_value), INTERVAL 5 MINUTE ) >= NOW() ORDER BY FROM_UNIXTIME(um.meta_value) DESC" ) );
    182182                $paged_users = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT um.user_id FROM {$wpdb->base_prefix}usermeta um LEFT JOIN {$wpdb->base_prefix}users u ON u.ID = um.user_id WHERE um.meta_key = 'last_activity' AND u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND DATE_ADD( FROM_UNIXTIME(um.meta_value), INTERVAL 5 MINUTE ) >= NOW() ORDER BY FROM_UNIXTIME(um.meta_value) DESC{$pag_sql}" ) );
    183                
     183
    184184                return array( 'users' => $paged_users, 'total' => $total_users );
    185185        }
    … …  
    199199                like_escape($letter);
    200200
    201                 $total_users = count( $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT u.ID user_id FROM {$wpdb->base_prefix}users u LEFT JOIN {$bp['profile']['table_name_data']} pd ON u.ID = pd.user_id LEFT JOIN {$bp['profile']['table_name_fields']} pf ON pd.field_id = pf.id WHERE u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND pf.name = %s AND pd.value LIKE '$letter%%' ORDER BY pd.value ASC", BP_XPROFILE_FULLNAME_FIELD_NAME ) ) );
    202                 $paged_users = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT u.ID as user_id FROM {$wpdb->base_prefix}users u LEFT JOIN {$bp['profile']['table_name_data']} pd ON u.ID = pd.user_id LEFT JOIN {$bp['profile']['table_name_fields']} pf ON pd.field_id = pf.id WHERE u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND pf.name = %s AND pd.value LIKE '$letter%%' ORDER BY pd.value ASC{$pag_sql}", BP_XPROFILE_FULLNAME_FIELD_NAME ) );
     201                $total_users = count( $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT u.ID user_id FROM {$wpdb->base_prefix}users u LEFT JOIN $bp->profile->table_name_data pd ON u.ID = pd.user_id LEFT JOIN $bp->profile->table_name_fields pf ON pd.field_id = pf.id WHERE u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND pf.name = %s AND pd.value LIKE '$letter%%' ORDER BY pd.value ASC", BP_XPROFILE_FULLNAME_FIELD_NAME ) ) );
     202                $paged_users = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT u.ID as user_id FROM {$wpdb->base_prefix}users u LEFT JOIN $bp->profile->table_name_data pd ON u.ID = pd.user_id LEFT JOIN $bp->profile->table_name_fields pf ON pd.field_id = pf.id WHERE u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND pf.name = %s AND pd.value LIKE '$letter%%' ORDER BY pd.value ASC{$pag_sql}", BP_XPROFILE_FULLNAME_FIELD_NAME ) );
    203203               
    204204                return array( 'users' => $paged_users, 'total' => $total_users );
    … …  
    216216                like_escape($search_terms);     
    217217
    218                 $total_users = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(u.ID) as user_id FROM {$wpdb->base_prefix}users u LEFT JOIN {$bp['profile']['table_name_data']} pd ON u.ID = pd.user_id WHERE pd.value LIKE '%%$search_terms%%' ORDER BY pd.value ASC" ) );
    219                 $paged_users = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT u.ID as user_id FROM {$wpdb->base_prefix}users u LEFT JOIN {$bp['profile']['table_name_data']} pd ON u.ID = pd.user_id WHERE pd.value LIKE '%%$search_terms%%' ORDER BY pd.value ASC{$pag_sql}" ) );
     218                $total_users = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(u.ID) as user_id FROM {$wpdb->base_prefix}users u LEFT JOIN $bp->profile->table_name_data pd ON u.ID = pd.user_id WHERE pd.value LIKE '%%$search_terms%%' ORDER BY pd.value ASC" ) );
     219                $paged_users = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT u.ID as user_id FROM {$wpdb->base_prefix}users u LEFT JOIN $bp->profile->table_name_data pd ON u.ID = pd.user_id WHERE pd.value LIKE '%%$search_terms%%' ORDER BY pd.value ASC{$pag_sql}" ) );
    220220               
    221221                return array( 'users' => $paged_users, 'total' => $total_users );
    … …  
    251251                global $wpdb, $bp;
    252252               
    253                 if ( $notification = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $bp['core']['table_name_notifications'] . " WHERE id = %d", $this->id ) ) ) {
     253                if ( $notification = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->core->table_name_notifications} WHERE id = %d", $this->id ) ) ) {
    254254                        $this->item_id = $notification->item_id;
    255255                        $this->secondary_item_id = $notification->secondary_item_id;
    … …  
    267267                if ( $this->id ) {
    268268                        // Update
    269                         $sql = $wpdb->prepare( "UPDATE " . $bp['core']['table_name_notifications'] . " SET item_id = %d, secondary_item_id = %d, user_id = %d, component_name = %s, component_action = %d, date_notified = FROM_UNIXTIME(%d), is_new = %d ) WHERE id = %d", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new, $this->id );
     269                        $sql = $wpdb->prepare( "UPDATE {$bp->core->table_name_notifications} SET item_id = %d, secondary_item_id = %d, user_id = %d, component_name = %s, component_action = %d, date_notified = FROM_UNIXTIME(%d), is_new = %d ) WHERE id = %d", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new, $this->id );
    270270                } else {
    271271                        // Save
    272                         $sql = $wpdb->prepare( "INSERT INTO " . $bp['core']['table_name_notifications'] . " ( item_id, secondary_item_id, user_id, component_name, component_action, date_notified, is_new ) VALUES ( %d, %d, %d, %s, %s, FROM_UNIXTIME(%d), %d )", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new );
     272                        $sql = $wpdb->prepare( "INSERT INTO {$bp->core->table_name_notifications} ( item_id, secondary_item_id, user_id, component_name, component_action, date_notified, is_new ) VALUES ( %d, %d, %d, %s, %s, FROM_UNIXTIME(%d), %d )", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new );
    273273                }
    274274
    … …  
    285285                global $wpdb, $bp;
    286286               
    287                 return $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $bp['core']['table_name_notifications'] . " WHERE id = %d AND user_id = %d", $notification_id, $user_id ) );
     287                return $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->core->table_name_notifications} WHERE id = %d AND user_id = %d", $notification_id, $user_id ) );
    288288        }
    289289       
    290290        function get_all_for_user( $user_id ) {
    291291                global $wpdb, $bp;
    292                
    293                 return $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $bp['core']['table_name_notifications'] . " WHERE user_id = %d AND is_new = 1", $user_id ) );
     292
     293                return $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->core->table_name_notifications} WHERE user_id = %d AND is_new = 1", $user_id ) );
    294294        }
    295295       
    … …  
    297297                global $wpdb, $bp;
    298298               
    299                 return $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['core']['table_name_notifications'] . " WHERE user_id = %d AND component_name = %s AND component_action = %s", $user_id, $component_name, $component_action ) );
     299                return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->core->table_name_notifications} WHERE user_id = %d AND component_name = %s AND component_action = %s", $user_id, $component_name, $component_action ) );
    300300        }
    301301       
    … …  
    306306                        $secondary_item_sql = $wpdb->prepare( " AND secondary_item_id = %d", $secondary_item_id );
    307307               
    308                 return $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['core']['table_name_notifications'] . " WHERE user_id = %d AND item_id = %d AND component_name = %s AND component_action = %s{$secondary_item_sql}", $user_id, $item_id, $component_name, $component_action ) );
     308                return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->core->table_name_notifications} WHERE user_id = %d AND item_id = %d AND component_name = %s AND component_action = %s{$secondary_item_sql}", $user_id, $item_id, $component_name, $component_action ) );
    309309        }
    310310       
  • trunk/bp-core/bp-core-notifications.php

    r813 r1021  
    2525
    2626function bp_core_delete_notification( $id ) {
    27         if ( !bp_core_check_notification_access( $bp['loggedin_userid'], $id ) )
     27        if ( !bp_core_check_notification_access( $bp->loggedin_user->id, $id ) )
    2828                return false;
    2929       
  • trunk/bp-core/bp-core-settings.php

    r959 r1021  
    77        bp_core_add_nav_default( 'settings', 'bp_core_screen_general_settings', 'general', false );
    88       
    9         bp_core_add_subnav_item( 'settings', 'general', __('General', 'buddypress'), $bp['loggedin_domain'] . 'settings/', 'bp_core_screen_general_settings', false, bp_is_home() );
    10         bp_core_add_subnav_item( 'settings', 'notifications', __('Notifications', 'buddypress'), $bp['loggedin_domain'] . 'settings/', 'bp_core_screen_notification_settings', false, bp_is_home() );
    11         bp_core_add_subnav_item( 'settings', 'delete-account', __('Delete Account', 'buddypress'), $bp['loggedin_domain'] . 'settings/', 'bp_core_screen_delete_account', false, bp_is_home() );
     9        bp_core_add_subnav_item( 'settings', 'general', __('General', 'buddypress'), $bp->loggedin_user->domain . 'settings/', 'bp_core_screen_general_settings', false, bp_is_home() );
     10        bp_core_add_subnav_item( 'settings', 'notifications', __('Notifications', 'buddypress'), $bp->loggedin_user->domain . 'settings/', 'bp_core_screen_notification_settings', false, bp_is_home() );
     11        bp_core_add_subnav_item( 'settings', 'delete-account', __('Delete Account', 'buddypress'), $bp->loggedin_user->domain . 'settings/', 'bp_core_screen_delete_account', false, bp_is_home() );
    1212}
    1313add_action( 'wp', 'bp_core_add_settings_nav', 2 );
    … …  
    3737                                $pass_error = true;
    3838                        }
    39                 } else if ( $_POST['pass1'] == '' && $_POST['pass2'] != '' || $_POST['pass1'] != '' && $_POST['pass2'] == '' ) {
     39                } else if ( empty( $_POST['pass1'] ) && !empty( $_POST['pass2'] ) || !empty( $_POST['pass1'] ) && empty( $_POST['pass2'] ) ) {
    4040                        $pass_error = true;
    4141                } else {
    … …  
    7272        <?php } ?>
    7373
    74         <form action="<?php echo $bp['loggedin_domain'] . 'settings/general' ?>" method="post" id="settings-form">
     74        <form action="<?php echo $bp->loggedin_user->domain . 'settings/general' ?>" method="post" id="settings-form">
    7575                <label for="email"><?php _e( 'Account Email', 'buddypress' ) ?></label>
    7676                <input type="text" name="email" id="email" value="<?php echo $current_user->user_email ?>" class="settings-input" />
    … …  
    122122        <?php } ?>
    123123       
    124         <form action="<?php echo $bp['loggedin_domain'] . 'settings/notifications' ?>" method="post" id="settings-form">
     124        <form action="<?php echo $bp->loggedin_user->domain . 'settings/notifications' ?>" method="post" id="settings-form">
    125125                <h3><?php _e( 'Email Notifications', 'buddypress' ) ?></h3>
    126126                <p><?php _e( 'Send a notification by email when:', 'buddypress' ) ?></p>
    … …  
    165165                                $pass_error = true;
    166166                        }
    167                 } else if ( $_POST['pass1'] == '' && $_POST['pass2'] != '' || $_POST['pass1'] != '' && $_POST['pass2'] == '' ) {
     167                } else if ( empty( $_POST['pass1'] ) && !empty( $_POST['pass2'] ) || !empty( $_POST['pass1'] ) && empty( $_POST['pass2'] ) ) {
    168168                        $pass_error = true;
    169169                } else {
    … …  
    188188        global $bp, $current_user, $bp_settings_updated, $pass_error;   ?>
    189189
    190         <form action="<?php echo $bp['loggedin_domain'] . 'settings/delete-account'; ?>" name="account-delete-form" id="account-delete-form" class="standard-form" method="post">
     190        <form action="<?php echo $bp->loggedin_user->domain . 'settings/delete-account'; ?>" name="account-delete-form" id="account-delete-form" class="standard-form" method="post">
    191191               
    192192                <div id="message" class="info">
  • trunk/bp-core/bp-core-templatetags.php

    r958 r1021  
    44 * TEMPLATE TAG
    55 *
    6  * Uses the $bp['bp_nav'] global to render out the navigation within a BuddyPress install.
     6 * Uses the $bp->bp_nav global to render out the navigation within a BuddyPress install.
    77 * Each component adds to this navigation array within its own [component_name]_setup_nav() function.
    88 *
    … …  
    2020       
    2121        /* Sort the nav by key as the array has been put together in different locations */
    22         $bp['bp_nav'] = bp_core_sort_nav_items( $bp['bp_nav'] );
     22        $bp->bp_nav = bp_core_sort_nav_items( $bp->bp_nav );
    2323
    2424        /* Loop through each navigation item */
    25         foreach( (array) $bp['bp_nav'] as $nav_item ) {
     25        foreach( (array) $bp->bp_nav as $nav_item ) {
    2626                /* If the current component matches the nav item id, then add a highlight CSS class. */
    27                 if ( $bp['current_component'] == $nav_item['css_id'] ) {
     27                if ( $bp->current_component == $nav_item['css_id'] ) {
    2828                        $selected = ' class="current"';
    2929                } else {
    … …  
    3131                }
    3232               
    33                 /* If we are viewing another person (current_userid does not equal loggedin_userid)
     33                /* If we are viewing another person (current_userid does not equal loggedin_user->id)
    3434                   then check to see if the two users are friends. if they are, add a highlight CSS class
    3535                   to the friends nav item if it exists. */
    36                 if ( !bp_is_home() && $bp['current_userid'] ) {
     36                if ( !bp_is_home() && $bp->displayed_user->id ) {
    3737                        if ( function_exists('friends_install') ) {
    38                                 if ( friends_check_friendship( $bp['loggedin_userid'], $bp['current_userid'] ) && $nav_item['css_id'] == $bp['friends']['slug'] ) {
     38                                if ( friends_check_friendship( $bp->loggedin_user->id, $bp->displayed_user->id ) && $nav_item['css_id'] == $bp->friends->slug ) {
    3939                                        $selected = ' class="current"';
    4040                                } else {
    … …  
    6060 * TEMPLATE TAG
    6161 *
    62  * Uses the $bp['bp_options_nav'] global to render out the sub navigation for the current component.
     62 * Uses the $bp->bp_options_nav global to render out the sub navigation for the current component.
    6363 * Each component adds to its sub navigation array within its own [component_name]_setup_nav() function.
    6464 *
    … …  
    7878        /* Only render this navigation when the logged in user is looking at one of their own pages. */
    7979        if ( bp_is_home() || $is_single_group ) {
    80                 if ( count( $bp['bp_options_nav'][$bp['current_component']] ) < 1 )
     80                if ( count( $bp->bp_options_nav[$bp->current_component] ) < 1 )
    8181                        return false;
    8282       
    8383                /* Loop through each navigation item */
    84                 foreach ( $bp['bp_options_nav'][$bp['current_component']] as $slug => $values ) {
     84                foreach ( $bp->bp_options_nav[$bp->current_component] as $slug => $values ) {
    8585                        $title = $values['name'];
    8686                        $link = $values['link'];
    … …  
    8888                       
    8989                        /* If the current action or an action variable matches the nav item id, then add a highlight CSS class. */
    90                         if ( $slug == $bp['current_action'] || in_array( $slug, $bp['action_variables'] ) ) {
     90                        if ( $slug == $bp->current_action || in_array( $slug, $bp->action_variables ) ) {
    9191                                $selected = ' class="current"';
    9292                        } else {
    … …  
    9898                }
    9999        } else {
    100                 if ( !$bp['bp_users_nav'] )
     100                if ( !$bp->bp_users_nav )
    101101                        return false;
    102102
    … …  
    109109 * TEMPLATE TAG
    110110 *
    111  * Uses the $bp['bp_users_nav'] global to render out the user navigation when viewing another user other than
     111 * Uses the $bp->bp_users_nav global to render out the user navigation when viewing another user other than
    112112 * yourself.
    113113 *
    … …  
    119119
    120120        /* Sort the nav by key as the array has been put together in different locations */     
    121         $bp['bp_users_nav'] = bp_core_sort_nav_items( $bp['bp_users_nav'] );
    122 
    123         foreach ( $bp['bp_users_nav'] as $user_nav_item ) {     
    124                 if ( $bp['current_component'] == $user_nav_item['css_id'] ) {
     121        $bp->bp_users_nav = bp_core_sort_nav_items( $bp->bp_users_nav );
     122
     123        foreach ( $bp->bp_users_nav as $user_nav_item ) {       
     124                if ( $bp->current_component == $user_nav_item['css_id'] ) {
    125125                        $selected = ' class="current"';
    126126                } else {
    … …  
    145145        global $bp;
    146146       
    147         if ( $bp['bp_options_avatar'] == '' )
     147        if ( empty( $bp->bp_options_avatar ) )
    148148                return false;
    149149       
    … …  
    164164        global $bp;
    165165
    166         echo apply_filters( 'bp_get_options_avatar', $bp['bp_options_avatar'] );
     166        echo apply_filters( 'bp_get_options_avatar', $bp->bp_options_avatar );
    167167}
    168168
    … …  
    170170        global $bp;
    171171       
    172         if ( $bp['bp_options_title'] == '' )
    173                 $bp['bp_options_title'] = __('Options', 'buddypress');
    174        
    175         echo apply_filters( 'bp_get_options_avatar', $bp['bp_options_title'] );
     172        if ( empty( $bp->bp_options_title ) )
     173                $bp->bp_options_title = __( 'Options', 'buddypress' );
     174       
     175        echo apply_filters( 'bp_get_options_avatar', $bp->bp_options_title );
    176176}
    177177
    … …  
    200200       
    201201        if ( $width && $height )
    202                 echo apply_filters( 'bp_loggedinuser_avatar', bp_core_get_avatar( $bp['loggedin_userid'], 2, $width, $height ) );
     202                echo apply_filters( 'bp_loggedinuser_avatar', bp_core_get_avatar( $bp->loggedin_user->id, 2, $width, $height ) );
    203203        else
    204                 echo apply_filters( 'bp_loggedinuser_avatar', bp_core_get_avatar( $bp['loggedin_userid'], 2 ) );
     204                echo apply_filters( 'bp_loggedinuser_avatar', bp_core_get_avatar( $bp->loggedin_user->id, 2 ) );
    205205}
    206206
    … …  
    209209       
    210210        if ( $width && $height )
    211                 echo apply_filters( 'bp_get_options_avatar', bp_core_get_avatar( $bp['loggedin_userid'], 1, $width, $height ) );
     211                echo apply_filters( 'bp_get_options_avatar', bp_core_get_avatar( $bp->loggedin_user->id, 1, $width, $height ) );
    212212        else
    213                 echo apply_filters( 'bp_get_options_avatar', bp_core_get_avatar( $bp['loggedin_userid'], 1 ) );
     213                echo apply_filters( 'bp_get_options_avatar', bp_core_get_avatar( $bp->loggedin_user->id, 1 ) );
    214214}
    215215
    … …  
    219219
    220220function bp_is_home() {
    221         global $bp, $current_blog, $doing_admin_bar;
    222        
    223         if ( is_user_logged_in() && $bp['loggedin_userid'] == $bp['current_userid'] )
     221        global $bp;
     222       
     223        if ( is_user_logged_in() && $bp->loggedin_user->id == $bp->displayed_user->id )
    224224                return true;
    225225               
    … …  
    231231       
    232232        if ( !$user_id )
    233                 $user_id = $bp['current_userid'];
     233                $user_id = $bp->displayed_user->id;
    234234       
    235235        if ( function_exists('xprofile_install') ) {
    236                 // First check the usermeta table for a easily fetchable value
    237                 //$data = get_usermeta( $user_id, 'bp_display_name' );
    238 
    239                 //if ( $data == '' ) {
    240                         $data = bp_get_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $user_id );
    241 
    242                         if ( empty($data) ) {
    243                                 $ud = get_userdata($user_id);
    244                                 $data = $ud->display_name;
    245                         } else {
    246                                 $data = ucfirst($data);
    247                         }
    248                        
    249                         // store this in usermeta for less expensive fetching.
    250                 //      update_usermeta( $user_id, 'bp_display_name', $data );
    251                 //}
     236                $data = bp_get_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $user_id );
     237
     238                if ( empty($data) ) {
     239                        $ud = get_userdata($user_id);
     240                        $data = $ud->display_name;
     241                } else {
     242                        $data = ucfirst($data);
     243                }
    252244        } else {
    253245                $ud = get_userdata($user_id);
    … …  
    265257       
    266258        if ( !$user_id )
    267                 $user_id = $bp['current_userid'];
     259                $user_id = $bp->displayed_user->id;
    268260       
    269261        $last_activity = bp_core_get_last_activity( get_usermeta( $user_id, 'last_activity' ), __('active %s ago', 'buddypress') );
    … …  
    277269function bp_the_avatar() {
    278270        global $bp;
    279         echo apply_filters( 'bp_the_avatar', bp_core_get_avatar( $bp['current_userid'], 2 ) );
     271        echo apply_filters( 'bp_the_avatar', bp_core_get_avatar( $bp->displayed_user->id, 2 ) );
    280272}
    281273
    282274function bp_the_avatar_thumbnail() {
    283275        global $bp;
    284         echo apply_filters( 'bp_the_avatar_thumbnail', bp_core_get_avatar( $bp['current_userid'], 1 ) );
     276        echo apply_filters( 'bp_the_avatar_thumbnail', bp_core_get_avatar( $bp->displayed_user->id, 1 ) );
    285277}
    286278
    … …  
    288280        global $bp;
    289281       
    290         echo apply_filters( 'bp_the_avatar_thumbnail', $bp['current_domain'] );
     282        echo apply_filters( 'bp_the_avatar_thumbnail', $bp->displayed_user->domain );
    291283}
    292284
    … …  
    322314                $youtext = ucfirst($youtext);
    323315       
    324         if ( $bp['current_userid'] == $bp['loggedin_userid'] ) {
     316        if ( $bp->displayed_user->id == $bp->loggedin_user->id ) {
    325317                if ( $echo )
    326318                        echo apply_filters( 'bp_word_or_name', $youtext );
    … …  
    328320                        return apply_filters( 'bp_word_or_name', $youtext );
    329321        } else {
    330                 $nametext = sprintf($nametext, $bp['current_fullname']);
     322                $nametext = sprintf( $nametext, $bp->displayed_user->fullname );
    331323                if ( $echo )
    332324                        echo apply_filters( 'bp_word_or_name', $nametext );
    … …  
    342334                $yourtext = ucfirst($yourtext);
    343335       
    344         if ( $bp['current_userid'] == $bp['loggedin_userid'] ) {
     336        if ( $bp->displayed_user->id == $bp->loggedin_user->id ) {
    345337                if ( $echo )
    346338                        echo apply_filters( 'bp_your_or_their', $yourtext );
    … …  
    358350        global $bp, $current_user;
    359351       
    360         if ( $link = bp_core_get_userlink( $bp['loggedin_userid'] ) ) {
     352        if ( $link = bp_core_get_userlink( $bp->loggedin_user->id ) ) {
    361353                echo apply_filters( 'bp_loggedinuser_link', $link );
    362354        } else {
    363                 $ud = get_userdata($current_user->ID);
     355                $ud = get_userdata($displayed_user->id);
    364356                echo apply_filters( 'bp_loggedinuser_link', $ud->user_login );
    365357        }
    … …  
    374366        global $bp, $is_member_page;
    375367       
    376         if ( $bp['current_component'] == NEWS_SLUG )
    377                 return true;
    378                
    379         if ( !$is_member_page && !in_array( $bp['current_component'], $bp['root_components'] ) )
    380                 return true;
    381        
     368        if ( $bp->current_component == HOME_BLOG_SLUG )
     369                return true;
     370
     371        if ( !$is_member_page && !in_array( $bp->current_component, $bp->root_components ) )
     372                return true;
     373               
    382374        return false;
    383375}
    … …  
    386378        global $bp;
    387379       
    388         if ( $bp['current_fullname'] != '' ) {
    389                 echo apply_filters( 'bp_page_title', strip_tags( $bp['current_fullname'] . ' &raquo; ' . ucwords($bp['current_component']) . ' &raquo; ' . $bp['bp_options_nav'][$bp['current_component']][$bp['current_action']]['name'] ) );
    390         } else {
    391                 echo apply_filters( 'bp_page_title', strip_tags( ucwords($bp['current_component']) . ' &raquo; ' . ucwords($bp['bp_options_title']) . ' &raquo; ' . ucwords($bp['current_action']) ) );
     380        if ( !empty( $bp->displayed_user->fullname ) ) {
     381                echo apply_filters( 'bp_page_title', strip_tags( $bp->displayed_user->fullname . ' &raquo; ' . ucwords( $bp->current_component ) . ' &raquo; ' . $bp->bp_options_nav[$bp->current_component][$bp->current_action]['name'] ) );
     382        } else {
     383                echo apply_filters( 'bp_page_title', strip_tags( ucwords( $bp->current_component ) . ' &raquo; ' . ucwords( $bp->bp_options_title ) . ' &raquo; ' . ucwords( $bp->current_action ) ) );
    392384        }
    393385}
    … …  
    401393        global $bp;
    402394
    403         if ( $bp['current_userid'] )
     395        if ( $bp->displayed_user->id )
    404396                return false;
    405397
    406         if ( $page == $bp['current_component'] || $page == 'home' && $bp['current_component'] == $bp['default_component'] )
     398        if ( $page == $bp->current_component || $page == 'home' && $bp->current_component == $bp->default_component )
    407399                return true;
    408400       
    … …  
    422414        if ( bp_has_custom_signup_page() ) {
    423415                if ( $echo )
    424                         echo $bp['root_domain'] . '/' . REGISTER_SLUG;
    425                 else
    426                         return $bp['root_domain'] . '/' . REGISTER_SLUG;
    427         } else {
    428                 if ( $echo )
    429                         echo $bp['root_domain'] . '/wp-signup.php';
    430                 else
    431                         return $bp['root_domain'] . '/wp-signup.php';
     416                        echo $bp->root_domain . '/' . REGISTER_SLUG;
     417                else
     418                        return $bp->root_domain . '/' . REGISTER_SLUG;
     419        } else {
     420                if ( $echo )
     421                        echo $bp->root_domain . '/wp-signup.php';
     422                else
     423                        return $bp->root_domain . '/wp-signup.php';
    432424        }
    433425}
    … …  
    528520       
    529521        if ( function_exists('friends_install') ) {
    530                 if ( friends_check_friendship( $bp['loggedin_userid'], $bp['current_userid'] ) )
     522                if ( friends_check_friendship( $bp->loggedin_user->id, $bp->displayed_user->id ) )
    531523                        return true;
    532524                else
    … …  
    540532        global $bp;
    541533?>
    542         <li<?php if(bp_is_page('home')) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>" title="<?php _e( 'Home', 'buddypress' ) ?>"><?php _e( 'Home', 'buddypress' ) ?></a></li>
    543         <li<?php if(bp_is_page(HOME_BLOG_SLUG)) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>/<?php echo HOME_BLOG_SLUG ?>" title="<?php _e( 'Blog', 'buddypress' ) ?>"><?php _e( 'Blog', 'buddypress' ) ?></a></li>
    544         <li<?php if(bp_is_page(MEMBERS_SLUG)) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>/<?php echo MEMBERS_SLUG ?>" title="<?php _e( 'Members', 'buddypress' ) ?>"><?php _e( 'Members', 'buddypress' ) ?></a></li>
    545        
    546         <?php if ( function_exists('groups_install') ) { ?>
    547                 <li<?php if(bp_is_page($bp['groups']['slug'])) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>/<?php echo $bp['groups']['slug'] ?>" title="<?php _e( 'Groups', 'buddypress' ) ?>"><?php _e( 'Groups', 'buddypress' ) ?></a></li>
     534        <li<?php if ( bp_is_page( 'home' ) ) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>" title="<?php _e( 'Home', 'buddypress' ) ?>"><?php _e( 'Home', 'buddypress' ) ?></a></li>
     535        <li<?php if ( bp_is_page( HOME_BLOG_SLUG ) ) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>/<?php echo HOME_BLOG_SLUG ?>" title="<?php _e( 'Blog', 'buddypress' ) ?>"><?php _e( 'Blog', 'buddypress' ) ?></a></li>
     536        <li<?php if ( bp_is_page( MEMBERS_SLUG ) ) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>/<?php echo MEMBERS_SLUG ?>" title="<?php _e( 'Members', 'buddypress' ) ?>"><?php _e( 'Members', 'buddypress' ) ?></a></li>
     537       
     538        <?php if ( function_exists( 'groups_install' ) ) { ?>
     539                <li<?php if ( bp_is_page( $bp->groups->slug ) ) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>/<?php echo $bp->groups->slug ?>" title="<?php _e( 'Groups', 'buddypress' ) ?>"><?php _e( 'Groups', 'buddypress' ) ?></a></li>
    548540        <?php } ?>
    549541       
    550         <?php if ( function_exists('bp_blogs_install') ) { ?>
    551                 <li<?php if(bp_is_page($bp['blogs']['slug'])) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>/<?php echo $bp['blogs']['slug'] ?>" title="<?php _e( 'Blogs', 'buddypress' ) ?>"><?php _e( 'Blogs', 'buddypress' ) ?></a></li>
     542        <?php if ( function_exists( 'bp_blogs_install' ) ) { ?>
     543                <li<?php if ( bp_is_page( $bp->blogs->slug ) ) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>/<?php echo $bp->blogs->slug ?>" title="<?php _e( 'Blogs', 'buddypress' ) ?>"><?php _e( 'Blogs', 'buddypress' ) ?></a></li>
    552544        <?php } ?>
    553545<?php
    … …  
    568560function bp_current_user_id() {
    569561        global $bp;
    570         return apply_filters( 'bp_current_user_id', $bp['current_userid'] );
     562        return apply_filters( 'bp_current_user_id', $bp->displayed_user->id );
    571563}
    572564
    573565function bp_user_fullname() {
    574566        global $bp;
    575         echo apply_filters( 'bp_user_fullname', $bp['current_fullname'] );
     567        echo apply_filters( 'bp_user_fullname', $bp->displayed_user->fullname );
    576568}
    577569
  • trunk/bp-core/bp-core-widgets.php

    r946 r1021  
    9494        <?php if ( $users['users'] ) : ?>
    9595                <div class="item-options" id="members-list-options">
    96                         <img id="ajax-loader-members" src="<?php echo $bp['core']['image_base'] ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /> &nbsp;
     96                        <img id="ajax-loader-members" src="<?php echo $bp->core->image_base ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /> &nbsp;
    9797                        <a href="<?php echo site_url() . '/' . MEMBERS_SLUG ?>" id="newest-members" class="selected"><?php _e("Newest", 'buddypress') ?></a> |
    9898                        <a href="<?php echo site_url() . '/' . MEMBERS_SLUG ?>" id="recently-active-members"><?php _e("Active", 'buddypress') ?></a> |
  • trunk/bp-core/directories/bp-core-directory-members.php

    r897 r1021  
    22function bp_core_directory_members_setup() {
    33        global $bp, $current_blog;
    4        
    5         if ( $bp['current_component'] == MEMBERS_SLUG && $bp['current_action'] == '' ) {
     4
     5        if ( $bp->current_component == MEMBERS_SLUG && empty( $bp->current_action ) ) {
    66                add_action( 'bp_template_content', 'bp_core_directory_members_content' );
    77                add_action( 'bp_template_sidebar', 'bp_core_directory_members_sidebar' );
    … …  
    8787                        <div id="member-dir-count" class="pag-count">
    8888                                <?php echo sprintf( __( 'Viewing member %d to %d (%d total active members)', 'buddypress' ), $from_num, $to_num, $users['total'] ); ?> &nbsp;
    89                                 <img id="ajax-loader-members" src="<?php echo $bp['core']['image_base'] ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" />
     89                                <img id="ajax-loader-members" src="<?php echo $bp->core->image_base ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" />
    9090                        </div>
    9191                       
  • trunk/bp-forums.php

    r974 r1021  
    1919        global $bp, $bbpress_live;
    2020
    21         if ( get_usermeta( $bp['loggedin_userid'], 'bb_capabilities' ) == '' )
    22                 bp_forums_make_user_active_member( $bp['loggedin_userid'] );
     21        if ( get_usermeta( $bp->loggedin_user->id, 'bb_capabilities' ) == '' )
     22                bp_forums_make_user_active_member( $bp->loggedin_user->id );
    2323       
    24         $bp['version_numbers']['forums'] = BP_FORUMS_VERSION;
     24        $bp->version_numbers->forums = BP_FORUMS_VERSION;
    2525}
    2626add_action( 'wp', 'bp_forums_setup', 3 );
  • trunk/bp-forums/bp-forums-templatetags.php

    r927 r1021  
    265265        echo apply_filters( 'bp_forum_pagination_count', sprintf( __( 'Viewing topic %d to %d (%d total topics)', 'buddypress' ), $from_num, $to_num, $forum_template->total_topic_count ) );
    266266?>
    267         <img id="ajax-loader-groups" src="<?php echo $bp['core']['image_base'] ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" />
     267        <img id="ajax-loader-groups" src="<?php echo $bp->core->image_base ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" />
    268268<?php
    269269}
    … …  
    371371        global $is_single_group, $group_obj;
    372372       
    373         $topic_id = $bp['action_variables'][1];
     373        $topic_id = $bp->action_variables[1];
    374374
    375375        if ( is_numeric( $topic_id ) )
    … …  
    440440        echo apply_filters( 'bp_the_topic_pagination_count', sprintf( __( 'Viewing post %d to %d (%d total posts)', 'buddypress' ), $from_num, $to_num, $topic_template->total_post_count ) );
    441441?>
    442         <img id="ajax-loader-groups" src="<?php echo $bp['core']['image_base'] ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" />
     442        <img id="ajax-loader-groups" src="<?php echo $bp->core->image_base ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" />
    443443<?php
    444444}
  • trunk/bp-friends.php

    r1017 r1021  
    2929                $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
    3030               
    31         $sql[] = "CREATE TABLE ". $bp['friends']['table_name'] ." (
     31        $sql[] = "CREATE TABLE {$bp->friends->table_name} (
    3232                                id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    3333                                initiator_user_id int(11) NOT NULL,
    … …  
    5757        global $bp, $wpdb;
    5858       
    59         $bp['friends'] = array(
    60                 'table_name' => $wpdb->base_prefix . 'bp_friends',
    61                 'image_base' => site_url( MUPLUGINDIR . '/bp-friends/images' ),
    62                 'format_activity_function' => 'friends_format_activity',
    63                 'slug'           => BP_FRIENDS_SLUG
    64         );
    65 
    66         $bp['version_numbers'][$bp['friends']['slug']] = BP_FRIENDS_VERSION;
     59        $bp->friends->table_name = $wpdb->base_prefix . 'bp_friends';
     60        $bp->friends->image_base = site_url( MUPLUGINDIR . '/bp-friends/images' );
     61        $bp->friends->format_activity_function = 'friends_format_activity';
     62        $bp->friends->slug = BP_FRIENDS_SLUG;
     63
     64        $bp->version_numbers->friends = BP_FRIENDS_VERSION;
    6765}
    6866add_action( 'wp', 'friends_setup_globals', 1 );
    … …  
    7472        if ( is_site_admin() ) {
    7573                /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    76                 if ( ( $wpdb->get_var("SHOW TABLES LIKE '%" . $bp['friends']['table_name'] . "%'") == false ) || ( get_site_option('bp-friends-db-version') < BP_FRIENDS_DB_VERSION )  )
     74                if ( ( $wpdb->get_var( "SHOW TABLES LIKE '%{$bp->friends->table_name}%'") == false ) || ( get_site_option('bp-friends-db-version') < BP_FRIENDS_DB_VERSION )  )
    7775                        friends_install();
    7876        }
    … …  
    9088       
    9189        /* Add 'Friends' to the main navigation */
    92         bp_core_add_nav_item( __('Friends', 'buddypress'), $bp['friends']['slug'] );
    93         bp_core_add_nav_default( $bp['friends']['slug'], 'friends_screen_my_friends', 'my-friends' );
    94        
    95         $friends_link = $bp['loggedin_domain'] . $bp['friends']['slug'] . '/';
     90        bp_core_add_nav_item( __('Friends', 'buddypress'), $bp->friends->slug );
     91        bp_core_add_nav_default( $bp->friends->slug, 'friends_screen_my_friends', 'my-friends' );
     92       
     93        $friends_link = $bp->loggedin_user->domain . $bp->friends->slug . '/';
    9694       
    9795        /* Add the subnav items to the friends nav item */
    98         bp_core_add_subnav_item( $bp['friends']['slug'], 'my-friends', __('My Friends', 'buddypress'), $friends_link, 'friends_screen_my_friends', 'friends-my-friends' );
    99         bp_core_add_subnav_item( $bp['friends']['slug'], 'requests', __('Requests', 'buddypress'), $friends_link, 'friends_screen_requests', false, bp_is_home() );
    100         //bp_core_add_subnav_item( $bp['friends']['slug'], 'invite-friend', __('Invite Friends', 'buddypress'), $friends_link, 'friends_screen_invite_friends' );
    101        
    102         if ( $bp['current_component'] == $bp['friends']['slug'] ) {
     96        bp_core_add_subnav_item( $bp->friends->slug, 'my-friends', __( 'My Friends', 'buddypress' ), $friends_link, 'friends_screen_my_friends', 'friends-my-friends' );
     97        bp_core_add_subnav_item( $bp->friends->slug, 'requests', __( 'Requests', 'buddypress' ), $friends_link, 'friends_screen_requests', false, bp_is_home() );
     98       
     99        if ( $bp->current_component == $bp->friends->slug ) {
    103100                if ( bp_is_home() ) {
    104                         $bp['bp_options_title'] = __('My Friends', 'buddypress');
     101                        $bp->bp_options_title = __( 'My Friends', 'buddypress' );
    105102                } else {
    106                         $bp['bp_options_avatar'] = bp_core_get_avatar( $bp['current_userid'], 1 );
    107                         $bp['bp_options_title'] = $bp['current_fullname'];
     103                        $bp->bp_options_avatar = bp_core_get_avatar( $bp->displayed_user->id, 1 );
     104                        $bp->bp_options_title = $bp->displayed_user->fullname;
    108105                }
    109106        }
    … …  
    118115
    119116        // Delete any friendship acceptance notifications for the user when viewing a profile
    120         bp_core_delete_notifications_for_user_by_type( $bp['loggedin_userid'], 'friends', 'friendship_accepted' );
     117        bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'friends', 'friendship_accepted' );
    121118
    122119        do_action( 'friends_screen_my_friends' );
    … …  
    128125        global $bp;
    129126                       
    130         if ( isset($bp['action_variables']) && $bp['action_variables'][0] == 'accept' && is_numeric($bp['action_variables'][1]) ) {
    131                
    132                 if ( friends_accept_friendship( $bp['action_variables'][1] ) ) {
    133                         bp_core_add_message( __('Friendship accepted', 'buddypress') );
     127        if ( isset($bp->action_variables) && $bp->action_variables[0] == 'accept' && is_numeric($bp->action_variables[1]) ) {
     128               
     129                if ( friends_accept_friendship( $bp->action_variables[1] ) ) {
     130                        bp_core_add_message( __( 'Friendship accepted', 'buddypress' ) );
    134131                } else {
    135                         bp_core_add_message( __('Friendship could not be accepted', 'buddypress'), 'error' );
     132                        bp_core_add_message( __( 'Friendship could not be accepted', 'buddypress' ), 'error' );
    136133                }
    137                 bp_core_redirect( $bp['loggedin_domain'] . $bp['current_component'] . '/' . $bp['current_action'] );
    138                
    139         } else if ( isset($bp['action_variables']) && $bp['action_variables'][0] == 'reject' && is_numeric($bp['action_variables'][1]) ) {
    140                
    141                 if ( friends_reject_friendship( $bp['action_variables'][1] ) ) {
    142                         bp_core_add_message( __('Friendship rejected', 'buddypress') );
     134                bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action );
     135               
     136        } else if ( isset($bp->action_variables) && $bp->action_variables[0] == 'reject' && is_numeric($bp->action_variables[1]) ) {
     137               
     138                if ( friends_reject_friendship( $bp->action_variables[1] ) ) {
     139                        bp_core_add_message( __( 'Friendship rejected', 'buddypress' ) );
    143140                } else {
    144                         bp_core_add_message( __('Friendship could not be rejected', 'buddypress'), 'error' );
     141                        bp_core_add_message( __( 'Friendship could not be rejected', 'buddypress' ), 'error' );
    145142                }       
    146                 bp_core_redirect( $bp['loggedin_domain'] . $bp['current_component'] . '/' . $bp['current_action'] );
     143                bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action );
    147144        }
    148145       
    … …  
    259256                case 'friendship_accepted':
    260257                        if ( (int)$total_items > 1 ) {
    261                                 return apply_filters( 'bp_friends_multiple_friendship_accepted_notification', '<a href="' . $bp['loggedin_domain'] . $bp['friends']['slug'] . '/my-friends/newest" title="' . __( 'My Friends', 'buddypress' ) . '">' . sprintf( __('%d friends accepted your friendship requests'), (int)$total_items ) . '</a>', (int)$total_items );         
     258                                return apply_filters( 'bp_friends_multiple_friendship_accepted_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/my-friends/newest" title="' . __( 'My Friends', 'buddypress' ) . '">' . sprintf( __('%d friends accepted your friendship requests'), (int)$total_items ) . '</a>', (int)$total_items );         
    262259                        } else {
    263260                                $user_fullname = bp_core_global_user_fullname( $item_id );
    … …  
    269266                case 'friendship_request':
    270267                        if ( (int)$total_items > 1 ) {
    271                                 return apply_filters( 'bp_friends_multiple_friendship_request_notification', '<a href="' . $bp['loggedin_domain'] . $bp['friends']['slug'] . '/requests" title="' . __( 'Friendship requests', 'buddypress' ) . '">' . sprintf( __('You have %d pending friendship requests'), (int)$total_items ) . '</a>', $total_items );           
     268                                return apply_filters( 'bp_friends_multiple_friendship_request_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/requests" title="' . __( 'Friendship requests', 'buddypress' ) . '">' . sprintf( __('You have %d pending friendship requests'), (int)$total_items ) . '</a>', $total_items );           
    272269                        } else {
    273270                                $user_fullname = bp_core_global_user_fullname( $item_id );
    274271                                $user_url = bp_core_get_userurl( $item_id );
    275                                 return apply_filters( 'bp_friends_single_friendship_request_notification', '<a href="' . $bp['loggedin_domain'] . $bp['friends']['slug'] . '/requests" title="' . __( 'Friendship requests', 'buddypress' ) . '">' . sprintf( __('You have a friendship request from %s'), $user_fullname ) . '</a>', $user_fullname );
     272                                return apply_filters( 'bp_friends_single_friendship_request_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/requests" title="' . __( 'Friendship requests', 'buddypress' ) . '">' . sprintf( __('You have a friendship request from %s'), $user_fullname ) . '</a>', $user_fullname );
    276273                        }       
    277274                break;
    … …  
    286283        $friend_count = get_usermeta( $user_id, 'total_friend_count');
    287284
    288         if ( $friend_count == '' )
     285        if ( empty( $friend_count ) )
    289286                return false;
    290287       
    … …  
    406403       
    407404        if ( !$user_id )
    408                 $user_id = $bp['loggedin_userid'];
     405                $user_id = $bp->loggedin_user->id;
    409406       
    410407        $friend_ids = friends_get_alphabetically( $user_id );
    … …  
    520517       
    521518        // Remove the activity stream items
    522         friends_delete_activity( array( 'item_id' => $friendship_id, 'component_name' => 'friends', 'component_action' => 'friendship_accepted', 'user_id' => $bp['current_userid'] ) );
     519        friends_delete_activity( array( 'item_id' => $friendship_id, 'component_name' => 'friends', 'component_action' => 'friendship_accepted', 'user_id' => $bp->displayed_user->id ) );
    523520       
    524521        do_action( 'friends_friendship_deleted', $friendship_id, $initiator_userid, $friend_userid );
  • trunk/bp-friends/bp-friends-ajax.php

    r608 r1021  
    1313        global $bp;
    1414
    15         if ( BP_Friends_Friendship::check_is_friend( $bp['loggedin_userid'], $_POST['fid'] ) == 'is_friend' ) {
    16                 if ( !friends_remove_friend( $bp['loggedin_userid'], $_POST['fid'] ) ) {
     15        if ( BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $_POST['fid'] ) == 'is_friend' ) {
     16                if ( !friends_remove_friend( $bp->loggedin_user->id, $_POST['fid'] ) ) {
    1717                        echo __("Friendship could not be canceled.", 'buddypress');
    1818                } else {
    19                         echo '<a id="friend-' . $_POST['fid'] . '" class="add" rel="add" title="' . __( 'Add Friend', 'buddypress' ) . '" href="' . $bp['loggedin_domain'] . $bp['friends']['slug'] . '/add-friend/' . $_POST['fid'] . '">' . __( 'Add Friend', 'buddypress' ) . '</a>';
     19                        echo '<a id="friend-' . $_POST['fid'] . '" class="add" rel="add" title="' . __( 'Add Friend', 'buddypress' ) . '" href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/add-friend/' . $_POST['fid'] . '">' . __( 'Add Friend', 'buddypress' ) . '</a>';
    2020                }
    21         } else if ( BP_Friends_Friendship::check_is_friend( $bp['loggedin_userid'], $_POST['fid'] ) == 'not_friends' ) {
    22                 if ( !friends_add_friend( $bp['loggedin_userid'], $_POST['fid'] ) ) {
     21        } else if ( BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $_POST['fid'] ) == 'not_friends' ) {
     22                if ( !friends_add_friend( $bp->loggedin_user->id, $_POST['fid'] ) ) {
    2323                        echo __("Friendship could not be requested.", 'buddypress');
    2424                } else {
    25                         echo '<a href="' . $bp['loggedin_domain'] . $bp['friends']['slug'] . '" class="requested">' . __( 'Friendship Requested', 'buddypres' ) . '</a>';
    26                         //echo '<a id="friend-' . $_POST['fid'] . '" class="remove" rel="remove" title="' . __( 'Remove Friend', 'buddypress' ) . '" href="' . $bp['loggedin_domain'] . $bp['friends']['slug'] . '/remove-friend/' . $_POST['fid'] . '">' . __( 'Remove Friend', 'buddypress' ) . '</a>';
     25                        echo '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '" class="requested">' . __( 'Friendship Requested', 'buddypres' ) . '</a>';
     26                        //echo '<a id="friend-' . $_POST['fid'] . '" class="remove" rel="remove" title="' . __( 'Remove Friend', 'buddypress' ) . '" href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/remove-friend/' . $_POST['fid'] . '">' . __( 'Remove Friend', 'buddypress' ) . '</a>';
    2727                }
    2828        } else {
  • trunk/bp-friends/bp-friends-classes.php

    r813 r1021  
    2727                global $wpdb, $bp, $creds;
    2828               
    29                 if ( $friendship = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $bp['friends']['table_name'] . " WHERE id = %d", $this->id ) ) ) {
     29                if ( $friendship = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->friends->table_name} WHERE id = %d", $this->id ) ) ) {
    3030                        $this->initiator_user_id = $friendship->initiator_user_id;
    3131                        $this->friend_user_id = $friendship->friend_user_id;
    … …  
    3636               
    3737                // if running from ajax.
    38                 if ( !$bp['current_userid'] )
    39                         $bp['current_userid'] = $creds['current_userid'];
     38                if ( !$bp->displayed_user->id )
     39                        $bp->displayed_user->id = $creds['current_userid'];
    4040               
    4141                if ( $this->populate_friend_details ) {
    42                         if ( $this->friend_user_id == $bp['current_userid'] ) {
     42                        if ( $this->friend_user_id == $bp->displayed_user->id ) {
    4343                                $this->friend = new BP_Core_User( $this->initiator_user_id );
    4444                        } else {
    … …  
    5353                if ( $this->id ) {
    5454                        // Update
    55                         $result = $wpdb->query( $wpdb->prepare( "UPDATE " . $bp['friends']['table_name'] . " SET initiator_user_id = %d, friend_user_id = %d, is_confirmed = %d, is_limited = %d, date_created = FROM_UNIXTIME(%d) ) WHERE id = %d", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created, $this->id ) );
     55                        $result = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET initiator_user_id = %d, friend_user_id = %d, is_confirmed = %d, is_limited = %d, date_created = FROM_UNIXTIME(%d) ) WHERE id = %d", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created, $this->id ) );
    5656                } else {
    5757                        // Save
    58                         $result = $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp['friends']['table_name'] . " ( initiator_user_id, friend_user_id, is_confirmed, is_limited, date_created ) VALUES ( %d, %d, %d, %d, FROM_UNIXTIME(%d) )", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created ) );
     58                        $result = $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->friends->table_name} ( initiator_user_id, friend_user_id, is_confirmed, is_limited, date_created ) VALUES ( %d, %d, %d, %d, FROM_UNIXTIME(%d) )", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created ) );
    5959                        $this->id = $wpdb->insert_id;
    6060                }
    … …  
    6666                global $wpdb, $bp;
    6767               
    68                 return $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['friends']['table_name'] . " WHERE id = %d", $this->id ) );
     68                return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE id = %d", $this->id ) );
    6969        }
    7070       
    … …  
    8282                }
    8383
    84                 $friends = $wpdb->get_results( $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM " . $bp['friends']['table_name'] . " $friend_sql $oc_sql ORDER BY date_created DESC" ) );
     84                $friends = $wpdb->get_results( $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM {$bp->friends->table_name} $friend_sql $oc_sql ORDER BY date_created DESC" ) );
    8585               
    8686                for ( $i = 0; $i < count($friends); $i++ ) {
    … …  
    105105                }
    106106               
    107                 return $wpdb->get_col( $wpdb->prepare( "SELECT id FROM " . $bp['friends']['table_name'] . " $friend_sql $oc_sql" ) );
     107                return $wpdb->get_col( $wpdb->prepare( "SELECT id FROM {$bp->friends->table_name} $friend_sql $oc_sql" ) );
    108108        }
    109109       
    … …  
    111111                global $wpdb, $bp;
    112112               
    113                 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM " . $bp['friends']['table_name'] . " WHERE ( initiator_user_id = %d AND friend_user_id = %d ) OR ( initiator_user_id = %d AND friend_user_id = %d ) AND is_confirmed = 1", $user_id, $friend_id, $friend_id, $user_id ) );
     113                return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->friends->table_name} WHERE ( initiator_user_id = %d AND friend_user_id = %d ) OR ( initiator_user_id = %d AND friend_user_id = %d ) AND is_confirmed = 1", $user_id, $friend_id, $friend_id, $user_id ) );
    114114        }
    115115       
    … …  
    120120                   This function will recalculate, update and return. */
    121121               
    122                 $count = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $bp['friends']['table_name'] . " WHERE (initiator_user_id = %d OR friend_user_id = %d) AND is_confirmed = 1", $user_id, $user_id ) );
     122                $count = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->friends->table_name} WHERE (initiator_user_id = %d OR friend_user_id = %d) AND is_confirmed = 1", $user_id, $user_id ) );
    123123
    124124                if ( !$count )
    … …  
    133133               
    134134                if ( !$user_id )
    135                         $user_id = $bp['loggedin_userid'];
     135                        $user_id = $bp->loggedin_user->id;
    136136               
    137137                like_escape($filter);
    … …  
    149149                // filter the user_ids based on the search criteria.
    150150                if ( function_exists('xprofile_install') ) {
    151                         $sql = $wpdb->prepare( "SELECT DISTINCT user_id FROM " . $bp['profile']['table_name_data'] . " WHERE user_id IN ($fids) AND value LIKE '$filter%%'" );
     151                        $sql = $wpdb->prepare( "SELECT DISTINCT user_id FROM {$bp->profile->table_name_data} WHERE user_id IN ($fids) AND value LIKE '$filter%%'" );
    152152                } else {
    153153                        $sql = $wpdb->prepare( "SELECT DISTINCT user_id FROM $usermeta_table WHERE user_id IN ($fids) AND meta_key = 'nickname' AND meta_value LIKE '$filter%%'" );
    … …  
    160160
    161161                // Get the total number of friendships
    162                 $total_friends = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $bp['friends']['table_name'] . " WHERE (friend_user_id IN ($filtered_fids) AND initiator_user_id = %d) OR (initiator_user_id IN ($filtered_fids) AND friend_user_id = %d)", $user_id, $user_id ) );
     162                $total_friends = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->friends->table_name} WHERE (friend_user_id IN ($filtered_fids) AND initiator_user_id = %d) OR (initiator_user_id IN ($filtered_fids) AND friend_user_id = %d)", $user_id, $user_id ) );
    163163               
    164164                return array( 'friends' => $filtered_friends, 'total' => $total_friends );
    … …  
    171171                        return false;
    172172                       
    173                 $result = $wpdb->get_results( $wpdb->prepare( "SELECT id, is_confirmed FROM " . $bp['friends']['table_name'] . " WHERE (initiator_user_id = %d AND friend_user_id = %d) OR (initiator_user_id = %d AND friend_user_id = %d)", $loggedin_userid, $possible_friend_userid, $possible_friend_userid, $loggedin_userid ) );
     173                $result = $wpdb->get_results( $wpdb->prepare( "SELECT id, is_confirmed FROM {$bp->friends->table_name} WHERE (initiator_user_id = %d AND friend_user_id = %d) OR (initiator_user_id = %d AND friend_user_id = %d)", $loggedin_userid, $possible_friend_userid, $possible_friend_userid, $loggedin_userid ) );
    174174               
    175175                if ( $result ) {
    … …  
    193193                global $wpdb, $bp;
    194194
    195                 return $wpdb->query( $wpdb->prepare( "UPDATE " . $bp['friends']['table_name'] . " SET is_confirmed = 1, date_created = FROM_UNIXTIME(%d) WHERE id = %d AND friend_user_id = %d", time(), $friendship_id, $bp['loggedin_userid'] ) );
     195                return $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET is_confirmed = 1, date_created = FROM_UNIXTIME(%d) WHERE id = %d AND friend_user_id = %d", time(), $friendship_id, $bp->loggedin_user->id ) );
    196196        }
    197197       
    … …  
    199199                global $wpdb, $bp;
    200200               
    201                 return $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['friends']['table_name'] . " WHERE id = %d AND friend_user_id = %d", $friendship_id, $bp['loggedin_userid'] ) );
     201                return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE id = %d AND friend_user_id = %d", $friendship_id, $bp->loggedin_user->id ) );
    202202        }
    203203       
    … …  
    214214                // filter the user_ids based on the search criteria.
    215215                if ( function_exists('xprofile_install') ) {
    216                         $sql = $wpdb->prepare( "SELECT DISTINCT d.user_id as id FROM " . $bp['profile']['table_name_data'] . " d, $users_table u WHERE d.user_id = u.id AND d.value LIKE '$filter%%' ORDER BY d.value DESC $pag_sql" );
     216                        $sql = $wpdb->prepare( "SELECT DISTINCT d.user_id as id FROM {$bp->profile->table_name_data} d, $users_table u WHERE d.user_id = u.id AND d.value LIKE '$filter%%' ORDER BY d.value DESC $pag_sql" );
    217217                } else {
    218218                        $sql = $wpdb->prepare( "SELECT DISTINCT user_id as id FROM $usermeta_table WHERE meta_value LIKE '$filter%%' ORDER BY d.value DESC $pag_sql" );
    … …  
    236236                // filter the user_ids based on the search criteria.
    237237                if ( function_exists('xprofile_install') ) {
    238                         $sql = $wpdb->prepare( "SELECT DISTINCT count(d.user_id) FROM " . $bp['profile']['table_name_data'] . " d, $users_table u WHERE d.user_id = u.id AND d.value LIKE '$filter%%'" );
     238                        $sql = $wpdb->prepare( "SELECT DISTINCT count(d.user_id) FROM {$bp->profile->table_name_data} d, $users_table u WHERE d.user_id = u.id AND d.value LIKE '$filter%%'" );
    239239                } else {
    240240                        $sql = $wpdb->prepare( "SELECT DISTINCT count(user_id) FROM $usermeta_table WHERE meta_value LIKE '$filter%%'" );
    … …  
    255255                        return false;
    256256       
    257                 return $wpdb->get_results( $wpdb->prepare( "SELECT user_id FROM " . $bp['profile']['table_name_data'] . " pd, " . $bp['profile']['table_name_fields'] . " pf WHERE pf.id = pd.field_id AND pf.name = %s AND pd.user_id IN ( {$user_ids} ) ORDER BY pd.value ASC", BP_XPROFILE_FULLNAME_FIELD_NAME ) );
     257                return $wpdb->get_results( $wpdb->prepare( "SELECT user_id FROM {$bp->profile->table_name_data} pd, {$bp->profile->table_name_fields} pf WHERE pf.id = pd.field_id AND pf.name = %s AND pd.user_id IN ( {$user_ids} ) ORDER BY pd.value ASC", BP_XPROFILE_FULLNAME_FIELD_NAME ) );
    258258        }
    259259       
    … …  
    261261                global $wpdb, $bp;
    262262
    263                 $sql = $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM " . $bp['friends']['table_name'] . " WHERE (friend_user_id = %d || initiator_user_id = %d) && is_confirmed = 1 ORDER BY rand() LIMIT %d", $user_id, $user_id, $total_friends );
     263                $sql = $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM {$bp->friends->table_name} WHERE (friend_user_id = %d || initiator_user_id = %d) && is_confirmed = 1 ORDER BY rand() LIMIT %d", $user_id, $user_id, $total_friends );
    264264                $results = $wpdb->get_results($sql);
    265265
    … …  
    298298                global $wpdb, $bp;
    299299
    300                 return $wpdb->get_row( $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM " . $bp['friends']['table_name'] . " WHERE id = %d", $friendship_id ) );
     300                return $wpdb->get_row( $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM {$bp->friends->table_name} WHERE id = %d", $friendship_id ) );
    301301        }
    302302       
    … …  
    304304                global $wpdb, $bp;
    305305
    306                 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['friends']['table_name'] . " WHERE friend_user_id = %d OR initiator_user_id = %d", $user_id, $user_id ) );
     306                $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE friend_user_id = %d OR initiator_user_id = %d", $user_id, $user_id ) );
    307307               
    308308                // Delete friend request notifications for members who have a notification from this user.             
    309                 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['core']['table_name_notifications'] . " WHERE component_name = 'friends' AND ( component_action = 'friendship_request' OR component_action = 'friendship_accepted' ) AND item_id = %d", $user_id ) );
     309                $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->core->table_name_notifications} WHERE component_name = 'friends' AND ( component_action = 'friendship_request' OR component_action = 'friendship_accepted' ) AND item_id = %d", $user_id ) );
    310310        }
    311311}
  • trunk/bp-friends/bp-friends-cssjs.php

    r884 r1021  
    99        global $bp;
    1010
    11         if ( $bp['current_component'] == $bp['friends']['slug'] )
     11        if ( $bp->current_component == $bp->friends->slug )
    1212                wp_enqueue_script( 'bp-friends-js', site_url( MUPLUGINDIR . '/bp-friends/js/general.js' ) );
    1313}
  • trunk/bp-friends/bp-friends-templatetags.php

    r884 r1021  
    2020                $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : 10;
    2121
    22                 if ( $bp['current_action'] == 'my-friends' && $_POST['friend-search-box'] != '' ) {
     22                if ( $bp->current_action == 'my-friends' && $_POST['friend-search-box'] != '' ) {
    2323                       
    2424                        // Search results
    25                         $this->friendships = friends_search_friends( $_POST['friend-search-box'], $bp['current_userid'], $this->pag_num, $this->pag_page );
     25                        $this->friendships = friends_search_friends( $_POST['friend-search-box'], $bp->displayed_user->id, $this->pag_num, $this->pag_page );
    2626                        $this->total_friend_count = (int)$this->friendships['total'];
    2727                        $this->friendships = $this->friendships['friends'];
    2828               
    29                 } else if ( $bp['current_action'] == 'requests' ) {
     29                } else if ( $bp->current_action == 'requests' ) {
    3030               
    3131                        // Friendship Requests
    32                         $this->friendships = friends_get_friendship_requests( $bp['current_userid'] );
     32                        $this->friendships = friends_get_friendship_requests( $bp->displayed_user->id );
    3333                        $this->total_friend_count = $this->friendships['total'];
    3434                        $this->friendships = $this->friendships['requests'];
    3535
    3636                } else {
    37                         $order = $bp['action_variables'][0];
     37                        $order = $bp->action_variables[0];
    3838                       
    3939                        if ( $order == 'newest' ) {
    40                                 $this->friendships = friends_get_newest( $bp['current_userid'], $this->pag_num, $this->pag_page );
     40                                $this->friendships = friends_get_newest( $bp->displayed_user->id, $this->pag_num, $this->pag_page );
    4141                        } else if ( $order == 'alphabetically' ) {
    42                                 $this->friendships = friends_get_alphabetically( $bp['current_userid'], $this->pag_num, $this->pag_page );                             
     42                                $this->friendships = friends_get_alphabetically( $bp->displayed_user->id, $this->pag_num, $this->pag_page );                           
    4343                        } else {
    44                                 $this->friendships = friends_get_recently_active( $bp['current_userid'], $this->pag_num, $this->pag_page );     
     44                                $this->friendships = friends_get_recently_active( $bp->displayed_user->id, $this->pag_num, $this->pag_page );   
    4545                        }
    4646                       
    … …  
    102102                $this->friendship = $this->next_friendship();
    103103               
    104                 if ( $bp['current_action'] == 'requests' ) {
     104                if ( $bp->current_action == 'requests' ) {
    105105                        $this->friendship = new BP_Friends_Friendship( $this->friendship );
    106106                } else {
    … …  
    117117        global $bp, $friends_template;
    118118
    119         $friends_template = new BP_Friendship_Template( $bp['current_userid'] );
     119        $friends_template = new BP_Friendship_Template( $bp->displayed_user->id );
    120120       
    121121        return $friends_template->has_friendships();
    … …  
    248248        global $friends_template, $bp;
    249249       
    250         echo apply_filters( 'bp_friend_accept_request_link', $bp['loggedin_domain'] . $bp['friends']['slug'] . '/requests/accept/' . $friends_template->friendship->id );
     250        echo apply_filters( 'bp_friend_accept_request_link', $bp->loggedin_user->domain . $bp->friends->slug . '/requests/accept/' . $friends_template->friendship->id );
    251251}
    252252
    … …  
    254254        global $friends_template, $bp;
    255255       
    256         echo apply_filters( 'bp_friend_reject_request_link', $bp['loggedin_domain'] . $bp['friends']['slug'] . '/requests/reject/' . $friends_template->friendship->id );       
     256        echo apply_filters( 'bp_friend_reject_request_link', $bp->loggedin_user->domain . $bp->friends->slug . '/requests/reject/' . $friends_template->friendship->id );       
    257257}
    258258
    … …  
    265265        global $friends_template, $bp;
    266266
    267         $action = $bp['current_domain'] . $bp['friends']['slug'] . '/my-friends/search/';
     267        $action = $bp->displayed_user->domain . $bp->friends->slug . '/my-friends/search/';
    268268        $label = __( 'Filter Friends', 'buddypress' );
    269269?>
    270270        <form action="<?php echo $action ?>" id="friend-search-form" method="post">
    271                 <label for="friend-search-box" id="friend-search-label"><?php echo $label ?> <img id="ajax-loader" src="<?php echo $bp['friends']['image_base'] ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /></label>
     271                <label for="friend-search-box" id="friend-search-label"><?php echo $label ?> <img id="ajax-loader" src="<?php echo $bp->friends->image_base ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /></label>
    272272                <input type="search" name="friend-search-box" id="friend-search-box" value="<?php echo $value ?>"<?php echo $disabled ?> />
    273273                <?php if ( function_exists('wp_nonce_field') )
    274274                        wp_nonce_field('friend_search' );
    275275                ?>
    276                 <input type="hidden" name="initiator" id="initiator" value="<?php echo $bp['current_userid'] ?>" />
     276                <input type="hidden" name="initiator" id="initiator" value="<?php echo $bp->displayed_user->id ?>" />
    277277        </form>
    278278<?php
    … …  
    281281function bp_friend_all_friends_link() {
    282282        global $bp;
    283         echo apply_filters( 'bp_friend_all_friends_link', $bp['current_domain'] . 'my-friends/all-friends' );
     283        echo apply_filters( 'bp_friend_all_friends_link', $bp->displayed_user->domain . 'my-friends/all-friends' );
    284284}
    285285
    286286function bp_friend_latest_update_link() {
    287287        global $bp;
    288         echo apply_filters( 'bp_friend_latest_update_link', $bp['current_domain'] . 'my-friends/last-updated' );       
     288        echo apply_filters( 'bp_friend_latest_update_link', $bp->displayed_user->domain . 'my-friends/last-updated' ); 
    289289}
    290290
    291291function bp_friend_recent_activity_link() {
    292292        global $bp;
    293         echo apply_filters( 'bp_friend_recent_activity_link', $bp['current_domain'] . 'my-friends/recently-active' );   
     293        echo apply_filters( 'bp_friend_recent_activity_link', $bp->displayed_user->domain . 'my-friends/recently-active' );     
    294294}
    295295
    296296function bp_friend_recent_status_link() {
    297297        global $bp;
    298         echo apply_filters( 'bp_friend_recent_status_link', $bp['current_domain'] . 'my-friends/status-updates' );     
     298        echo apply_filters( 'bp_friend_recent_status_link', $bp->displayed_user->domain . 'my-friends/status-updates' );       
    299299}
    300300
    … …  
    307307                        $potential_friend_id = $friends_template->friendship->friend->id;
    308308                else if ( !$potential_friend_id && !$friends_template->friendship->friend )
    309                         $potential_friend_id = $bp['current_userid'];
    310 
    311                 if ( $bp['loggedin_userid'] == $potential_friend_id )
     309                        $potential_friend_id = $bp->displayed_user->id;
     310
     311                if ( $bp->loggedin_user->id == $potential_friend_id )
    312312                        return false;
    313313
    314                 $friend_status = BP_Friends_Friendship::check_is_friend( $bp['loggedin_userid'], $potential_friend_id );
     314                $friend_status = BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $potential_friend_id );
    315315
    316316                echo '<div class="friendship-button ' . $friend_status . '" id="friendship-button-' . $potential_friend_id . '">';
    317317                if ( $friend_status == 'pending' ) {
    318                         echo '<a class="requested" href="' . $bp['loggedin_domain'] . $bp['friends']['slug'] . '">' . __( 'Friendship Requested', 'buddypress' ) . '</a>';
     318                        echo '<a class="requested" href="' . $bp->loggedin_user->domain . $bp->friends->slug . '">' . __( 'Friendship Requested', 'buddypress' ) . '</a>';
    319319                } else if ( $friend_status == 'is_friend') {
    320                         echo '<a href="' . $bp['loggedin_domain'] . $bp['friends']['slug'] . '/remove-friend/' . $potential_friend_id . '" title="' . __('Cancel Friendship', 'buddypress') . '" id="friend-' . $potential_friend_id . '" rel="remove" class="remove">' . __('Cancel Friendship', 'buddypress') . '</a>';
     320                        echo '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/remove-friend/' . $potential_friend_id . '" title="' . __('Cancel Friendship', 'buddypress') . '" id="friend-' . $potential_friend_id . '" rel="remove" class="remove">' . __('Cancel Friendship', 'buddypress') . '</a>';
    321321                } else {
    322                         echo '<a href="' . $bp['loggedin_domain'] . $bp['friends']['slug'] . '/add-friend/' . $potential_friend_id . '" title="' . __('Add Friend', 'buddypress') . '" id="friend-' . $potential_friend_id . '" rel="add" class="add">' . __('Add Friend', 'buddypress') . '</a>';
     322                        echo '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/add-friend/' . $potential_friend_id . '" title="' . __('Add Friend', 'buddypress') . '" id="friend-' . $potential_friend_id . '" rel="add" class="add">' . __('Add Friend', 'buddypress') . '</a>';
    323323                }
    324324                echo '</div>';
    … …  
    333333        global $bp, $create_group_step, $completed_to_step;
    334334?>
    335         <li<?php if ( !isset($bp['action_variables'][0]) || $bp['action_variables'][0] == 'recently-active' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['current_domain'] . $bp['friends']['slug'] ?>/my-friends/recently-active"><?php _e( 'Recently Active', 'buddypress' ) ?></a></li>
    336         <li<?php if ( $bp['action_variables'][0] == 'newest' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['current_domain'] . $bp['friends']['slug'] ?>/my-friends/newest"><?php _e( 'Newest', 'buddypress' ) ?></a></li>
    337         <li<?php if ( $bp['action_variables'][0] == 'alphabetically' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['current_domain'] . $bp['friends']['slug'] ?>/my-friends/alphabetically""><?php _e( 'Alphabetically', 'buddypress' ) ?></a></li>
     335        <li<?php if ( !isset($bp->action_variables[0]) || $bp->action_variables[0] == 'recently-active' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->friends->slug ?>/my-friends/recently-active"><?php _e( 'Recently Active', 'buddypress' ) ?></a></li>
     336        <li<?php if ( $bp->action_variables[0] == 'newest' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->friends->slug ?>/my-friends/newest"><?php _e( 'Newest', 'buddypress' ) ?></a></li>
     337        <li<?php if ( $bp->action_variables[0] == 'alphabetically' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->friends->slug ?>/my-friends/alphabetically""><?php _e( 'Alphabetically', 'buddypress' ) ?></a></li>
    338338<?php
    339339        do_action( 'friends_header_tabs' );
    … …  
    343343        global $bp;
    344344       
    345         $current_filter = $bp['action_variables'][0];
     345        $current_filter = $bp->action_variables[0];
    346346       
    347347        switch ( $current_filter ) {
    … …  
    361361        global $bp;
    362362       
    363         $friend_ids = BP_Friends_Friendship::get_random_friends( $bp['current_userid'] );
     363        $friend_ids = BP_Friends_Friendship::get_random_friends( $bp->displayed_user->id );
    364364?>     
    365365        <div class="info-group">
    366                 <h4><?php bp_word_or_name( __( "My Friends", 'buddypress' ), __( "%s's Friends", 'buddypress' ) ) ?>  (<?php echo BP_Friends_Friendship::total_friend_count( $bp['current_userid'] ) ?>)  <a href="<?php echo $bp['current_domain'] . $bp['friends']['slug'] ?>"><?php _e('See All', 'buddypress') ?> &raquo;</a></h4>
     366                <h4><?php bp_word_or_name( __( "My Friends", 'buddypress' ), __( "%s's Friends", 'buddypress' ) ) ?>  (<?php echo BP_Friends_Friendship::total_friend_count( $bp->displayed_user->id ) ?>)  <a href="<?php echo $bp->displayed_user->domain . $bp->friends->slug ?>"><?php _e('See All', 'buddypress') ?> &raquo;</a></h4>
    367367               
    368368                <?php if ( $friend_ids ) { ?>
  • trunk/bp-groups.php

    r1017 r1021  
    3030                $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
    3131       
    32         $sql[] = "CREATE TABLE ". $bp['groups']['table_name'] ." (
     32        $sql[] = "CREATE TABLE {$bp->groups->table_name} (
    3333                        id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    3434                        creator_id int(11) NOT NULL,
    … …  
    5151                   ) {$charset_collate};";
    5252       
    53         $sql[] = "CREATE TABLE ". $bp['groups']['table_name_members'] ." (
     53        $sql[] = "CREATE TABLE {$bp->groups->table_name_members} (
    5454                        id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    5555                        group_id int(11) NOT NULL,
    … …  
    7272                   ) {$charset_collate};";
    7373
    74         $sql[] = "CREATE TABLE ". $bp['groups']['table_name_groupmeta'] ." (
     74        $sql[] = "CREATE TABLE {$bp->groups->table_name_groupmeta} (
    7575                        id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    7676                        group_id int(11) NOT NULL,
    … …  
    9393                $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
    9494       
    95         $sql[] = "CREATE TABLE ". $bp['groups']['table_name_wire'] ." (
     95        $sql[] = "CREATE TABLE {$bp->groups->table_name_wire} (
    9696                        id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    9797                        item_id int(11) NOT NULL,
    … …  
    121121                global $bp;
    122122       
    123         $bp['groups'] = array(
    124                 'table_name' => $wpdb->base_prefix . 'bp_groups',
    125                 'table_name_members' => $wpdb->base_prefix . 'bp_groups_members',
    126                 'table_name_groupmeta' => $wpdb->base_prefix . 'bp_groups_groupmeta',
    127                 'image_base' => site_url( MUPLUGINDIR . '/bp-groups/images' ),
    128                 'format_activity_function' => 'groups_format_activity',
    129                 'slug'           => BP_GROUPS_SLUG
    130         );
    131        
     123        $bp->groups->table_name = $wpdb->base_prefix . 'bp_groups';
     124        $bp->groups->table_name_members = $wpdb->base_prefix . 'bp_groups_members';
     125        $bp->groups->table_name_groupmeta = $wpdb->base_prefix . 'bp_groups_groupmeta';
     126        $bp->groups->image_base = site_url( MUPLUGINDIR . '/bp-groups/images' );
     127        $bp->groups->format_activity_function = 'groups_format_activity';
     128        $bp->groups->slug = BP_GROUPS_SLUG;
     129
    132130        if ( function_exists('bp_wire_install') )
    133                 $bp['groups']['table_name_wire'] = $wpdb->base_prefix . 'bp_groups_wire';
    134        
    135         $bp['groups']['forbidden_names'] = array( 'my-groups', 'group-finder', 'create', 'invites', 'delete', 'add', 'admin', 'request-membership' );
    136         $bp['version_numbers'][$bp['groups']['slug']] = BP_GROUPS_VERSION;
    137 
     131                $bp->groups->table_name_wire = $wpdb->base_prefix . 'bp_groups_wire';
     132       
     133        $bp->groups->forbidden_names = array( 'my-groups', 'group-finder', 'create', 'invites', 'delete', 'add', 'admin', 'request-membership' );
     134        $bp->version_numbers->groups = BP_GROUPS_VERSION;
     135       
    138136        return $bp;
    139137}
    … …  
    152150        if ( is_site_admin() ) {
    153151                /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    154                 if ( ( $wpdb->get_var("SHOW TABLES LIKE '%" . $bp['groups']['table_name'] . "%'") == false ) || ( get_site_option('bp-groups-db-version') < BP_GROUPS_DB_VERSION )  )
     152                if ( ( $wpdb->get_var("SHOW TABLES LIKE '%" . $bp->groups->table_name . "%'") == false ) || ( get_site_option('bp-groups-db-version') < BP_GROUPS_DB_VERSION )  )
    155153                        groups_install();
    156154                       
    157                 if ( ( function_exists('bp_wire_install') && $wpdb->get_var("SHOW TABLES LIKE '%" . $bp['groups']['table_name_wire'] . "%'") == false ) || ( get_site_option('bp-groups-db-version') < BP_GROUPS_DB_VERSION ) )
     155                if ( ( function_exists('bp_wire_install') && $wpdb->get_var("SHOW TABLES LIKE '%" . $bp->groups->table_name_wire . "%'") == false ) || ( get_site_option('bp-groups-db-version') < BP_GROUPS_DB_VERSION ) )
    158156                        groups_wire_install();
    159157        }
    … …  
    182180        global $group_obj, $is_single_group;
    183181       
    184         if ( $group_id = BP_Groups_Group::group_exists($bp['current_action']) ) {
     182        if ( $group_id = BP_Groups_Group::group_exists($bp->current_action) ) {
    185183                /* This is a single group page. */
    186184                $is_single_group = true;
    … …  
    189187                /* Using "item" not "group" for generic support in other components. */
    190188                if ( is_site_admin() )
    191                         $bp['is_item_admin'] = 1;
     189                        $bp->is_item_admin = 1;
    192190                else
    193                         $bp['is_item_admin'] = groups_is_user_admin( $bp['loggedin_userid'], $group_obj->id );
     191                        $bp->is_item_admin = groups_is_user_admin( $bp->loggedin_user->id, $group_obj->id );
    194192               
    195193                /* If the user is not an admin, check if they are a moderator */
    196                 if ( !$bp['is_item_admin'] )
    197                         $bp['is_item_mod'] = groups_is_user_mod( $bp['loggedin_userid'], $group_obj->id );
     194                if ( !$bp->is_item_admin )
     195                        $bp->is_item_mod = groups_is_user_mod( $bp->loggedin_user->id, $group_obj->id );
    198196               
    199197                /* Is the logged in user a member of the group? */
    200                 $is_member = ( groups_is_user_member( $bp['loggedin_userid'], $group_obj->id ) ) ? true : false;
     198                $is_member = ( groups_is_user_member( $bp->loggedin_user->id, $group_obj->id ) ) ? true : false;
    201199       
    202200                /* Should this group be visible to the logged in user? */
    … …  
    205203
    206204        /* Add 'Groups' to the main navigation */
    207         bp_core_add_nav_item( __('Groups', 'buddypress'), $bp['groups']['slug'] );
    208        
    209         if ( $bp['current_userid'] )
    210                 bp_core_add_nav_default( $bp['groups']['slug'], 'groups_screen_my_groups', 'my-groups' );
    211                
    212         $groups_link = $bp['loggedin_domain'] . $bp['groups']['slug'] . '/';
     205        bp_core_add_nav_item( __('Groups', 'buddypress'), $bp->groups->slug );
     206       
     207        if ( $bp->displayed_user->id )
     208                bp_core_add_nav_default( $bp->groups->slug, 'groups_screen_my_groups', 'my-groups' );
     209               
     210        $groups_link = $bp->loggedin_user->domain . $bp->groups->slug . '/';
    213211       
    214212        /* Add the subnav items to the groups nav item */
    215         bp_core_add_subnav_item( $bp['groups']['slug'], 'my-groups', __('My Groups', 'buddypress'), $groups_link, 'groups_screen_my_groups', 'my-groups-list' );
    216         bp_core_add_subnav_item( $bp['groups']['slug'], 'create', __('Create a Group', 'buddypress'), $groups_link, 'groups_screen_create_group', false, bp_is_home() );
    217         bp_core_add_subnav_item( $bp['groups']['slug'], 'invites', __('Invites', 'buddypress'), $groups_link, 'groups_screen_group_invites', false, bp_is_home() );
    218        
    219         if ( $bp['current_component'] == $bp['groups']['slug'] ) {
     213        bp_core_add_subnav_item( $bp->groups->slug, 'my-groups', __('My Groups', 'buddypress'), $groups_link, 'groups_screen_my_groups', 'my-groups-list' );
     214        bp_core_add_subnav_item( $bp->groups->slug, 'create', __('Create a Group', 'buddypress'), $groups_link, 'groups_screen_create_group', false, bp_is_home() );
     215        bp_core_add_subnav_item( $bp->groups->slug, 'invites', __('Invites', 'buddypress'), $groups_link, 'groups_screen_group_invites', false, bp_is_home() );
     216       
     217        if ( $bp->current_component == $bp->groups->slug ) {
    220218               
    221219                if ( bp_is_home() && !$is_single_group ) {
    222220                       
    223                         $bp['bp_options_title'] = __('My Groups', 'buddypress');
     221                        $bp->bp_options_title = __('My Groups', 'buddypress');
    224222                       
    225223                } else if ( !bp_is_home() && !$is_single_group ) {
    226224
    227                         $bp['bp_options_avatar'] = bp_core_get_avatar( $bp['current_userid'], 1 );
    228                         $bp['bp_options_title'] = $bp['current_fullname'];
     225                        $bp->bp_options_avatar = bp_core_get_avatar( $bp->displayed_user->id, 1 );
     226                        $bp->bp_options_title = $bp->displayed_user->fullname;
    229227                       
    230228                } else if ( $is_single_group ) {
    … …  
    234232                        /* When in a single group, the first action is bumped down one because of the
    235233                           group name, so we need to adjust this and set the group name to current_item. */
    236                         $bp['current_item'] = $bp['current_action'];
    237                         $bp['current_action'] = $bp['action_variables'][0];
    238                         array_shift($bp['action_variables']);
     234                        $bp->current_item = $bp->current_action;
     235                        $bp->current_action = $bp->action_variables[0];
     236                        array_shift($bp->action_variables);
    239237                                                                       
    240                         $bp['bp_options_title'] = bp_create_excerpt( $group_obj->name, 1 );
    241                         $bp['bp_options_avatar'] = '<img src="' . $group_obj->avatar_thumb . '" alt="Group Avatar Thumbnail" />';
    242                        
    243                         $group_link = $bp['root_domain'] . '/' . $bp['groups']['slug'] . '/' . $group_obj->slug . '/';
     238                        $bp->bp_options_title = bp_create_excerpt( $group_obj->name, 1 );
     239                        $bp->bp_options_avatar = '<img src="' . $group_obj->avatar_thumb . '" alt="Group Avatar Thumbnail" />';
     240                       
     241                        $group_link = $bp->root_domain . '/' . $bp->groups->slug . '/' . $group_obj->slug . '/';
    244242                       
    245243                        // If this is a private or hidden group, does the user have access?
    246244                        if ( $group_obj->status == 'private' || $group_obj->status == 'hidden' ) {
    247                                 if ( groups_is_user_member( $bp['loggedin_userid'], $group_obj->id ) && is_user_logged_in() )
     245                                if ( groups_is_user_member( $bp->loggedin_user->id, $group_obj->id ) && is_user_logged_in() )
    248246                                        $has_access = true;
    249247                                else
    … …  
    254252
    255253                        // Reset the existing subnav items
    256                         bp_core_reset_subnav_items($bp['groups']['slug']);
    257                        
    258                         bp_core_add_nav_default( $bp['groups']['slug'], 'groups_screen_group_home', 'home' );
    259                         bp_core_add_subnav_item( $bp['groups']['slug'], 'home', __('Home', 'buddypress'), $group_link, 'groups_screen_group_home', 'group-home' );
     254                        bp_core_reset_subnav_items($bp->groups->slug);
     255                       
     256                        bp_core_add_nav_default( $bp->groups->slug, 'groups_screen_group_home', 'home' );
     257                        bp_core_add_subnav_item( $bp->groups->slug, 'home', __('Home', 'buddypress'), $group_link, 'groups_screen_group_home', 'group-home' );
    260258                       
    261259                        // If the user is a group mod or more, then show the group admin nav item */
    262                         if ( $bp['is_item_mod'] || $bp['is_item_admin'] )
    263                                 bp_core_add_subnav_item( $bp['groups']['slug'], 'admin', __('Admin', 'buddypress'), $group_link , 'groups_screen_group_admin', 'group-admin', ( $bp['is_item_admin'] + (int)$bp['is_item_mod'] ) );
     260                        if ( $bp->is_item_mod || $bp->is_item_admin )
     261                                bp_core_add_subnav_item( $bp->groups->slug, 'admin', __('Admin', 'buddypress'), $group_link , 'groups_screen_group_admin', 'group-admin', ( $bp->is_item_admin + (int)$bp->is_item_mod ) );
    264262                       
    265263                        // If this is a private group, and the user is not a member, show a "Request Membership" nav item.
    266                         if ( !$has_access && !groups_check_for_membership_request( $bp['loggedin_userid'], $group_obj->id ) )
    267                                 bp_core_add_subnav_item( $bp['groups']['slug'], 'request-membership', __('Request Membership', 'buddypress'), $group_link , 'groups_screen_group_request_membership', 'request-membership' );
     264                        if ( !$has_access && !groups_check_for_membership_request( $bp->loggedin_user->id, $group_obj->id ) )
     265                                bp_core_add_subnav_item( $bp->groups->slug, 'request-membership', __('Request Membership', 'buddypress'), $group_link , 'groups_screen_group_request_membership', 'request-membership' );
    268266                       
    269267                        if ( $has_access && $group_obj->enable_forum && function_exists('bp_forums_setup') )
    270                                 bp_core_add_subnav_item( $bp['groups']['slug'], 'forum', __('Forum', 'buddypress'), $group_link , 'groups_screen_group_forum', 'group-forum', $is_visible);
     268                                bp_core_add_subnav_item( $bp->groups->slug, 'forum', __('Forum', 'buddypress'), $group_link , 'groups_screen_group_forum', 'group-forum', $is_visible);
    271269
    272270                        if ( $has_access && $group_obj->enable_wire && function_exists('bp_wire_install') )
    273                                 bp_core_add_subnav_item( $bp['groups']['slug'], 'wire', __('Wire', 'buddypress'), $group_link, 'groups_screen_group_wire', 'group-wire', $is_visible );
     271                                bp_core_add_subnav_item( $bp->groups->slug, 'wire', __('Wire', 'buddypress'), $group_link, 'groups_screen_group_wire', 'group-wire', $is_visible );
    274272
    275273                        if ( $has_access && $group_obj->enable_photos && function_exists('bp_gallery_install') )
    276                                 bp_core_add_subnav_item( $bp['groups']['slug'], 'photos', __('Photos', 'buddypress'), $group_link, 'groups_screen_group_photos', 'group-photos', $is_visible );
     274                                bp_core_add_subnav_item( $bp->groups->slug, 'photos', __('Photos', 'buddypress'), $group_link, 'groups_screen_group_photos', 'group-photos', $is_visible );
    277275
    278276                        if ( $has_access )
    279                                 bp_core_add_subnav_item( $bp['groups']['slug'], 'members', __('Members', 'buddypress'), $group_link, 'groups_screen_group_members', 'group-members', $is_visible );
    280                        
    281                         if ( is_user_logged_in() && groups_is_user_member( $bp['loggedin_userid'], $group_obj->id ) ) {
     277                                bp_core_add_subnav_item( $bp->groups->slug, 'members', __('Members', 'buddypress'), $group_link, 'groups_screen_group_members', 'group-members', $is_visible );
     278                       
     279                        if ( is_user_logged_in() && groups_is_user_member( $bp->loggedin_user->id, $group_obj->id ) ) {
    282280                                if ( function_exists('friends_install') )
    283                                         bp_core_add_subnav_item( $bp['groups']['slug'], 'send-invites', __('Send Invites', 'buddypress'), $group_link, 'groups_screen_group_invite', 'group-invite', $is_member );
     281                                        bp_core_add_subnav_item( $bp->groups->slug, 'send-invites', __('Send Invites', 'buddypress'), $group_link, 'groups_screen_group_invite', 'group-invite', $is_member );
    284282                               
    285                                 bp_core_add_subnav_item( $bp['groups']['slug'], 'leave-group', __('Leave Group', 'buddypress'), $group_link, 'groups_screen_group_leave', 'group-leave', $is_member );
     283                                bp_core_add_subnav_item( $bp->groups->slug, 'leave-group', __('Leave Group', 'buddypress'), $group_link, 'groups_screen_group_leave', 'group-leave', $is_member );
    286284                        }
    287285                }
    … …  
    297295        global $bp;
    298296       
    299         bp_core_delete_notifications_for_user_by_type( $bp['loggedin_userid'], 'groups', 'member_promoted_to_mod' );
    300         bp_core_delete_notifications_for_user_by_type( $bp['loggedin_userid'], 'groups', 'member_promoted_to_admin' );
     297        bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'member_promoted_to_mod' );
     298        bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'member_promoted_to_admin' );
    301299
    302300        do_action( 'groups_screen_my_groups' );
    … …  
    308306        global $bp;
    309307       
    310         $group_id = $bp['action_variables'][1];
    311        
    312         if ( isset($bp['action_variables']) && in_array( 'accept', $bp['action_variables'] ) && is_numeric($group_id) ) {
    313                
    314                 if ( !groups_accept_invite( $bp['loggedin_userid'], $group_id ) ) {
     308        $group_id = $bp->action_variables[1];
     309       
     310        if ( isset($bp->action_variables) && in_array( 'accept', $bp->action_variables ) && is_numeric($group_id) ) {
     311               
     312                if ( !groups_accept_invite( $bp->loggedin_user->id, $group_id ) ) {
    315313                        bp_core_add_message( __('Group invite could not be accepted', 'buddypress'), 'error' );                         
    316314                } else {
    … …  
    321319                }
    322320
    323                 bp_core_redirect( $bp['loggedin_domain'] . $bp['current_component'] . '/' . $bp['current_action'] );
    324                
    325         } else if ( isset($bp['action_variables']) && in_array( 'reject', $bp['action_variables'] ) && is_numeric($group_id) ) {
    326                
    327                 if ( !groups_reject_invite( $group_id, $bp['loggedin_userid'] ) ) {
     321                bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action );
     322               
     323        } else if ( isset($bp->action_variables) && in_array( 'reject', $bp->action_variables ) && is_numeric($group_id) ) {
     324               
     325                if ( !groups_reject_invite( $group_id, $bp->loggedin_user->id ) ) {
    328326                        bp_core_add_message( __('Group invite could not be rejected', 'buddypress'), 'error' );                                                 
    329327                } else {                       
    … …  
    331329                }
    332330
    333                 bp_core_redirect( $bp['loggedin_domain'] . $bp['current_component'] . '/' . $bp['current_action'] );
     331                bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action );
    334332        }
    335333       
    336334        // Remove notifications
    337         bp_core_delete_notifications_for_user_by_type( $bp['loggedin_userid'], 'groups', 'group_invite' );
     335        bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'group_invite' );
    338336
    339337        do_action( 'groups_screen_group_invites', $group_id );
    … …  
    349347        $reset_steps = false;
    350348       
    351         if ( !$create_group_step = $bp['action_variables'][1] ) {
     349        if ( !$create_group_step = $bp->action_variables[1] ) {
    352350                $create_group_step = '1';
    353351                $completed_to_step = 0;
    … …  
    380378                        if ( !$group_id = groups_create_group( $create_group_step, $_SESSION['group_obj_id'] ) ) {
    381379                                bp_core_add_message( __('There was an error saving group details. Please try again.', 'buddypress'), 'error' );
    382                                 bp_core_redirect( $bp['loggedin_domain'] . $bp['groups']['slug'] . '/create/step/' . $create_group_step );
     380                                bp_core_redirect( $bp->loggedin_user->domain . $bp->groups->slug . '/create/step/' . $create_group_step );
    383381                        } else {
    384382                                $create_group_step++;
    … …  
    403401                if ( isset($_GET['new']) ) {
    404402                        // Delete group request notifications for the user
    405                         bp_core_delete_notifications_for_user_by_type( $bp['loggedin_userid'], 'groups', 'membership_request_accepted' );
    406                         bp_core_delete_notifications_for_user_by_type( $bp['loggedin_userid'], 'groups', 'membership_request_rejected' );
    407                         bp_core_delete_notifications_for_user_by_type( $bp['loggedin_userid'], 'groups', 'member_promoted_to_mod' );
    408                         bp_core_delete_notifications_for_user_by_type( $bp['loggedin_userid'], 'groups', 'member_promoted_to_admin' );
     403                        bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'membership_request_accepted' );
     404                        bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'membership_request_rejected' );
     405                        bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'member_promoted_to_mod' );
     406                        bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'member_promoted_to_admin' );
    409407                }       
    410408
    … …  
    419417       
    420418        if ( $is_single_group ) {
    421                 $topic_id = $bp['action_variables'][1];
     419                $topic_id = $bp->action_variables[1];
    422420                $forum_id = groups_get_groupmeta( $group_obj->id, 'forum_id' );
    423421               
    … …  
    454452        global $is_single_group, $group_obj;
    455453       
    456         $wire_action = $bp['action_variables'][0];
     454        $wire_action = $bp->action_variables[0];
    457455               
    458456        if ( $is_single_group ) {
    459                 if ( $wire_action == 'post' && BP_Groups_Member::check_is_member( $bp['loggedin_userid'], $group_obj->id ) ) {
     457                if ( $wire_action == 'post' && BP_Groups_Member::check_is_member( $bp->loggedin_user->id, $group_obj->id ) ) {
    460458
    461459                        if ( !groups_new_wire_post( $group_obj->id, $_POST['wire-post-textarea'] ) ) {
    … …  
    465463                        }
    466464
    467                         if ( !strpos( $_SERVER['HTTP_REFERER'], $bp['wire']['slug'] ) ) {
     465                        if ( !strpos( $_SERVER['HTTP_REFERER'], $bp->wire->slug ) ) {
    468466                                bp_core_redirect( bp_group_permalink( $group_obj, false ) );
    469467                        } else {
    470                                 bp_core_redirect( bp_group_permalink( $group_obj, false ) . '/' . $bp['wire']['slug'] );
    471                         }
    472        
    473                 } else if ( $wire_action == 'delete' && BP_Groups_Member::check_is_member( $bp['loggedin_userid'], $group_obj->id ) ) {
    474                         $wire_message_id = $bp['action_variables'][1];
    475 
    476                         if ( !groups_delete_wire_post( $wire_message_id, $bp['groups']['table_name_wire'] ) ) {
     468                                bp_core_redirect( bp_group_permalink( $group_obj, false ) . '/' . $bp->wire->slug );
     469                        }
     470       
     471                } else if ( $wire_action == 'delete' && BP_Groups_Member::check_is_member( $bp->loggedin_user->id, $group_obj->id ) ) {
     472                        $wire_message_id = $bp->action_variables[1];
     473
     474                        if ( !groups_delete_wire_post( $wire_message_id, $bp->groups->table_name_wire ) ) {
    477475                                bp_core_add_message( __('There was an error deleting the wire message.', 'buddypress'), 'error' );
    478476                        } else {
    … …  
    480478                        }
    481479                       
    482                         if ( !strpos( $_SERVER['HTTP_REFERER'], $bp['wire']['slug'] ) ) {
     480                        if ( !strpos( $_SERVER['HTTP_REFERER'], $bp->wire->slug ) ) {
    483481                                bp_core_redirect( bp_group_permalink( $group_obj, false ) );
    484482                        } else {
    485                                 bp_core_redirect( bp_group_permalink( $group_obj, false ) . '/' . $bp['wire']['slug'] );
    486                         }
    487                
    488                 } else if ( ( !$wire_action || $bp['action_variables'][1] == 'latest' ) ) {
     483                                bp_core_redirect( bp_group_permalink( $group_obj, false ) . '/' . $bp->wire->slug );
     484                        }
     485               
     486                } else if ( ( !$wire_action || $bp->action_variables[1] == 'latest' ) ) {
    489487                        bp_core_load_template( 'groups/wire' );
    490488                } else {
    … …  
    520518       
    521519        if ( $is_single_group ) {
    522                 if ( isset($bp['action_variables']) && $bp['action_variables'][0] == 'send' ) {
     520                if ( isset($bp->action_variables) && $bp->action_variables[0] == 'send' ) {
    523521                        // Send the invites.
    524522                        groups_send_invites($group_obj);
    … …  
    540538       
    541539        if ( $is_single_group ) {
    542                 if ( isset($bp['action_variables']) && $bp['action_variables'][0] == 'yes' ) {
     540                if ( isset($bp->action_variables) && $bp->action_variables[0] == 'yes' ) {
    543541                       
    544542                        // Check if the user is the group admin first.
    545                         if ( groups_is_group_admin( $bp['loggedin_userid'], $group_obj->id ) ) {
     543                        if ( groups_is_group_admin( $bp->loggedin_user->id, $group_obj->id ) ) {
    546544                                bp_core_add_message(  __('As the only group administrator, you cannot leave this group.', 'buddypress'), 'error' );
    547545                                bp_core_redirect( bp_group_permalink( $group_obj, false) );
    … …  
    554552                        } else {
    555553                                bp_core_add_message( __('You left the group successfully.', 'buddypress') );
    556                                 bp_core_redirect( $bp['loggedin_domain'] . $bp['groups']['slug'] );
    557                         }
    558                        
    559                 } else if ( isset($bp['action_variables']) && $bp['action_variables'][0] == 'no' ) {
     554                                bp_core_redirect( $bp->loggedin_user->domain . $bp->groups->slug );
     555                        }
     556                       
     557                } else if ( isset($bp->action_variables) && $bp->action_variables[0] == 'no' ) {
    560558                       
    561559                        bp_core_redirect( bp_group_permalink( $group_obj, false) );
    … …  
    581579                // If the user has submitted a request, send it.
    582580                if ( isset( $_POST['group-request-send']) ) {
    583                         if ( !groups_send_membership_request( $bp['loggedin_userid'], $group_obj->id ) ) {
     581                        if ( !groups_send_membership_request( $bp->loggedin_user->id, $group_obj->id ) ) {
    584582                                bp_core_add_message( __( 'There was an error sending your group membership request, please try again.', 'buddypress' ), 'error' );
    585583                        } else {
    … …  
    598596        global $bp, $group_obj;
    599597       
    600         if ( $bp['current_component'] == $bp['groups']['slug'] && !$bp['action_variables'] ) {
     598        if ( $bp->current_component == $bp->groups->slug && !$bp->action_variables ) {
    601599               
    602600                do_action( 'groups_screen_group_admin', $group_obj->id );
    … …  
    610608        global $bp, $group_obj;
    611609       
    612         if ( $bp['current_component'] == $bp['groups']['slug'] && $bp['action_variables'][0] == 'edit-details' ) {
    613        
    614                 if ( $bp['is_item_admin'] || $bp['is_item_mod']  ) {
     610        if ( $bp->current_component == $bp->groups->slug && $bp->action_variables[0] == 'edit-details' ) {
     611       
     612                if ( $bp->is_item_admin || $bp->is_item_mod  ) {
    615613               
    616614                        // If the edit form has been submitted, save the edited details
    … …  
    624622                                do_action( 'groups_group_details_edited', $group_obj->id );
    625623                               
    626                                 bp_core_redirect( site_url() . '/' . $bp['current_component'] . '/' . $bp['current_item'] . '/admin/edit-details' );
     624                                bp_core_redirect( site_url() . '/' . $bp->current_component . '/' . $bp->current_item . '/admin/edit-details' );
    627625                        }
    628626
    … …  
    640638        global $bp, $group_obj;
    641639       
    642         if ( $bp['current_component'] == $bp['groups']['slug'] && $bp['action_variables'][0] == 'group-settings' ) {
    643                
    644                 if ( !$bp['is_item_admin'] )
     640        if ( $bp->current_component == $bp->groups->slug && $bp->action_variables[0] == 'group-settings' ) {
     641               
     642                if ( !$bp->is_item_admin )
    645643                        return false;
    646644               
    … …  
    661659                        do_action( 'groups_group_settings_edited', $group_obj->id );
    662660                       
    663                         bp_core_redirect( site_url() . '/' . $bp['current_component'] . '/' . $bp['current_item'] . '/admin/group-settings' );
     661                        bp_core_redirect( site_url() . '/' . $bp->current_component . '/' . $bp->current_item . '/admin/group-settings' );
    664662                }
    665663
    … …  
    674672        global $bp, $group_obj;
    675673       
    676         if ( $bp['current_component'] == $bp['groups']['slug'] && $bp['action_variables'][0] == 'group-avatar' ) {
    677                
    678                 if ( !$bp['is_item_admin'] )
     674        if ( $bp->current_component == $bp->groups->slug && $bp->action_variables[0] == 'group-avatar' ) {
     675               
     676                if ( !$bp->is_item_admin )
    679677                        return false;
    680678               
    … …  
    706704                        do_action( 'groups_group_avatar_edited', $group_obj->id );
    707705
    708                         bp_core_redirect( site_url() . '/' . $bp['current_component'] . '/' . $bp['current_item'] . '/admin/group-avatar' );
     706                        bp_core_redirect( site_url() . '/' . $bp->current_component . '/' . $bp->current_item . '/admin/group-avatar' );
    709707                }
    710708               
    … …  
    719717        global $bp, $group_obj;
    720718
    721         if ( $bp['current_component'] == $bp['groups']['slug'] && $bp['action_variables'][0] == 'manage-members' ) {
    722                
    723                 if ( !$bp['is_item_admin'] )
     719        if ( $bp->current_component == $bp->groups->slug && $bp->action_variables[0] == 'manage-members' ) {
     720               
     721                if ( !$bp->is_item_admin )
    724722                        return false;
    725723               
    726                 if ( $bp['action_variables'][1] == 'promote' && is_numeric( $bp['action_variables'][2] ) ) {
    727                         $user_id = $bp['action_variables'][2];
     724                if ( $bp->action_variables[1] == 'promote' && is_numeric( $bp->action_variables[2] ) ) {
     725                        $user_id = $bp->action_variables[2];
    728726                       
    729727                        // Promote a user.
    … …  
    736734                        do_action( 'groups_promoted_member', $user_id, $group_obj->id );
    737735                       
    738                         bp_core_redirect( site_url() . '/' . $bp['current_component'] . '/' . $bp['current_item'] . '/admin/manage-members' );
    739                 }
    740                
    741                 if ( $bp['action_variables'][1] == 'demote' && is_numeric( $bp['action_variables'][2] ) ) {
    742                         $user_id = $bp['action_variables'][2];
     736                        bp_core_redirect( site_url() . '/' . $bp->current_component . '/' . $bp->current_item . '/admin/manage-members' );
     737                }
     738               
     739                if ( $bp->action_variables[1] == 'demote' && is_numeric( $bp->action_variables[2] ) ) {
     740                        $user_id = $bp->action_variables[2];
    743741                       
    744742                        // Demote a user.
    … …  
    751749                        do_action( 'groups_demoted_member', $user_id, $group_obj->id );
    752750                       
    753                         bp_core_redirect( site_url() . '/' . $bp['current_component'] . '/' . $bp['current_item'] . '/admin/manage-members' );
    754                 }
    755                
    756                 if ( $bp['action_variables'][1] == 'ban' && is_numeric( $bp['action_variables'][2] ) ) {
    757                         $user_id = $bp['action_variables'][2];
     751                        bp_core_redirect( site_url() . '/' . $bp->current_component . '/' . $bp->current_item . '/admin/manage-members' );
     752                }
     753               
     754                if ( $bp->action_variables[1] == 'ban' && is_numeric( $bp->action_variables[2] ) ) {
     755                        $user_id = $bp->action_variables[2];
    758756                       
    759757                        // Ban a user.
    … …  
    766764                        do_action( 'groups_banned_member', $user_id, $group_obj->id );
    767765                       
    768                         bp_core_redirect( site_url() . '/' . $bp['current_component'] . '/' . $bp['current_item'] . '/admin/manage-members' );
    769                 }
    770                
    771                 if ( $bp['action_variables'][1] == 'unban' && is_numeric( $bp['action_variables'][2] ) ) {
    772                         $user_id = $bp['action_variables'][2];
     766                        bp_core_redirect( site_url() . '/' . $bp->current_component . '/' . $bp->current_item . '/admin/manage-members' );
     767                }
     768               
     769                if ( $bp->action_variables[1] == 'unban' && is_numeric( $bp->action_variables[2] ) ) {
     770                        $user_id = $bp->action_variables[2];
    773771                       
    774772                        // Remove a ban for user.
    … …  
    781779                        do_action( 'groups_unbanned_member', $user_id, $group_obj->id );
    782780                       
    783                         bp_core_redirect( site_url() . '/' . $bp['current_component'] . '/' . $bp['current_item'] . '/admin/manage-members' );
     781                        bp_core_redirect( site_url() . '/' . $bp->current_component . '/' . $bp->current_item . '/admin/manage-members' );
    784782                }
    785783
    … …  
    795793        global $bp, $group_obj;
    796794       
    797         if ( $bp['current_component'] == $bp['groups']['slug'] && $bp['action_variables'][0] == 'membership-requests' ) {
    798                
    799                 if ( !$bp['is_item_admin'] || $group_obj->status == 'public' )
     795        if ( $bp->current_component == $bp->groups->slug && $bp->action_variables[0] == 'membership-requests' ) {
     796               
     797                if ( !$bp->is_item_admin || $group_obj->status == 'public' )
    800798                        return false;
    801799               
    802800                // Remove any screen notifications
    803                 bp_core_delete_notifications_for_user_by_type( $bp['loggedin_userid'], 'groups', 'new_membership_request' );
    804                
    805                 $request_action = $bp['action_variables'][1];
    806                 $membership_id = $bp['action_variables'][2];
     801                bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'new_membership_request' );
     802               
     803                $request_action = $bp->action_variables[1];
     804                $membership_id = $bp->action_variables[2];
    807805
    808806                if ( isset($request_action) && isset($membership_id) ) {
    … …  
    829827                        do_action( 'groups_group_request_managed', $group_obj->id, $request_action, $membership_id );
    830828                       
    831                         bp_core_redirect( site_url() . '/' . $bp['current_component'] . '/' . $bp['current_item'] . '/admin/membership-requests' );
     829                        bp_core_redirect( site_url() . '/' . $bp->current_component . '/' . $bp->current_item . '/admin/membership-requests' );
    832830                }
    833831
    … …  
    842840        global $bp, $group_obj;
    843841       
    844         if ( $bp['current_component'] == $bp['groups']['slug'] && $bp['action_variables'][0] == 'delete-group' ) {
    845                
    846                 if ( !$bp['is_item_admin'] )
     842        if ( $bp->current_component == $bp->groups->slug && $bp->action_variables[0] == 'delete-group' ) {
     843               
     844                if ( !$bp->is_item_admin )
    847845                        return false;
    848846               
    … …  
    853851                        } else {
    854852                                bp_core_add_message( __( 'The group was deleted successfully', 'buddypress' ) );
    855                                 bp_core_redirect( site_url() . '/' . $bp['groups']['slug'] . '/' );
     853                                bp_core_redirect( site_url() . '/' . $bp->groups->slug . '/' );
    856854                        }
    857855
    858856                        do_action( 'groups_group_deleted', $_POST['group-id'] );
    859857
    860                         bp_core_redirect( $bp['loggedin_domain'] . $bp['current_component'] );
     858                        bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component );
    861859                } else {
    862860                        do_action( 'groups_screen_group_admin_delete_group', $group_obj->id );
    … …  
    923921        global $is_single_group, $group_obj;   
    924922
    925         if ( !$is_single_group || $bp['current_component'] != $bp['groups']['slug'] || $bp['current_action'] != 'join' )
     923        if ( !$is_single_group || $bp->current_component != $bp->groups->slug || $bp->current_action != 'join' )
    926924                return false;
    927925               
    928926        // user wants to join a group
    929         if ( !groups_is_user_member( $bp['loggedin_userid'], $group_obj->id ) && !groups_is_user_banned( $bp['loggedin_userid'], $group_obj->id ) ) {
     927        if ( !groups_is_user_member( $bp->loggedin_user->id, $group_obj->id ) && !groups_is_user_banned( $bp->loggedin_user->id, $group_obj->id ) ) {
    930928                if ( !groups_join_group($group_obj->id) ) {
    931929                        bp_core_add_message( __('There was an error joining the group.', 'buddypress'), 'error' );
    … …  
    10081006                break;
    10091007                case 'new_wire_post':
    1010                         $wire_post = new BP_Wire_Post( $bp['groups']['table_name_wire'], $item_id );
     1008                        $wire_post = new BP_Wire_Post( $bp->groups->table_name_wire, $item_id );
    10111009                        $group = new BP_Groups_Group( $wire_post->item_id );
    10121010
    … …  
    11121110                       
    11131111                        if ( (int)$total_items > 1 ) {
    1114                                 return apply_filters( 'bp_groups_multiple_membership_request_accepted_notification', '<a href="' . $bp['loggedin_domain'] . $bp['groups']['slug'] . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('%d accepted group membership requests'), (int)$total_items, $group->name ) . '</a>', $total_items, $group_name );         
     1112                                return apply_filters( 'bp_groups_multiple_membership_request_accepted_notification', '<a href="' . $bp->loggedin_user->domain . $bp->groups->slug . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('%d accepted group membership requests'), (int)$total_items, $group->name ) . '</a>', $total_items, $group_name );         
    11151113                        } else {
    11161114                                return apply_filters( 'bp_groups_single_membership_request_accepted_notification', '<a href="' . $group_link . '">' . sprintf( __('Membership for group "%s" accepted'), $group->name ) . '</a>', $group_link, $group->name );
    … …  
    11251123                       
    11261124                        if ( (int)$total_items > 1 ) {
    1127                                 return apply_filters( 'bp_groups_multiple_membership_request_rejected_notification', '<a href="' . site_url() . '/' . MEMBERS_SLUG . '/' . $bp['groups']['slug'] . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('%d rejected group membership requests'), (int)$total_items, $group->name ) . '</a>', $total_items, $group->name );         
     1125                                return apply_filters( 'bp_groups_multiple_membership_request_rejected_notification', '<a href="' . site_url() . '/' . MEMBERS_SLUG . '/' . $bp->groups->slug . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('%d rejected group membership requests'), (int)$total_items, $group->name ) . '</a>', $total_items, $group->name );             
    11281126                        } else {
    11291127                                return apply_filters( 'bp_groups_single_membership_request_rejected_notification', '<a href="' . $group_link . '">' . sprintf( __('Membership for group "%s" rejected'), $group->name ) . '</a>', $group_link, $group->name );
    … …  
    11391137                       
    11401138                        if ( (int)$total_items > 1 ) {
    1141                                 return apply_filters( 'bp_groups_multiple_member_promoted_to_admin_notification', '<a href="' . $bp['loggedin_domain'] . $bp['groups']['slug'] . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('You were promoted to an admin in %d groups'), (int)$total_items ) . '</a>', $total_items );           
     1139                                return apply_filters( 'bp_groups_multiple_member_promoted_to_admin_notification', '<a href="' . $bp->loggedin_user->domain . $bp->groups->slug . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('You were promoted to an admin in %d groups'), (int)$total_items ) . '</a>', $total_items );           
    11421140                        } else {
    11431141                                return apply_filters( 'bp_groups_single_member_promoted_to_admin_notification', '<a href="' . $group_link . '">' . sprintf( __('You were promoted to an admin in the group %s'), $group->name ) . '</a>', $group_link, $group->name );
    … …  
    11521150                       
    11531151                        if ( (int)$total_items > 1 ) {
    1154                                 return apply_filters( 'bp_groups_multiple_member_promoted_to_mod_notification', '<a href="' . $bp['loggedin_domain'] . $bp['groups']['slug'] . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('You were promoted to a mod in %d groups'), (int)$total_items ) . '</a>', $total_items );               
     1152                                return apply_filters( 'bp_groups_multiple_member_promoted_to_mod_notification', '<a href="' . $bp->loggedin_user->domain . $bp->groups->slug . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('You were promoted to a mod in %d groups'), (int)$total_items ) . '</a>', $total_items );               
    11551153                        } else {
    11561154                                return apply_filters( 'bp_groups_single_member_promoted_to_mod_notification', '<a href="' . $group_link . '">' . sprintf( __('You were promoted to a mod in the group %s'), $group->name ) . '</a>', $group_link, $group->name );
    … …  
    11651163                       
    11661164                        if ( (int)$total_items > 1 ) {
    1167                                 return apply_filters( 'bp_groups_multiple_group_invite_notification', '<a href="' . $bp['loggedin_domain'] . $bp['groups']['slug'] . '/invites" title="' . __( 'Group Invites', 'buddypress' ) . '">' . sprintf( __('You have %d new group invitations'), (int)$total_items ) . '</a>', $total_items );         
     1165                                return apply_filters( 'bp_groups_multiple_group_invite_notification', '<a href="' . $bp->loggedin_user->domain . $bp->groups->slug . '/invites" title="' . __( 'Group Invites', 'buddypress' ) . '">' . sprintf( __('You have %d new group invitations'), (int)$total_items ) . '</a>', $total_items );         
    11681166                        } else {
    1169                                 return apply_filters( 'bp_groups_single_group_invite_notification', '<a href="' . $bp['loggedin_domain'] . $bp['groups']['slug'] . '/invites" title="' . __( 'Group Invites', 'buddypress' ) . '">' . sprintf( __('You have an invitation to the group: %s'), $group->name ) . '</a>', $group->name );
     1167                                return apply_filters( 'bp_groups_single_group_invite_notification', '<a href="' . $bp->loggedin_user->domain . $bp->groups->slug . '/invites" title="' . __( 'Group Invites', 'buddypress' ) . '">' . sprintf( __('You have an invitation to the group: %s'), $group->name ) . '</a>', $group->name );
    11701168                        }       
    11711169                break;
    … …  
    12071205        global $bp;
    12081206       
    1209         $groups = BP_Groups_Member::get_group_ids( $bp['current_userid'], $pag_num, $pag_page );
     1207        $groups = BP_Groups_Member::get_group_ids( $bp->displayed_user->id, $pag_num, $pag_page );
    12101208
    12111209        return array( 'groups' => $groups['ids'], 'total' => $groups['total'] );
    … …  
    12921290                bp_core_render_avatar_upload_form( '', true );
    12931291        } else {
    1294                 bp_core_render_avatar_cropper( $original, $canvas, null, null, false, $bp['loggedin_domain'] );
     1292                bp_core_render_avatar_cropper( $original, $canvas, null, null, false, $bp->loggedin_user->domain );
    12951293        }
    12961294}
    … …  
    13061304        global $bp;
    13071305       
    1308         $src = $bp['root_domain'] . '/';
     1306        $src = $bp->root_domain . '/';
    13091307
    13101308        $thumb_href = str_replace( ABSPATH, $src, stripslashes( $avatars['v1_out'] ) );
    … …  
    13171315        global $bp;
    13181316
    1319         $src = $bp['root_domain'] . '/';
     1317        $src = $bp->root_domain . '/';
    13201318
    13211319        $path = str_replace( $src, ABSPATH, stripslashes( $avatar ) );
    … …  
    13481346                        case '1':
    13491347                                if ( $_POST['group-name'] != '' && $_POST['group-desc'] != '' ) {
    1350                                         $group_obj->creator_id = $bp['loggedin_userid'];
     1348                                        $group_obj->creator_id = $bp->loggedin_user->id;
    13511349                                        $group_obj->name = stripslashes($_POST['group-name']);
    13521350                                        $group_obj->description = stripslashes($_POST['group-desc']);
    … …  
    13681366
    13691367                                        // Save the creator as the group administrator
    1370                                         $admin = new BP_Groups_Member( $bp['loggedin_userid'], $group_obj->id );
     1368                                        $admin = new BP_Groups_Member( $bp->loggedin_user->id, $group_obj->id );
    13711369                                        $admin->is_admin = 1;
    13721370                                        $admin->user_title = __('Group Admin', 'buddypress');
    … …  
    14101408                                } else {
    14111409                                        /* Create the forum if enable_forum = 1 */
    1412                                         if ( function_exists( 'bp_forums_setup' ) && groups_get_groupmeta( $group_obj->id, 'forum_id' ) == '' ) {
     1410                                        if ( function_exists( 'bp_forums_setup' ) && '' == groups_get_groupmeta( $group_obj->id, 'forum_id' ) ) {
    14131411                                                groups_new_group_forum();
    14141412                                        }
    … …  
    14711469        global $bp;
    14721470       
    1473         if ( in_array( $slug, $bp['groups']['forbidden_names'] ) ) {
     1471        if ( in_array( $slug, $bp->groups->forbidden_names ) ) {
    14741472                $slug = $slug . '-' . rand();
    14751473        }
    … …  
    15741572        $invite->user_id = $user_id;
    15751573        $invite->date_modified = time();
    1576         $invite->inviter_id = $bp['loggedin_userid'];
     1574        $invite->inviter_id = $bp->loggedin_user->id;
    15771575        $invite->is_confirmed = 0;
    15781576       
    … …  
    16351633       
    16361634        if ( !$user_id )
    1637                 $user_id = $bp['loggedin_userid'];
     1635                $user_id = $bp->loggedin_user->id;
    16381636       
    16391637        return BP_Groups_Member::get_invites( $user_id );
    … …  
    16441642       
    16451643        // Send friend invites.
    1646         $invited_users = groups_get_invites_for_group( $bp['loggedin_userid'], $group_obj->id );
     1644        $invited_users = groups_get_invites_for_group( $bp->loggedin_user->id, $group_obj->id );
    16471645
    16481646        for ( $i = 0; $i < count( $invited_users ); $i++ ) {
    … …  
    16521650        }
    16531651       
    1654         groups_notification_group_invites( $group_obj->id, $invited_users, $bp['loggedin_userid'] );
     1652        groups_notification_group_invites( $group_obj->id, $invited_users, $bp->loggedin_user->id );
    16551653       
    16561654        do_action( 'groups_send_invites', $group_obj->id, $invited_users );
    … …  
    16651663       
    16661664        if ( !$user_id )
    1667                 $user_id = $bp['loggedin_userid'];
     1665                $user_id = $bp->loggedin_user->id;
    16681666       
    16691667        // Admins cannot leave a group, that is until promotion to admin support is implemented.
    … …  
    16751673                return false;
    16761674
    1677         do_action( 'groups_leave_group', $group_id, $bp['loggedin_userid'] );
     1675        do_action( 'groups_leave_group', $group_id, $bp->loggedin_user->id );
    16781676
    16791677        /* Modify group member count */
    … …  
    16871685       
    16881686        if ( !$user_id )
    1689                 $user_id = $bp['loggedin_userid'];
     1687                $user_id = $bp->loggedin_user->id;
    16901688       
    16911689        $new_member = new BP_Groups_Member;
    … …  
    17081706        groups_update_groupmeta( $group_id, 'last_activity', time() );
    17091707
    1710         do_action( 'groups_join_group', $group_id, $bp['loggedin_userid'] );
     1708        do_action( 'groups_join_group', $group_id, $bp->loggedin_user->id );
    17111709
    17121710        return true;
    … …  
    17631761        global $bp;
    17641762       
    1765         if ( $group_name == '' || $group_desc == '' )
     1763        if ( empty( $group_name ) || empty( $group_desc ) )
    17661764                return false;
    17671765               
    … …  
    17971795        /* If forums have been enabled, and a forum does not yet exist, we need to create one. */
    17981796        if ( $group->enable_forum ) {
    1799                 if ( function_exists( 'bp_forums_setup' ) && groups_get_groupmeta( $group->id, 'forum_id' ) == '' ) {
     1797                if ( function_exists( 'bp_forums_setup' ) && '' == groups_get_groupmeta( $group->id, 'forum_id' ) ) {
    18001798                        groups_new_group_forum( $group->id, $group->name, $group->description );
    18011799                }
    … …  
    18101808        global $bp;
    18111809       
    1812         if ( !$bp['is_item_admin'] )
     1810        if ( !$bp->is_item_admin )
    18131811                return false;
    18141812               
    … …  
    18231821        global $bp;
    18241822       
    1825         if ( !$bp['is_item_admin'] )
     1823        if ( !$bp->is_item_admin )
    18261824                return false;
    18271825               
    … …  
    18361834        global $bp;
    18371835       
    1838         if ( !$bp['is_item_admin'] )
     1836        if ( !$bp->is_item_admin )
    18391837                return false;
    18401838               
    … …  
    18491847        global $bp;
    18501848       
    1851         if ( !$bp['is_item_admin'] )
     1849        if ( !$bp->is_item_admin )
    18521850                return false;
    18531851               
    … …  
    19261924        global $bp, $wpdb;
    19271925       
    1928         if ( $bp['current_component'] == $bp['groups']['slug'] && isset( $_GET['random'] ) ) {
     1926        if ( $bp->current_component == $bp->groups->slug && isset( $_GET['random'] ) ) {
    19291927                $group = groups_get_random_group();
    19301928
    1931                 bp_core_redirect( $bp['root_domain'] . '/' . $bp['groups']['slug'] . '/' . $group['groups'][0]->slug );
     1929                bp_core_redirect( $bp->root_domain . '/' . $bp->groups->slug . '/' . $group['groups'][0]->slug );
    19321930        }
    19331931}
    … …  
    19381936       
    19391937        // Check the user is the group admin.
    1940         if ( !$bp['is_item_admin'] )
     1938        if ( !$bp->is_item_admin )
    19411939                return false;
    19421940       
    … …  
    19481946       
    19491947        // Remove the activity stream item
    1950         groups_delete_activity( array( 'item_id' => $group_id, 'component_name' => 'groups', 'component_action' => 'created_group', 'user_id' => $bp['loggedin_userid'] ) );
     1948        groups_delete_activity( array( 'item_id' => $group_id, 'component_name' => 'groups', 'component_action' => 'created_group', 'user_id' => $bp->loggedin_user->id ) );
    19511949       
    19521950        do_action( 'groups_delete_group', $group_id );
    … …  
    19971995
    19981996        if ( !$meta_key ) {
    1999                 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['groups']['table_name_groupmeta'] . " WHERE group_id = %d", $group_id ) );           
     1997                $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp->groups->table_name_groupmeta . " WHERE group_id = %d", $group_id ) );               
    20001998        } else if ( !$meta_value ) {
    2001                 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['groups']['table_name_groupmeta'] . " WHERE group_id = %d AND meta_key = %s AND meta_value = %s", $group_id, $meta_key, $meta_value ) );
     1999                $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp->groups->table_name_groupmeta . " WHERE group_id = %d AND meta_key = %s AND meta_value = %s", $group_id, $meta_key, $meta_value ) );
    20022000        } else {
    2003                 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['groups']['table_name_groupmeta'] . " WHERE group_id = %d AND meta_key = %s", $group_id, $meta_key ) );
     2001                $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp->groups->table_name_groupmeta . " WHERE group_id = %d AND meta_key = %s", $group_id, $meta_key ) );
    20042002        }
    20052003       
    … …  
    20282026                //      $metas = array($user->$meta_key);
    20292027                //else
    2030                 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM " . $bp['groups']['table_name_groupmeta'] . " WHERE group_id = %d AND meta_key = %s", $group_id, $meta_key) );
     2028                $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM " . $bp->groups->table_name_groupmeta . " WHERE group_id = %d AND meta_key = %s", $group_id, $meta_key) );
    20312029        } else {
    2032                 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM " . $bp['groups']['table_name_groupmeta'] . " WHERE group_id = %d", $group_id) );
     2030                $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM " . $bp->groups->table_name_groupmeta . " WHERE group_id = %d", $group_id) );
    20332031        }
    20342032
    … …  
    20662064        }
    20672065
    2068         $cur = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $bp['groups']['table_name_groupmeta'] . " WHERE group_id = %d AND meta_key = %s", $group_id, $meta_key ) );
     2066        $cur = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $bp->groups->table_name_groupmeta . " WHERE group_id = %d AND meta_key = %s", $group_id, $meta_key ) );
    20692067
    20702068        if ( !$cur ) {
    2071                 $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp['groups']['table_name_groupmeta'] . " ( group_id, meta_key, meta_value ) VALUES ( %d, %s, %s )", $group_id, $meta_key, $meta_value ) );
     2069                $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp->groups->table_name_groupmeta . " ( group_id, meta_key, meta_value ) VALUES ( %d, %s, %s )", $group_id, $meta_key, $meta_value ) );
    20722070        } else if ( $cur->meta_value != $meta_value ) {
    2073                 $wpdb->query( $wpdb->prepare( "UPDATE " . $bp['groups']['table_name_groupmeta'] . " SET meta_value = %s WHERE group_id = %d AND meta_key = %s", $meta_value, $group_id, $meta_key ) );
     2071                $wpdb->query( $wpdb->prepare( "UPDATE " . $bp->groups->table_name_groupmeta . " SET meta_value = %s WHERE group_id = %d AND meta_key = %s", $meta_value, $group_id, $meta_key ) );
    20742072        } else {
    20752073                return false;
    … …  
    20882086function groups_force_buddypress_theme( $template ) {
    20892087        global $current_component, $current_action;
    2090         global $is_member_page;
    2091        
     2088        global $is_member_page, $bp;
     2089
    20922090        $groups_bp = groups_setup_globals(true);
    20932091       
    2094         if ( $current_component != $groups_bp['groups']['slug'] )
     2092        if ( $current_component != $groups_bp->groups->slug )
    20952093                return $template;
    2096                
     2094       
    20972095        $member_theme = get_site_option('active-member-theme');
    20982096       
    2099         if ( $member_theme == '' )
     2097        if ( empty($member_theme) )
    21002098                $member_theme = 'buddypress-member';
    21012099       
    … …  
    21042102        bp_core_set_uri_globals();
    21052103
    2106         if ( $current_component == $groups_bp['groups']['slug'] )
    2107                 $is_single_group = BP_Groups_Group::group_exists( $current_action, $groups_bp['groups']['table_name'] );
     2104        if ( $current_component == $groups_bp->groups->slug )
     2105                $is_single_group = BP_Groups_Group::group_exists( $current_action, $groups_bp->groups->table_name );
    21082106       
    21092107        if ( $is_single_group ) {
    … …  
    21232121        global $bp, $is_single_group, $is_member_page, $current_component;
    21242122
    2125         if ( $current_component != $bp['groups']['slug'] )
     2123        if ( $current_component != $bp->groups->slug )
    21262124                return $stylesheet;
    21272125
    21282126        $member_theme = get_site_option('active-member-theme');
    21292127       
    2130         if ( $member_theme == '' )
     2128        if ( empty( $member_theme ) )
    21312129                $member_theme = 'buddypress-member';
    21322130       
  • trunk/bp-groups/bp-groups-ajax.php

    r802 r1021  
    88                return false;
    99       
    10         if ( !groups_is_user_admin( $bp['loggedin_userid'], $_POST['group_id'] ) )
    11                 return false;
    12        
    13         if ( !friends_check_friendship( $bp['loggedin_userid'], $_POST['friend_id'] ) )
     10        if ( !groups_is_user_admin( $bp->loggedin_user->id, $_POST['group_id'] ) )
     11                return false;
     12       
     13        if ( !friends_check_friendship( $bp->loggedin_user->id, $_POST['friend_id'] ) )
    1414                return false;
    1515       
    … …  
    2525                echo '<span class="activity">' . sprintf( __( 'active %s ago', 'buddypress' ), $user->last_active ) . '</span>';
    2626                echo '<div class="action">
    27                                 <a class="remove" href="' . $bp['loggedin_domain'] . $bp['groups']['slug'] . '/' . $_POST['group_id'] . '/invites/remove/' . $user->id . '" id="uid-' . $user->id . '">' . __( 'Remove Invite', 'buddypress' ) . '</a>
     27                                <a class="remove" href="' . $bp->loggedin_user->domain . $bp->groups->slug . '/' . $_POST['group_id'] . '/invites/remove/' . $user->id . '" id="uid-' . $user->id . '">' . __( 'Remove Invite', 'buddypress' ) . '</a>
    2828                          </div>';
    2929                echo '</li>';
    … …  
    230230                <div id="group-dir-count" class="pag-count">
    231231                        <?php echo sprintf( __( 'Viewing group %d to %d (%d total active groups)', 'buddypress' ), $from_num, $to_num, $groups['total'] ); ?> &nbsp;
    232                         <img id="ajax-loader-groups" src="<?php echo $bp['core']['image_base'] ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" />
     232                        <img id="ajax-loader-groups" src="<?php echo $bp->core->image_base ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" />
    233233                </div>
    234234       
    … …  
    287287        global $bp;
    288288
    289         if ( groups_is_user_banned( $bp['loggedin_userid'], $_POST['gid'] ) )
     289        if ( groups_is_user_banned( $bp->loggedin_user->id, $_POST['gid'] ) )
    290290                return false;
    291291       
    … …  
    296296                return false;
    297297       
    298         if ( !groups_is_user_member( $bp['loggedin_userid'], $group->id ) ) {
     298        if ( !groups_is_user_member( $bp->loggedin_user->id, $group->id ) ) {
    299299       
    300300                if ( $group->status == 'public' ) {
    … …  
    305305                        }                       
    306306                } else if ( $group->status == 'private' ) {
    307                         if ( !groups_send_membership_request( $bp['loggedin_userid'], $group->id ) ) {
     307                        if ( !groups_send_membership_request( $bp->loggedin_user->id, $group->id ) ) {
    308308                                _e( 'Error requesting membership', 'buddypress' );     
    309309                        } else {
  • trunk/bp-groups/bp-groups-classes.php

    r917 r1021  
    4141                global $wpdb, $bp;
    4242
    43                 $sql = $wpdb->prepare( "SELECT * FROM " . $bp['groups']['table_name'] . " WHERE id = %d", $this->id );
     43                $sql = $wpdb->prepare( "SELECT * FROM {$bp->groups->table_name} WHERE id = %d", $this->id );
    4444                $group = $wpdb->get_row($sql);
    4545
    … …  
    9393                if ( $this->id ) {
    9494                        $sql = $wpdb->prepare(
    95                                 "UPDATE " . $bp['groups']['table_name'] . " SET
     95                                "UPDATE {$bp->groups->table_name} SET
    9696                                        creator_id = %d,
    9797                                        name = %s,
    … …  
    129129                } else {
    130130                        $sql = $wpdb->prepare(
    131                                 "INSERT INTO " . $bp['groups']['table_name'] . " (
     131                                "INSERT INTO {$bp->groups->table_name} (
    132132                                        creator_id,
    133133                                        name,
    … …  
    185185                global $wpdb, $bp;
    186186               
    187                 return $wpdb->get_results( $wpdb->prepare( "SELECT user_id, is_admin, inviter_id, user_title, is_mod FROM " . $bp['groups']['table_name_members'] . " WHERE group_id = %d AND is_confirmed = 1 AND is_banned = 0 ORDER BY rand()", $this->id ) );
     187                return $wpdb->get_results( $wpdb->prepare( "SELECT user_id, is_admin, inviter_id, user_title, is_mod FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 1 AND is_banned = 0 ORDER BY rand()", $this->id ) );
    188188        }
    189189               
    … …  
    217217               
    218218                for ( $i = 0; $i < count($this->user_dataset); $i++ ) {
    219                         if ( $this->user_dataset[$i]->user_id == $bp['loggedin_userid'] ) {
     219                        if ( $this->user_dataset[$i]->user_id == $bp->loggedin_user->id ) {
    220220                                return true;
    221221                        }
    … …  
    247247                // Delete the wire posts for this group if the wire is installed
    248248                if ( function_exists('bp_wire_install') ) {
    249                         BP_Wire_Post::delete_all_for_item( $this->id, $bp['groups']['table_name_wire'] );
     249                        BP_Wire_Post::delete_all_for_item( $this->id, $bp->groups->table_name_wire );
    250250                }
    251251                               
    252252                // Finally remove the group entry from the DB
    253                 if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['groups']['table_name'] . " WHERE id = %d", $this->id ) ) )
     253                if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name} WHERE id = %d", $this->id ) ) )
    254254                        return false;
    255255
    … …  
    264264               
    265265                if ( !$table_name )
    266                         $table_name = $bp['groups']['table_name'];
     266                        $table_name = $bp->groups->table_name;
    267267               
    268268                if ( !$slug )
    269269                        return false;
    270270                       
    271                 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $table_name WHERE slug = %s", $slug ) );
     271                return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$table_name} WHERE slug = %s", $slug ) );
    272272        }
    273273
    … …  
    278278        function get_invites( $user_id, $group_id ) {
    279279                global $wpdb, $bp;
    280                 return $wpdb->get_col( $wpdb->prepare( "SELECT user_id FROM " . $bp['groups']['table_name_members'] . " WHERE group_id = %d and is_confirmed = 0 AND inviter_id = %d", $group_id, $user_id ) );
     280                return $wpdb->get_col( $wpdb->prepare( "SELECT user_id FROM {$bp->groups->table_name_members} WHERE group_id = %d and is_confirmed = 0 AND inviter_id = %d", $group_id, $user_id ) );
    281281        }
    282282       
    … …  
    290290               
    291291                // Get all the group ids for the current user's groups.
    292                 $gids = BP_Groups_Member::get_group_ids( $bp['current_userid'], false, false, false, true );
     292                $gids = BP_Groups_Member::get_group_ids( $bp->displayed_user->id, false, false, false, true );
    293293
    294294                if ( !$gids['groups'] )
    … …  
    297297                $gids = implode( ',', $gids['groups'] );
    298298
    299                 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM " . $bp['groups']['table_name'] . " WHERE ( name LIKE '{$filter}%%' OR description LIKE '{$filter}%%' ) AND id IN ({$gids}) {$pag_sql}" ) );
    300                 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $bp['groups']['table_name'] . " WHERE ( name LIKE '{$filter}%%' OR description LIKE '{$filter}%%' ) AND id IN ({$gids})" ) );
     299                $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM {$bp->groups->table_name} WHERE ( name LIKE '{$filter}%%' OR description LIKE '{$filter}%%' ) AND id IN ({$gids}) {$pag_sql}" ) );
     300                $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->groups->table_name} WHERE ( name LIKE '{$filter}%%' OR description LIKE '{$filter}%%' ) AND id IN ({$gids})" ) );
    301301               
    302302                return array( 'groups' => $paged_groups, 'total' => $total_groups );
    … …  
    317317                }
    318318               
    319                 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM " . $bp['groups']['table_name'] . " WHERE status != 'hidden' AND name LIKE '%%$filter%%' OR description LIKE '%%$filter%%' {$order_sql} {$pag_sql}" ) );
    320                 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $bp['groups']['table_name'] . " WHERE status != 'hidden' AND name LIKE '%%$filter%%' OR description LIKE '%%$filter%%'" ) );
     319                $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM {$bp->groups->table_name} WHERE status != 'hidden' AND name LIKE '%%$filter%%' OR description LIKE '%%$filter%%' {$order_sql} {$pag_sql}" ) );
     320                $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->groups->table_name} WHERE status != 'hidden' AND name LIKE '%%$filter%%' OR description LIKE '%%$filter%%'" ) );
    321321               
    322322                return array( 'groups' => $paged_groups, 'total' => $total_groups );
    … …  
    326326                global $wpdb, $bp;
    327327               
    328                 return $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM " . $bp['groups']['table_name'] . " WHERE slug = %s", $slug ) );               
     328                return $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM {$bp->groups->table_name} WHERE slug = %s", $slug ) );         
    329329        }
    330330       
    … …  
    332332                global $wpdb, $bp;
    333333               
    334                 return $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM " . $bp['groups']['table_name'] . " WHERE id = %d", $group_id ) );             
     334                return $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM {$bp->groups->table_name} WHERE id = %d", $group_id ) );               
    335335        }
    336336       
    … …  
    338338                global $wpdb, $bp;
    339339               
    340                 $members = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $bp['groups']['table_name_members'] . " WHERE group_id = %d", $group_id ) );                                             
     340                $members = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->groups->table_name_members} WHERE group_id = %d", $group_id ) );                                               
    341341
    342342                if ( !$members )
    … …  
    349349                global $wpdb, $bp;
    350350               
    351                 return $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $bp['groups']['table_name_members'] . " WHERE group_id = %d AND is_confirmed = 0", $group_id ) );                                             
     351                return $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 0", $group_id ) );                                               
    352352        }
    353353       
    … …  
    357357                if ( $limit && $page ) {
    358358                        $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
    359                         $total_requests = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $bp['groups']['table_name_members'] . " WHERE group_id = %d AND is_confirmed = 0 AND inviter_id = 0", $group_id ) );
    360                 }
    361                
    362                 $paged_requests = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $bp['groups']['table_name_members'] . " WHERE group_id = %d AND is_confirmed = 0 AND inviter_id = 0{$pag_sql}", $group_id ) );
     359                        $total_requests = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 0 AND inviter_id = 0", $group_id ) );
     360                }
     361               
     362                $paged_requests = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 0 AND inviter_id = 0{$pag_sql}", $group_id ) );
    363363
    364364                return array( 'requests' => $paged_requests, 'total' => $total_requests );
    … …  
    370370                if ( $limit && $page ) {
    371371                        $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
    372                         $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $bp['groups']['table_name'] . " WHERE status != 'hidden' ORDER BY date_created DESC", $limit ) );
    373                 }
    374                
    375                 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM " . $bp['groups']['table_name'] . " WHERE status != 'hidden' ORDER BY date_created DESC {$pag_sql}" ) );
     372                        $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->groups->table_name} WHERE status != 'hidden' ORDER BY date_created DESC", $limit ) );
     373                }
     374               
     375                $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM {$bp->groups->table_name} WHERE status != 'hidden' ORDER BY date_created DESC {$pag_sql}" ) );
    376376
    377377                return array( 'groups' => $paged_groups, 'total' => $total_groups );
    … …  
    383383                if ( $limit && $page ) {
    384384                        $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
    385                         $total_groups = count( $wpdb->get_results( $wpdb->prepare( "SELECT group_id FROM " . $bp['groups']['table_name_groupmeta'] . " gm, " . $bp['groups']['table_name'] . " g WHERE g.id = gm.group_id AND g.status != 'hidden' AND gm.meta_key = 'last_activity' ORDER BY CONVERT(gm.meta_value, SIGNED) DESC", $limit ) ) );
    386                 }
    387                
    388                 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT group_id FROM " . $bp['groups']['table_name_groupmeta'] . " gm, " . $bp['groups']['table_name'] . " g WHERE g.id = gm.group_id AND g.status != 'hidden' AND gm.meta_key = 'last_activity' ORDER BY CONVERT(gm.meta_value, SIGNED) DESC {$pag_sql}", $limit ) );
     385                        $total_groups = count( $wpdb->get_results( $wpdb->prepare( "SELECT group_id FROM {$bp->groups->table_name_groupmeta} gm, {$bp->groups->table_name} g WHERE g.id = gm.group_id AND g.status != 'hidden' AND gm.meta_key = 'last_activity' ORDER BY CONVERT(gm.meta_value, SIGNED) DESC", $limit ) ) );
     386                }
     387               
     388                $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT group_id FROM {$bp->groups->table_name_groupmeta} gm, {$bp->groups->table_name} g WHERE g.id = gm.group_id AND g.status != 'hidden' AND gm.meta_key = 'last_activity' ORDER BY CONVERT(gm.meta_value, SIGNED) DESC {$pag_sql}", $limit ) );
    389389
    390390                return array( 'groups' => $paged_groups, 'total' => $total_groups );
    … …  
    396396                if ( $limit && $page ) {
    397397                        $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
    398                         $total_groups = count( $wpdb->get_results( $wpdb->prepare( "SELECT gm.group_id FROM " . $bp['groups']['table_name_groupmeta'] . " gm, " . $bp['groups']['table_name'] . " g WHERE g.id = gm.group_id AND g.status != 'hidden' AND gm.meta_key = 'total_member_count' ORDER BY CONVERT(gm.meta_value, SIGNED) DESC", $limit ) ) );
    399                 }
    400                        
    401                 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT gm.group_id FROM " . $bp['groups']['table_name_groupmeta'] . " gm, " . $bp['groups']['table_name'] . " g WHERE g.id = gm.group_id AND g.status != 'hidden' AND gm.meta_key = 'total_member_count' ORDER BY CONVERT(gm.meta_value, SIGNED) DESC {$pag_sql}", $limit ) );
     398                        $total_groups = count( $wpdb->get_results( $wpdb->prepare( "SELECT gm.group_id FROM {$bp->groups->table_name_groupmeta} gm, {$bp->groups->table_name} g WHERE g.id = gm.group_id AND g.status != 'hidden' AND gm.meta_key = 'total_member_count' ORDER BY CONVERT(gm.meta_value, SIGNED) DESC", $limit ) ) );
     399                }
     400                       
     401                $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT gm.group_id FROM {$bp->groups->table_name_groupmeta} gm, {$bp->groups->table_name} g WHERE g.id = gm.group_id AND g.status != 'hidden' AND gm.meta_key = 'total_member_count' ORDER BY CONVERT(gm.meta_value, SIGNED) DESC {$pag_sql}", $limit ) );
    402402
    403403                return array( 'groups' => $paged_groups, 'total' => $total_groups );
    … …  
    423423                        switch ( $sort_by ) {
    424424                                default:
    425                                         $sql = $wpdb->prepare( "SELECT g.id as g.group_id, g.slug FROM " . $bp['groups']['table_name'] . " {$public_sql} {$hidden_sql} {$order_sql} {$pag_sql}" );     
     425                                        $sql = $wpdb->prepare( "SELECT g.id as g.group_id, g.slug FROM {$bp->groups->table_name} {$public_sql} {$hidden_sql} {$order_sql} {$pag_sql}" );       
    426426                                        break;
    427427                                case 'members':
    428                                         $sql = $wpdb->prepare( "SELECT g.id as group_id, g.slug FROM " . $bp['groups']['table_name'] . " g, " . $bp['groups']['table_name_groupmeta'] . " gm WHERE g.id = gm.group_id AND gm.meta_key = 'total_member_count' {$hidden_sql} {$public_sql} ORDER BY CONVERT(gm.meta_value, SIGNED) {$order} {$pag_sql}" );
     428                                        $sql = $wpdb->prepare( "SELECT g.id as group_id, g.slug FROM {$bp->groups->table_name} g, {$bp->groups->table_name_groupmeta} gm WHERE g.id = gm.group_id AND gm.meta_key = 'total_member_count' {$hidden_sql} {$public_sql} ORDER BY CONVERT(gm.meta_value, SIGNED) {$order} {$pag_sql}" );
    429429                                        break;
    430430                                case 'last_active':
    431                                         $sql = $wpdb->prepare( "SELECT g.id as group_id, g.slug FROM " . $bp['groups']['table_name'] . " g, " . $bp['groups']['table_name_groupmeta'] . " gm WHERE g.id = gm.group_id AND gm.meta_key = 'last_activity' {$hidden_sql} {$public_sql} ORDER BY CONVERT(gm.meta_value, SIGNED) {$order} {$pag_sql}" );
     431                                        $sql = $wpdb->prepare( "SELECT g.id as group_id, g.slug FROM {$bp->groups->table_name} g, {$bp->groups->table_name_groupmeta} gm WHERE g.id = gm.group_id AND gm.meta_key = 'last_activity' {$hidden_sql} {$public_sql} ORDER BY CONVERT(gm.meta_value, SIGNED) {$order} {$pag_sql}" );
    432432                                        break;
    433433                        }
    434434                } else {
    435                         $sql = $wpdb->prepare( "SELECT id as group_id, slug FROM " . $bp['groups']['table_name'] . " {$public_sql} {$hidden_sql} {$order_sql} {$pag_sql}" );   
     435                        $sql = $wpdb->prepare( "SELECT id as group_id, slug FROM {$bp->groups->table_name} {$public_sql} {$hidden_sql} {$order_sql} {$pag_sql}" );     
    436436                }
    437437
    … …  
    452452                if ( $limit && $page ) {
    453453                        $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
    454                         $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp['groups']['table_name']} WHERE name LIKE '$letter%%' {$hidden_sql} ORDER BY name ASC" ) );
     454                        $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->groups->table_name} WHERE name LIKE '$letter%%' {$hidden_sql} ORDER BY name ASC" ) );
    455455                }
    456456                               
    457                 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM {$bp['groups']['table_name']} WHERE name LIKE '$letter%%' {$hidden_sql} ORDER BY name ASC {$pag_sql}" ) );
     457                $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM {$bp->groups->table_name} WHERE name LIKE '$letter%%' {$hidden_sql} ORDER BY name ASC {$pag_sql}" ) );
    458458               
    459459                return array( 'groups' => $paged_groups, 'total' => $total_groups );
    … …  
    469469                if ( $limit && $page ) {
    470470                        $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
    471                         $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT id as group_id, slug FROM " . $bp['groups']['table_name'] . " WHERE status = 'public' {$hidden_sql} ORDER BY rand()" ) );
    472                 }
    473                
    474                 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id, slug FROM " . $bp['groups']['table_name'] . " WHERE status = 'public' {$hidden_sql} ORDER BY rand() {$pag_sql}" ) );               
     471                        $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT id as group_id, slug FROM {$bp->groups->table_name} WHERE status = 'public' {$hidden_sql} ORDER BY rand()" ) );
     472                }
     473               
     474                $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id, slug FROM {$bp->groups->table_name} WHERE status = 'public' {$hidden_sql} ORDER BY rand() {$pag_sql}" ) );         
    475475               
    476476                return array( 'groups' => $paged_groups, 'total' => $total_groups );
    … …  
    515515               
    516516                if ( $this->user_id && $this->group_id && !$this->id )
    517                         $sql = $wpdb->prepare( "SELECT * FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND group_id = %d", $this->user_id, $this->group_id );
     517                        $sql = $wpdb->prepare( "SELECT * FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d", $this->user_id, $this->group_id );
    518518               
    519519                if ( $this->id )
    520                         $sql = $wpdb->prepare( "SELECT * FROM " . $bp['groups']['table_name_members'] . " WHERE id = %d", $this->id );
     520                        $sql = $wpdb->prepare( "SELECT * FROM {$bp->groups->table_name_members} WHERE id = %d", $this->id );
    521521                       
    522522                $member = $wpdb->get_row($sql);
    … …  
    544544               
    545545                if ( $this->id ) {
    546                         $sql = $wpdb->prepare( "UPDATE " . $bp['groups']['table_name_members'] . " SET inviter_id = %d, is_admin = %d, is_mod = %d, is_banned = %d, user_title = %s, date_modified = FROM_UNIXTIME(%d), is_confirmed = %d, comments = %s, invite_sent = %d WHERE id = %d", $this->inviter_id, $this->is_admin, $this->is_mod, $this->is_banned, $this->user_title, $this->date_modified, $this->is_confirmed, $this->comments, $this->invite_sent, $this->id );
    547                 } else {
    548                         $sql = $wpdb->prepare( "INSERT INTO " . $bp['groups']['table_name_members'] . " ( user_id, group_id, inviter_id, is_admin, is_mod, is_banned, user_title, date_modified, is_confirmed, comments, invite_sent ) VALUES ( %d, %d, %d, %d, %d, %d, %s, FROM_UNIXTIME(%d), %d, %s, %d )", $this->user_id, $this->group_id, $this->inviter_id, $this->is_admin, $this->is_mod, $this->is_banned, $this->user_title, $this->date_modified, $this->is_confirmed, $this->comments, $this->invite_sent );
     546                        $sql = $wpdb->prepare( "UPDATE {$bp->groups->table_name_members} SET inviter_id = %d, is_admin = %d, is_mod = %d, is_banned = %d, user_title = %s, date_modified = FROM_UNIXTIME(%d), is_confirmed = %d, comments = %s, invite_sent = %d WHERE id = %d", $this->inviter_id, $this->is_admin, $this->is_mod, $this->is_banned, $this->user_title, $this->date_modified, $this->is_confirmed, $this->comments, $this->invite_sent, $this->id );
     547                } else {
     548                        $sql = $wpdb->prepare( "INSERT INTO {$bp->groups->table_name_members} ( user_id, group_id, inviter_id, is_admin, is_mod, is_banned, user_title, date_modified, is_confirmed, comments, invite_sent ) VALUES ( %d, %d, %d, %d, %d, %d, %s, FROM_UNIXTIME(%d), %d, %s, %d )", $this->user_id, $this->group_id, $this->inviter_id, $this->is_admin, $this->is_mod, $this->is_banned, $this->user_title, $this->date_modified, $this->is_confirmed, $this->comments, $this->invite_sent );
    549549                }
    550550
    … …  
    617617                global $wpdb, $bp;
    618618               
    619                 $delete_result = $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND group_id = %d", $user_id, $group_id ) );
     619                $delete_result = $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d", $user_id, $group_id ) );
    620620               
    621621                return $delete_result;
    … …  
    630630                // If the user is logged in and viewing their own groups, we can show hidden and private groupss
    631631                if ( bp_is_home() ) {
    632                         $group_sql = $wpdb->prepare( "SELECT DISTINCT group_id FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0{$pag_sql}", $user_id );
    633                         $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(group_id) FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0", $user_id ) );       
    634                 } else {
    635                         $group_sql = $wpdb->prepare( "SELECT DISTINCT m.group_id FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . " g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0{$pag_sql}", $user_id );
    636                         $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . " g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0", $user_id ) );
     632                        $group_sql = $wpdb->prepare( "SELECT DISTINCT group_id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0{$pag_sql}", $user_id );   
     633                        $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(group_id) FROM {$bp->groups->table_name_members} WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0", $user_id ) );
     634                } else {
     635                        $group_sql = $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0{$pag_sql}", $user_id );     
     636                        $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0", $user_id ) );
    637637                }
    638638               
    … …  
    653653                // If the user is logged in and viewing their own groups, we can show hidden and private groups
    654654                if ( bp_is_home() ) {
    655                         $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT group_id FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0 AND is_confirmed = 1 ORDER BY date_modified ASC {$pag_sql}", $user_id ) );       
    656                         $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(group_id) FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0 AND is_confirmed = 1 ORDER BY date_modified ASC", $user_id ) );
    657                 } else {
    658                         $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . " g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_confirmed = 1 ORDER BY date_modified ASC {$pag_sql}", $user_id ) );     
    659                         $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . " g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_confirmed = 1 ORDER BY date_modified ASC", $user_id ) );     
     655                        $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT group_id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0 AND is_confirmed = 1 ORDER BY date_modified ASC {$pag_sql}", $user_id ) );
     656                        $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(group_id) FROM {$bp->groups->table_name_members} WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0 AND is_confirmed = 1 ORDER BY date_modified ASC", $user_id ) );
     657                } else {
     658                        $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_confirmed = 1 ORDER BY date_modified ASC {$pag_sql}", $user_id ) );
     659                        $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_confirmed = 1 ORDER BY date_modified ASC", $user_id ) );
    660660                }
    661661                               
    … …  
    671671                // If the user is logged in and viewing their own groups, we can show hidden and private groups
    672672                if ( bp_is_home() ) {
    673                         $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name_groupmeta'] . " gm WHERE m.group_id = gm.group_id AND gm.meta_key = 'total_member_count' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_confirmed = 1 ORDER BY CONVERT( gm.meta_value, SIGNED ) DESC {$pag_sql}", $user_id ) );
    674                         $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name_groupmeta'] . " gm WHERE m.group_id = gm.group_id AND gm.meta_key = 'total_member_count' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_confirmed = 1 ORDER BY CONVERT( gm.meta_value, SIGNED ) DESC", $user_id ) );
    675                 } else {
    676                         $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM " . $bp['groups']['table_name_members'] . " m LEFT JOIN " . $bp['groups']['table_name'] . " g ON m.group_id = g.id LEFT JOIN " . $bp['groups']['table_name_groupmeta'] . " gm ON m.group_id = gm.group_id AND gm.meta_key = 'total_member_count' AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_confirmed = 1 ORDER BY CONVERT( gm.meta_value, SIGNED ) DESC {$pag_sql}", $user_id ) );     
    677                         $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM " . $bp['groups']['table_name_members'] . " m LEFT JOIN " . $bp['groups']['table_name'] . " g ON m.group_id = g.id LEFT JOIN " . $bp['groups']['table_name_groupmeta'] . " gm ON m.group_id = gm.group_id AND gm.meta_key = 'total_member_count' AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_confirmed = 1 ORDER BY CONVERT( gm.meta_value, SIGNED ) DESC", $user_id ) );     
     673                        $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name_groupmeta} gm WHERE m.group_id = gm.group_id AND gm.meta_key = 'total_member_count' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_confirmed = 1 ORDER BY CONVERT( gm.meta_value, SIGNED ) DESC {$pag_sql}", $user_id ) );     
     674                        $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name_groupmeta} gm WHERE m.group_id = gm.group_id AND gm.meta_key = 'total_member_count' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_confirmed = 1 ORDER BY CONVERT( gm.meta_value, SIGNED ) DESC", $user_id ) );
     675                } else {
     676                        $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m LEFT JOIN {$bp->groups->table_name} g ON m.group_id = g.id LEFT JOIN {$bp->groups->table_name_groupmeta} gm ON m.group_id = gm.group_id AND gm.meta_key = 'total_member_count' AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_confirmed = 1 ORDER BY CONVERT( gm.meta_value, SIGNED ) DESC {$pag_sql}", $user_id ) );   
     677                        $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM {$bp->groups->table_name_members} m LEFT JOIN {$bp->groups->table_name} g ON m.group_id = g.id LEFT JOIN {$bp->groups->table_name_groupmeta} gm ON m.group_id = gm.group_id AND gm.meta_key = 'total_member_count' AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_confirmed = 1 ORDER BY CONVERT( gm.meta_value, SIGNED ) DESC", $user_id ) );   
    678678                }
    679679               
    … …  
    689689                // If the user is logged in and viewing their own groups, we can show hidden and private groups
    690690                if ( bp_is_home() ) {
    691                         $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM " . $bp['groups']['table_name_members'] . " m LEFT JOIN " . $bp['groups']['table_name_groupmeta'] . " gm ON m.group_id = gm.group_id WHERE gm.meta_key = 'last_activity' AND user_id = %d AND inviter_id = 0 AND is_banned = 0 ORDER BY gm.meta_value DESC {$pag_sql}", $user_id ) );     
    692                         $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM " . $bp['groups']['table_name_members'] . " m LEFT JOIN " . $bp['groups']['table_name_groupmeta'] . " gm ON m.group_id = gm.group_id WHERE gm.meta_key = 'last_activity' AND user_id = %d AND inviter_id = 0 AND is_banned = 0 ORDER BY gm.meta_value DESC {$pag_sql}", $user_id ) );
    693                 } else {
    694                         $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM " . $bp['groups']['table_name_members'] . " m LEFT JOIN " . $bp['groups']['table_name_groupmeta'] . " gm ON m.group_id = gm.group_id LEFT JOIN  " . $bp['groups']['table_name'] . " g ON m.group_id = g.id WHERE gm.meta_key = 'last_activity' AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 ORDER BY gm.meta_value DESC {$pag_sql}", $user_id ) );
    695                         $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM " . $bp['groups']['table_name_members'] . " m LEFT JOIN " . $bp['groups']['table_name_groupmeta'] . " gm ON m.group_id = gm.group_id LEFT JOIN " . $bp['groups']['table_name'] . " g ON m.group_id = g.id WHERE gm.meta_key = 'last_activity' AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 ORDER BY gm.meta_value DESC", $user_id ) ); 
     691                        $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m LEFT JOIN {$bp->groups->table_name_groupmeta} gm ON m.group_id = gm.group_id WHERE gm.meta_key = 'last_activity' AND user_id = %d AND inviter_id = 0 AND is_banned = 0 ORDER BY gm.meta_value DESC {$pag_sql}", $user_id ) ); 
     692                        $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM {$bp->groups->table_name_members} m LEFT JOIN {$bp->groups->table_name_groupmeta} gm ON m.group_id = gm.group_id WHERE gm.meta_key = 'last_activity' AND user_id = %d AND inviter_id = 0 AND is_banned = 0 ORDER BY gm.meta_value DESC {$pag_sql}", $user_id ) );
     693                } else {
     694                        $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m LEFT JOIN {$bp->groups->table_name_groupmeta} gm ON m.group_id = gm.group_id LEFT JOIN  {$bp->groups->table_name} g ON m.group_id = g.id WHERE gm.meta_key = 'last_activity' AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 ORDER BY gm.meta_value DESC {$pag_sql}", $user_id ) );       
     695                        $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM {$bp->groups->table_name_members} m LEFT JOIN {$bp->groups->table_name_groupmeta} gm ON m.group_id = gm.group_id LEFT JOIN {$bp->groups->table_name} g ON m.group_id = g.id WHERE gm.meta_key = 'last_activity' AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 ORDER BY gm.meta_value DESC", $user_id ) );       
    696696                }
    697697
    … …  
    707707                // If the user is logged in and viewing their own groups, we can show hidden and private groups
    708708                if ( bp_is_home() ) {
    709                         $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM " . $bp['groups']['table_name_members'] . " m LEFT JOIN " . $bp['groups']['table_name'] . " g ON m.group_id = g.id WHERE m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 ORDER BY g.name ASC {$pag_sql}", $user_id ) );   
    710                         $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM " . $bp['groups']['table_name_members'] . " m LEFT JOIN " . $bp['groups']['table_name'] . " g ON m.group_id = g.id WHERE m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 ORDER BY g.name ASC", $user_id ) );
    711                 } else {
    712                         $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . " g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 ORDER BY g.name ASC {$pag_sql}", $user_id ) );   
    713                         $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . " g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 ORDER BY g.name ASC", $user_id ) );   
     709                        $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m LEFT JOIN {$bp->groups->table_name} g ON m.group_id = g.id WHERE m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 ORDER BY g.name ASC {$pag_sql}", $user_id ) );       
     710                        $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM {$bp->groups->table_name_members} m LEFT JOIN {$bp->groups->table_name} g ON m.group_id = g.id WHERE m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 ORDER BY g.name ASC", $user_id ) );
     711                } else {
     712                        $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 ORDER BY g.name ASC {$pag_sql}", $user_id ) );       
     713                        $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 ORDER BY g.name ASC", $user_id ) );       
    714714                }
    715715               
    … …  
    725725                // If the user is logged in and viewing their own groups, we can show hidden and private groups
    726726                if ( bp_is_home() ) {
    727                         $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT group_id FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0 AND is_admin = 1 ORDER BY date_modified ASC {$pag_sql}", $user_id ) );   
    728                         $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(group_id) FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0 AND is_admin = 1 ORDER BY date_modified ASC", $user_id ) );
    729                 } else {
    730                         $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . " g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_admin = 1 ORDER BY date_modified ASC {$pag_sql}", $user_id ) );
    731                         $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . " g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_admin = 1 ORDER BY date_modified ASC", $user_id ) );
     727                        $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT group_id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0 AND is_admin = 1 ORDER BY date_modified ASC {$pag_sql}", $user_id ) );     
     728                        $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(group_id) FROM {$bp->groups->table_name_members} WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0 AND is_admin = 1 ORDER BY date_modified ASC", $user_id ) );
     729                } else {
     730                        $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_admin = 1 ORDER BY date_modified ASC {$pag_sql}", $user_id ) );     
     731                        $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_admin = 1 ORDER BY date_modified ASC", $user_id ) );     
    732732                }
    733733               
    … …  
    743743                // If the user is logged in and viewing their own groups, we can show hidden and private groups
    744744                if ( bp_is_home() ) {
    745                         $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT group_id FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0 AND is_mod = 1 ORDER BY date_modified ASC {$pag_sql}", $user_id ) );     
    746                         $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(group_id) FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0 AND is_mod = 1 ORDER BY date_modified ASC", $user_id ) );
    747                 } else {
    748                         $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . " g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_mod = 1 ORDER BY date_modified ASC {$pag_sql}", $user_id ) );   
    749                         $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . " g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_mod = 1 ORDER BY date_modified ASC", $user_id ) );   
     745                        $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT group_id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0 AND is_mod = 1 ORDER BY date_modified ASC {$pag_sql}", $user_id ) );       
     746                        $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(group_id) FROM {$bp->groups->table_name_members} WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0 AND is_mod = 1 ORDER BY date_modified ASC", $user_id ) );
     747                } else {
     748                        $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_mod = 1 ORDER BY date_modified ASC {$pag_sql}", $user_id ) );       
     749                        $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_mod = 1 ORDER BY date_modified ASC", $user_id ) );       
    750750                }
    751751               
    … …  
    757757               
    758758                if ( !$user_id )
    759                         $user_id = $bp['current_userid'];
     759                        $user_id = $bp->displayed_user->id;
    760760                       
    761761                if ( bp_is_home() ) {
    762                         return $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(group_id) FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0", $user_id ) );                       
    763                 } else {
    764                         return $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . " g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0", $user_id ) );                       
     762                        return $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(group_id) FROM {$bp->groups->table_name_members} WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0", $user_id ) );                 
     763                } else {
     764                        return $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0", $user_id ) );                   
    765765                }
    766766        }
    … …  
    769769                global $wpdb, $bp;
    770770               
    771                 $group_ids = $wpdb->get_results( $wpdb->prepare( "SELECT group_id FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d and is_confirmed = 0 AND inviter_id != 0 AND invite_sent = 1", $user_id ) );
     771                $group_ids = $wpdb->get_results( $wpdb->prepare( "SELECT group_id FROM {$bp->groups->table_name_members} WHERE user_id = %d and is_confirmed = 0 AND inviter_id != 0 AND invite_sent = 1", $user_id ) );
    772772               
    773773                return $group_ids;
    … …  
    780780                        return false;
    781781               
    782                 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND inviter_id != 0 AND invite_sent = 1", $user_id, $group_id ) );         
     782                return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND inviter_id != 0 AND invite_sent = 1", $user_id, $group_id ) );           
    783783        }
    784784       
    … …  
    789789                        return false;
    790790               
    791                 return $wpdb->query( $wpdb->prepare( "SELECT id FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND group_id = %d AND is_admin = 1 AND is_banned = 0", $user_id, $group_id ) );
     791                return $wpdb->query( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_admin = 1 AND is_banned = 0", $user_id, $group_id ) );
    792792        }
    793793       
    … …  
    798798                        return false;
    799799                               
    800                 return $wpdb->query( $wpdb->prepare( "SELECT id FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND group_id = %d AND is_mod = 1 AND is_banned = 0", $user_id, $group_id ) );
     800                return $wpdb->query( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_mod = 1 AND is_banned = 0", $user_id, $group_id ) );
    801801        }
    802802       
    … …  
    807807                        return false;
    808808               
    809                 return $wpdb->query( $wpdb->prepare( "SELECT id FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND group_id = %d AND is_confirmed = 1 AND is_banned = 0", $user_id, $group_id ) );
     809                return $wpdb->query( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 1 AND is_banned = 0", $user_id, $group_id ) );   
    810810        }
    811811       
    … …  
    816816                        return false;
    817817               
    818                 return $wpdb->get_var( $wpdb->prepare( "SELECT is_banned FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND group_id = %d", $user_id, $group_id ) );
     818                return $wpdb->get_var( $wpdb->prepare( "SELECT is_banned FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d", $user_id, $group_id ) );
    819819        }
    820820       
    … …  
    825825                        return false;
    826826               
    827                 return $wpdb->query( $wpdb->prepare( "SELECT id FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND is_banned = 0 AND inviter_id = 0", $user_id, $group_id ) );     
     827                return $wpdb->query( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND is_banned = 0 AND inviter_id = 0", $user_id, $group_id ) );       
    828828        }
    829829       
    … …  
    833833                // If the user is logged in and viewing their random groups, we can show hidden and private groups
    834834                if ( bp_is_home() ) {
    835                         return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT group_id FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND is_confirmed = 1 AND is_banned = 0 ORDER BY rand() LIMIT $total_groups", $user_id ) );
    836                 } else {
    837                         return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . " g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.is_confirmed = 1 AND m.is_banned = 0 ORDER BY rand() LIMIT $total_groups", $user_id ) );                 
     835                        return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT group_id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND is_confirmed = 1 AND is_banned = 0 ORDER BY rand() LIMIT $total_groups", $user_id ) );
     836                } else {
     837                        return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.is_confirmed = 1 AND m.is_banned = 0 ORDER BY rand() LIMIT $total_groups", $user_id ) );                     
    838838                }
    839839        }
    … …  
    842842                global $bp, $wpdb;
    843843               
    844                 return $wpdb->get_results( $wpdb->prepare( "SELECT user_id, date_modified FROM " . $bp['groups']['table_name_members'] . " WHERE group_id = %d AND is_admin = 1 AND is_banned = 0", $group_id ) );
     844                return $wpdb->get_results( $wpdb->prepare( "SELECT user_id, date_modified FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_admin = 1 AND is_banned = 0", $group_id ) );
    845845        }
    846846       
    … …  
    848848                global $bp, $wpdb;
    849849
    850                 return $wpdb->get_results( $wpdb->prepare( "SELECT user_id, date_modified FROM " . $bp['groups']['table_name_members'] . " WHERE group_id = %d AND is_mod = 1 AND is_banned = 0", $group_id ) );
     850                return $wpdb->get_results( $wpdb->prepare( "SELECT user_id, date_modified FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_mod = 1 AND is_banned = 0", $group_id ) );
    851851        }
    852852       
    … …  
    863863                        $banned_sql = $wpdb->prepare( " AND is_banned = 0" );
    864864               
    865                 $members = $wpdb->get_results( $wpdb->prepare( "SELECT user_id, date_modified FROM " . $bp['groups']['table_name_members'] . " WHERE group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_sql} {$pag_sql}", $group_id ) );
     865                $members = $wpdb->get_results( $wpdb->prepare( "SELECT user_id, date_modified FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_sql} {$pag_sql}", $group_id ) );
    866866               
    867867                if ( !$members )
    … …  
    871871                        $total_member_count = count($members);
    872872                else
    873                         $total_member_count = $wpdb->get_var( $wpdb->prepare( "SELECT count(user_id) FROM " . $bp['groups']['table_name_members'] . " WHERE group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_sql}", $group_id ) );
     873                        $total_member_count = $wpdb->get_var( $wpdb->prepare( "SELECT count(user_id) FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_sql}", $group_id ) );
    874874       
    875875                return array( 'members' => $members, 'count' => $total_member_count );
    … …  
    879879                global $wpdb, $bp;
    880880               
    881                 return $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d", $user_id ) );               
     881                return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d", $user_id ) );         
    882882        }
    883883}
  • trunk/bp-groups/bp-groups-cssjs.php

    r930 r1021  
    99        global $bp;
    1010
    11         if ( $bp['current_component'] == $bp['groups']['slug'] )
     11        if ( $bp->current_component == $bp->groups->slug )
    1212                wp_enqueue_script( 'bp-groups-js', site_url( MUPLUGINDIR . '/bp-groups/js/general.js' ) );
    1313}
    … …  
    2323        global $bp, $create_group_step;
    2424       
    25         if ( $create_group_step == '3' || ( $bp['current_component'] == $bp['groups']['slug'] && $bp['action_variables'][0] == 'group-avatar' ) ) {
     25        if ( $create_group_step == '3' || ( $bp->current_component == $bp->groups->slug && $bp->action_variables[0] == 'group-avatar' ) ) {
    2626                wp_enqueue_script('jquery');
    2727                wp_enqueue_script('prototype');
  • trunk/bp-groups/bp-groups-notifications.php

    r884 r1021  
    77                return false;
    88       
    9         $wire_post = new BP_Wire_Post( $bp['groups']['table_name_wire'], $wire_post_id );
     9        $wire_post = new BP_Wire_Post( $bp->groups->table_name_wire, $wire_post_id );
    1010        $group = new BP_Groups_Group( $group_id, false, true );
    1111       
    … …  
    2424                $to = $ud->user_email;
    2525
    26                 $wire_link = site_url() . '/' . $bp['groups']['slug'] . '/' . $group->slug . '/wire';
    27                 $group_link = site_url() . '/' . $bp['groups']['slug'] . '/' . $group->slug;
     26                $wire_link = site_url() . '/' . $bp->groups->slug . '/' . $group->slug . '/wire';
     27                $group_link = site_url() . '/' . $bp->groups->slug . '/' . $group->slug;
    2828                $settings_link = site_url() . '/' . MEMBERS_SLUG . '/' . $ud->user_login . '/settings/notifications';
    2929
    … …  
    6565                $to = $ud->user_email;
    6666
    67                 $group_link = site_url() . '/' . $bp['groups']['slug'] . '/' . $group->slug;
     67                $group_link = site_url() . '/' . $bp->groups->slug . '/' . $group->slug;
    6868                $settings_link = site_url() . '/' . MEMBERS_SLUG . '/' . $ud->user_login . '/settings/notifications';
    6969
    … …  
    239239                $settings_link = site_url() . '/' . MEMBERS_SLUG . '/' . $ud->user_login . '/settings/notifications';
    240240                $invited_link = site_url() . '/' . MEMBERS_SLUG . '/' . $invited_ud->user_login;
    241                 $invites_link = $invited_link . '/' . $bp['groups']['slug'] . '/invites';
     241                $invites_link = $invited_link . '/' . $bp->groups->slug . '/invites';
    242242               
    243243                // Set up and send the message
  • trunk/bp-groups/bp-groups-templatetags.php

    r1015 r1021  
    2828                $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $groups_per_page;
    2929               
    30                 if ( ( $bp['current_action'] == 'my-groups' && $_REQUEST['group-filter-box'] == '' ) || ( !$bp['current_action'] && !isset($_REQUEST['page']) && $_REQUEST['group-filter-box'] == '' ) ) {
    31 
    32                         $order = $bp['action_variables'][0];
     30                if ( ( $bp->current_action == 'my-groups' && empty( $_REQUEST['group-filter-box'] ) ) || ( !$bp->current_action && !isset($_REQUEST['page']) && empty( $_REQUEST['group-filter-box'] ) ) ) {
     31
     32                        $order = $bp->action_variables[0];
    3333                       
    3434                        if ( $order == 'recently-joined' ) {
    35                                 $this->groups = groups_get_recently_joined_for_user( $bp['current_userid'], $this->pag_num, $this->pag_page );
     35                                $this->groups = groups_get_recently_joined_for_user( $bp->displayed_user->id, $this->pag_num, $this->pag_page );
    3636                        } else if ( $order == 'most-popular' ) {
    37                                 $this->groups = groups_get_most_popular_for_user( $bp['current_userid'], $this->pag_num, $this->pag_page );                             
     37                                $this->groups = groups_get_most_popular_for_user( $bp->displayed_user->id, $this->pag_num, $this->pag_page );                           
    3838                        } else if ( $order == 'admin-of' ) {
    39                                 $this->groups = groups_get_user_is_admin_of( $bp['current_userid'], $this->pag_num, $this->pag_page );                         
     39                                $this->groups = groups_get_user_is_admin_of( $bp->displayed_user->id, $this->pag_num, $this->pag_page );                               
    4040                        } else if ( $order == 'mod-of' ) {
    41                                 $this->groups = groups_get_user_is_mod_of( $bp['current_userid'], $this->pag_num, $this->pag_page );                           
     41                                $this->groups = groups_get_user_is_mod_of( $bp->displayed_user->id, $this->pag_num, $this->pag_page );                         
    4242                        } else if ( $order == 'alphabetically' ) {
    43                                 $this->groups = groups_get_alphabetically_for_user( $bp['current_userid'], $this->pag_num, $this->pag_page );   
     43                                $this->groups = groups_get_alphabetically_for_user( $bp->displayed_user->id, $this->pag_num, $this->pag_page );
    4444                        } else {
    45                                 $this->groups = groups_get_recently_active_for_user( $bp['current_userid'], $this->pag_num, $this->pag_page );
     45                                $this->groups = groups_get_recently_active_for_user( $bp->displayed_user->id, $this->pag_num, $this->pag_page );
    4646                        }
    4747
    … …  
    5050                        $this->group_count = count($this->groups);
    5151               
    52                 } else if ( ( $bp['current_action'] == 'my-groups' && $_REQUEST['group-filter-box'] != '' ) || ( !$bp['current_action'] && !isset($_REQUEST['page']) && $_REQUEST['group-filter-box'] != '' ) ) {
     52                } else if ( ( $bp->current_action == 'my-groups' && $_REQUEST['group-filter-box'] != '' ) || ( !$bp->current_action && !isset($_REQUEST['page']) && $_REQUEST['group-filter-box'] != '' ) ) {
    5353
    5454                        $this->groups = groups_filter_user_groups( $_REQUEST['group-filter-box'], $this->pag_num, $this->pag_page );
    … …  
    5757                        $this->group_count = count($this->groups);
    5858               
    59                 } else if ( $bp['current_action'] == 'invites' ) {
     59                } else if ( $bp->current_action == 'invites' ) {
    6060               
    6161                        $this->groups = groups_get_invites_for_user();
    … …  
    8383                        $this->single_group = true;
    8484                       
    85                         $group = new stdClass();
     85                        $group = new stdClass;
    8686                        $group->group_id = BP_Groups_Group::get_id_from_slug($group_slug);
    8787                       
    … …  
    9292                } else {
    9393                       
    94                         $this->groups = groups_get_user_groups( $bp['current_userid'], $this->pag_num, $this->pag_page );
     94                        $this->groups = groups_get_user_groups( $bp->displayed_user->id, $this->pag_num, $this->pag_page );
    9595                        $this->total_group_count = (int)$this->groups['total'];
    9696                        $this->groups = $this->groups['groups'];
    … …  
    167167       
    168168        if ( !$is_single_group ) {
    169                 $groups_template = new BP_Groups_Template( $bp['current_userid'], false, $groups_per_page );
     169                $groups_template = new BP_Groups_Template( $bp->displayed_user->id, false, $groups_per_page );
    170170        } else {
    171                 $groups_template = new BP_Groups_Template( $bp['current_userid'], $group_obj->slug, $groups_per_page );         
     171                $groups_template = new BP_Groups_Template( $bp->displayed_user->id, $group_obj->slug, $groups_per_page );               
    172172        }
    173173       
    … …  
    191191                return true;
    192192        } else {
    193                 if ( groups_is_user_member( $bp['loggedin_userid'], $groups_template->group->id ) ) {
     193                if ( groups_is_user_member( $bp->loggedin_user->id, $groups_template->group->id ) ) {
    194194                        return true;
    195195                }
    … …  
    202202        global $groups_template;
    203203       
    204         if ( $groups_template->group->news == '' )
     204        if ( empty( $groups_template->group->news ) )
    205205                return false;
    206206       
    … …  
    265265        $last_active = groups_get_groupmeta( $groups_template->group->id, 'last_activity' );
    266266       
    267         if ( $last_active == '' )
     267        if ( empty( $last_active ) )
    268268                _e( 'not yet active', 'buddypress' );
    269269        else
    … …  
    278278       
    279279        if ( $echo )
    280                 echo apply_filters( 'bp_group_permalink', $bp['root_domain'] . '/' . $bp['groups']['slug'] . '/' . $group_obj->slug );
     280                echo apply_filters( 'bp_group_permalink', $bp->root_domain . '/' . $bp->groups->slug . '/' . $group_obj->slug );
    281281        else
    282                 return apply_filters( 'bp_group_permalink', $bp['root_domain'] . '/' . $bp['groups']['slug'] . '/' . $group_obj->slug );
     282                return apply_filters( 'bp_group_permalink', $bp->root_domain . '/' . $bp->groups->slug . '/' . $group_obj->slug );
    283283}
    284284
    … …  
    290290       
    291291        if ( $echo )
    292                 echo apply_filters( 'bp_group_admin_permalink', $bp['root_domain'] . '/' . $bp['groups']['slug'] . '/' . $group_obj->slug . '/admin' );
     292                echo apply_filters( 'bp_group_admin_permalink', $bp->root_domain . '/' . $bp->groups->slug . '/' . $group_obj->slug . '/admin' );
    293293        else
    294                 return apply_filters( 'bp_group_admin_permalink', $bp['root_domain'] . '/' . $bp['groups']['slug'] . '/' . $group_obj->slug . '/admin' );       
     294                return apply_filters( 'bp_group_admin_permalink', $bp->root_domain . '/' . $bp->groups->slug . '/' . $group_obj->slug . '/admin' );     
    295295}
    296296
    … …  
    480480        global $groups_template, $bp;
    481481
    482         if ( $bp['current_action'] == 'my-groups' || !$bp['current_action'] ) {
    483                 $action = $bp['loggedin_domain'] . $bp['groups']['slug'] . '/my-groups/search/';
     482        if ( $bp->current_action == 'my-groups' || !$bp->current_action ) {
     483                $action = $bp->loggedin_user->domain . $bp->groups->slug . '/my-groups/search/';
    484484                $label = __('Filter Groups', 'buddypress');
    485485                $name = 'group-filter-box';
    486486        } else {
    487                 $action = $bp['loggedin_domain'] . $bp['groups']['slug'] . '/group-finder/search/';
     487                $action = $bp->loggedin_user->domain . $bp->groups->slug . '/group-finder/search/';
    488488                $label = __('Find a Group', 'buddypress');
    489489                $name = 'groupfinder-search-box';
    490                 $value = $bp['action_variables'][0];
     490                $value = $bp->action_variables[0];
    491491        }
    492492?>
    493493        <form action="<?php echo $action ?>" id="group-search-form" method="post">
    494                 <label for="<?php echo $name ?>" id="<?php echo $name ?>-label"><?php echo $label ?> <img id="ajax-loader" src="<?php echo $bp['groups']['image_base'] ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /></label>
     494                <label for="<?php echo $name ?>" id="<?php echo $name ?>-label"><?php echo $label ?> <img id="ajax-loader" src="<?php echo $bp->groups->image_base ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /></label>
    495495                <input type="search" name="<?php echo $name ?>" id="<?php echo $name ?>" value="<?php echo $value ?>"<?php echo $disabled ?> />
    496496                <?php if ( function_exists('wp_nonce_field') )
    … …  
    504504        global $bp;
    505505       
    506         if ( !groups_total_groups_for_user( $bp['current_userid'] ) )
     506        if ( !groups_total_groups_for_user( $bp->displayed_user->id ) )
    507507                return true;
    508508               
    … …  
    715715        global $bp, $groups_template;
    716716       
    717         $current_tab = $bp['action_variables'][0];
     717        $current_tab = $bp->action_variables[0];
    718718?>
    719         <?php if ( $bp['is_item_admin'] || $bp['is_item_mod'] ) { ?>
    720                 <li<?php if ( $current_tab == 'edit-details' || $current_tab == '' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['root_domain'] . '/' . $bp['groups']['slug'] ?>/<?php echo $groups_template->group->slug ?>/admin/edit-details"><?php _e('Edit Details', 'buddypress') ?></a></li>
     719        <?php if ( $bp->is_item_admin || $bp->is_item_mod ) { ?>
     720                <li<?php if ( $current_tab == 'edit-details' || empty( $current_tab ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug ?>/<?php echo $groups_template->group->slug ?>/admin/edit-details"><?php _e('Edit Details', 'buddypress') ?></a></li>
    721721        <?php } ?>
    722722
    723         <?php if ( $bp['is_item_admin'] ) { ?> 
    724                 <li<?php if ( $current_tab == 'group-settings' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['root_domain'] . '/' . $bp['groups']['slug'] ?>/<?php echo $groups_template->group->slug ?>/admin/group-settings"><?php _e('Group Settings', 'buddypress') ?></a></li>
     723        <?php if ( $bp->is_item_admin ) { ?>   
     724                <li<?php if ( $current_tab == 'group-settings' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug ?>/<?php echo $groups_template->group->slug ?>/admin/group-settings"><?php _e('Group Settings', 'buddypress') ?></a></li>
    725725        <?php } ?>
    726726       
    727         <?php if ( $bp['is_item_admin'] ) { ?> 
    728                 <li<?php if ( $current_tab == 'group-avatar' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['root_domain'] . '/' . $bp['groups']['slug'] ?>/<?php echo $groups_template->group->slug ?>/admin/group-avatar"><?php _e('Group Avatar', 'buddypress') ?></a></li>
     727        <?php if ( $bp->is_item_admin ) { ?>   
     728                <li<?php if ( $current_tab == 'group-avatar' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug ?>/<?php echo $groups_template->group->slug ?>/admin/group-avatar"><?php _e('Group Avatar', 'buddypress') ?></a></li>
    729729        <?php } ?>
    730730
    731         <?php if ( $bp['is_item_admin'] ) { ?>                 
    732                 <li<?php if ( $current_tab == 'manage-members' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['root_domain'] . '/' . $bp['groups']['slug'] ?>/<?php echo $groups_template->group->slug ?>/admin/manage-members"><?php _e('Manage Members', 'buddypress') ?></a></li>
     731        <?php if ( $bp->is_item_admin ) { ?>                   
     732                <li<?php if ( $current_tab == 'manage-members' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug ?>/<?php echo $groups_template->group->slug ?>/admin/manage-members"><?php _e('Manage Members', 'buddypress') ?></a></li>
    733733        <?php } ?>
    734734       
    735         <?php if ( $bp['is_item_admin'] && $groups_template->group->status == 'private' ) : ?>
    736         <li<?php if ( $current_tab == 'membership-requests' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['root_domain'] . '/' . $bp['groups']['slug'] ?>/<?php echo $groups_template->group->slug ?>/admin/membership-requests"><?php _e('Membership Requests', 'buddypress') ?></a></li>
     735        <?php if ( $bp->is_item_admin && $groups_template->group->status == 'private' ) : ?>
     736        <li<?php if ( $current_tab == 'membership-requests' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug ?>/<?php echo $groups_template->group->slug ?>/admin/membership-requests"><?php _e('Membership Requests', 'buddypress') ?></a></li>
    737737        <?php endif; ?>
    738738
    739         <?php if ( $bp['is_item_admin'] ) { ?>         
    740                 <li<?php if ( $current_tab == 'delete-group' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['root_domain'] . '/' . $bp['groups']['slug'] ?>/<?php echo $groups_template->group->slug ?>/admin/delete-group"><?php _e('Delete Group', 'buddypress') ?></a></li>
     739        <?php if ( $bp->is_item_admin ) { ?>           
     740                <li<?php if ( $current_tab == 'delete-group' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug ?>/<?php echo $groups_template->group->slug ?>/admin/delete-group"><?php _e('Delete Group', 'buddypress') ?></a></li>
    741741        <?php } ?>
    742742       
    … …  
    763763                $group = $groups_template->group;
    764764       
    765         if ( groups_check_for_membership_request( $bp['loggedin_userid'], $group->id ) )
     765        if ( groups_check_for_membership_request( $bp->loggedin_user->id, $group->id ) )
    766766                return true;
    767767       
    … …  
    772772        global $bp, $create_group_step, $completed_to_step;
    773773?>
    774         <li<?php if ( $create_group_step == '1' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['current_domain'] . $bp['groups']['slug'] ?>/create/step/1">1. <?php _e('Group Details', 'buddypress') ?></a></li>
    775         <li<?php if ( $create_group_step == '2' ) : ?> class="current"<?php endif; ?>><?php if ( $completed_to_step > 0 ) { ?><a href="<?php echo $bp['current_domain'] . $bp['groups']['slug'] ?>/create/step/2">2. <?php _e('Group Settings', 'buddypress') ?></a><?php } else { ?><span>2. <?php _e('Group Settings', 'buddypress') ?></span><?php } ?></li>
    776         <li<?php if ( $create_group_step == '3' ) : ?> class="current"<?php endif; ?>><?php if ( $completed_to_step > 1 ) { ?><a href="<?php echo $bp['current_domain'] . $bp['groups']['slug'] ?>/create/step/3">3. <?php _e('Group Avatar', 'buddypress') ?></a><?php } else { ?><span>3. <?php _e('Group Avatar', 'buddypress') ?></span><?php } ?></li>
    777         <li<?php if ( $create_group_step == '4' ) : ?> class="current"<?php endif; ?>><?php if ( $completed_to_step > 2 ) { ?><a href="<?php echo $bp['current_domain'] . $bp['groups']['slug'] ?>/create/step/4">4. <?php _e('Invite Members', 'buddypress') ?></a><?php } else { ?><span>4. <?php _e('Invite Members', 'buddypress') ?></span><?php } ?></li>
     774        <li<?php if ( $create_group_step == '1' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/create/step/1">1. <?php _e('Group Details', 'buddypress') ?></a></li>
     775        <li<?php if ( $create_group_step == '2' ) : ?> class="current"<?php endif; ?>><?php if ( $completed_to_step > 0 ) { ?><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/create/step/2">2. <?php _e('Group Settings', 'buddypress') ?></a><?php } else { ?><span>2. <?php _e('Group Settings', 'buddypress') ?></span><?php } ?></li>
     776        <li<?php if ( $create_group_step == '3' ) : ?> class="current"<?php endif; ?>><?php if ( $completed_to_step > 1 ) { ?><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/create/step/3">3. <?php _e('Group Avatar', 'buddypress') ?></a><?php } else { ?><span>3. <?php _e('Group Avatar', 'buddypress') ?></span><?php } ?></li>
     777        <li<?php if ( $create_group_step == '4' ) : ?> class="current"<?php endif; ?>><?php if ( $completed_to_step > 2 ) { ?><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/create/step/4">4. <?php _e('Invite Members', 'buddypress') ?></a><?php } else { ?><span>4. <?php _e('Invite Members', 'buddypress') ?></span><?php } ?></li>
    778778<?php
    779779        do_action( 'groups_creation_tabs' );
    … …  
    807807
    808808?>
    809         <form action="<?php echo $bp['current_domain'] . $bp['groups']['slug'] ?>/create/step/<?php echo $create_group_step ?>" method="post" id="create-group-form" class="standard-form" enctype="multipart/form-data">
     809        <form action="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/create/step/<?php echo $create_group_step ?>" method="post" id="create-group-form" class="standard-form" enctype="multipart/form-data">
    810810        <?php switch( $create_group_step ) {
    811811                case '1': ?>
    … …  
    907907                               
    908908                                if ( function_exists('friends_install') ) {
    909                                         if ( friends_get_friend_count_for_user( $bp['loggedin_userid'] ) ) {
     909                                        if ( friends_get_friend_count_for_user( $bp->loggedin_user->id ) ) {
    910910                                                bp_group_send_invite_form( $group_obj );
    911911                                        } else {
    … …  
    936936                return false;
    937937
    938                 $friends = friends_get_friends_invite_list( $bp['loggedin_userid'], $group_obj->id );
     938                $friends = friends_get_friends_invite_list( $bp->loggedin_user->id, $group_obj->id );
    939939
    940940                if ( $friends ) {
    941                         $invites = groups_get_invites_for_group( $bp['loggedin_userid'], $group_obj->id );
     941                        $invites = groups_get_invites_for_group( $bp->loggedin_user->id, $group_obj->id );
    942942
    943943        ?>
    … …  
    968968        global $bp, $create_group_step, $completed_to_step;
    969969?>
    970         <li<?php if ( !isset($bp['action_variables'][0]) || $bp['action_variables'][0] == 'recently-active' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['current_domain'] . $bp['groups']['slug'] ?>/my-groups/recently-active"><?php _e( 'Recently Active', 'buddypress' ) ?></a></li>
    971         <li<?php if ( $bp['action_variables'][0] == 'recently-joined' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['current_domain'] . $bp['groups']['slug'] ?>/my-groups/recently-joined"><?php _e( 'Recently Joined', 'buddypress' ) ?></a></li>
    972         <li<?php if ( $bp['action_variables'][0] == 'most-popular' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['current_domain'] . $bp['groups']['slug'] ?>/my-groups/most-popular""><?php _e( 'Most Popular', 'buddypress' ) ?></a></li>
    973         <li<?php if ( $bp['action_variables'][0] == 'admin-of' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['current_domain'] . $bp['groups']['slug'] ?>/my-groups/admin-of""><?php _e( 'Administrator Of', 'buddypress' ) ?></a></li>
    974         <li<?php if ( $bp['action_variables'][0] == 'mod-of' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['current_domain'] . $bp['groups']['slug'] ?>/my-groups/mod-of""><?php _e( 'Moderator Of', 'buddypress' ) ?></a></li>
    975         <li<?php if ( $bp['action_variables'][0] == 'alphabetically' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['current_domain'] . $bp['groups']['slug'] ?>/my-groups/alphabetically""><?php _e( 'Alphabetically', 'buddypress' ) ?></a></li>
     970        <li<?php if ( !isset($bp->action_variables[0]) || $bp->action_variables[0] == 'recently-active' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/my-groups/recently-active"><?php _e( 'Recently Active', 'buddypress' ) ?></a></li>
     971        <li<?php if ( $bp->action_variables[0] == 'recently-joined' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/my-groups/recently-joined"><?php _e( 'Recently Joined', 'buddypress' ) ?></a></li>
     972        <li<?php if ( $bp->action_variables[0] == 'most-popular' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/my-groups/most-popular""><?php _e( 'Most Popular', 'buddypress' ) ?></a></li>
     973        <li<?php if ( $bp->action_variables[0] == 'admin-of' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/my-groups/admin-of""><?php _e( 'Administrator Of', 'buddypress' ) ?></a></li>
     974        <li<?php if ( $bp->action_variables[0] == 'mod-of' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/my-groups/mod-of""><?php _e( 'Moderator Of', 'buddypress' ) ?></a></li>
     975        <li<?php if ( $bp->action_variables[0] == 'alphabetically' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/my-groups/alphabetically""><?php _e( 'Alphabetically', 'buddypress' ) ?></a></li>
    976976               
    977977<?php
    … …  
    982982        global $bp;
    983983       
    984         $current_filter = $bp['action_variables'][0];
     984        $current_filter = $bp->action_variables[0];
    985985       
    986986        switch ( $current_filter ) {
    … …  
    10091009        global $bp, $groups_template;
    10101010       
    1011         if ( groups_is_user_member( $bp['loggedin_userid'], $groups_template->group->id ) )
     1011        if ( groups_is_user_member( $bp->loggedin_user->id, $groups_template->group->id ) )
    10121012                return true;
    10131013       
    … …  
    10181018        global $groups_template, $bp;
    10191019       
    1020         echo apply_filters( 'bp_group_accept_invite_link', $bp['loggedin_domain'] . $bp['groups']['slug'] . '/invites/accept/' . $groups_template->group->id );
     1020        echo apply_filters( 'bp_group_accept_invite_link', $bp->loggedin_user->domain . $bp->groups->slug . '/invites/accept/' . $groups_template->group->id );
    10211021}
    10221022
    … …  
    10241024        global $groups_template, $bp;
    10251025       
    1026         echo apply_filters( 'bp_group_reject_invite_link', $bp['loggedin_domain'] . $bp['groups']['slug'] . '/invites/reject/' . $groups_template->group->id );
     1026        echo apply_filters( 'bp_group_reject_invite_link', $bp->loggedin_user->domain . $bp->groups->slug . '/invites/reject/' . $groups_template->group->id );
    10271027}
    10281028
    … …  
    10331033                return false;
    10341034       
    1035         if ( !friends_check_user_has_friends( $bp['loggedin_userid'] ) || !friends_count_invitable_friends( $bp['loggedin_userid'], $groups_template->group->id ) )
     1035        if ( !friends_check_user_has_friends( $bp->loggedin_user->id ) || !friends_count_invitable_friends( $bp->loggedin_user->id, $groups_template->group->id ) )
    10361036                return false;
    10371037       
    … …  
    10581058?>
    10591059        <div class="left-menu">
    1060                 <h4><?php _e( 'Select Friends', 'buddypress' ) ?> <img id="ajax-loader" src="<?php echo $bp['groups']['image_base'] ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /></h4>
     1060                <h4><?php _e( 'Select Friends', 'buddypress' ) ?> <img id="ajax-loader" src="<?php echo $bp->groups->image_base ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /></h4>
    10611061                <?php bp_group_list_invite_friends() ?>
    10621062                <?php wp_nonce_field( 'invite_user' ) ?>
    … …  
    10701070                </div>
    10711071
    1072                 <?php $invites = groups_get_invites_for_group( $bp['loggedin_userid'], $group_obj->id ) ?>
     1072                <?php $invites = groups_get_invites_for_group( $bp->loggedin_user->id, $group_obj->id ) ?>
    10731073               
    10741074                <ul id="friend-list" class="item-list">
    … …  
    10811081                                        <span class="activity"><?php echo $user->last_active ?></span>
    10821082                                        <div class="action">
    1083                                                 <a class="remove" href="<?php echo site_url() . $bp['groups']['slug'] . '/' . $group_obj->id . '/invites/remove/' . $user->id ?>" id="uid-<?php echo $user->id ?>"><?php _e( 'Remove Invite', 'buddypress' ) ?></a>
     1083                                                <a class="remove" href="<?php echo site_url() . $bp->groups->slug . '/' . $group_obj->id . '/invites/remove/' . $user->id ?>" id="uid-<?php echo $user->id ?>"><?php _e( 'Remove Invite', 'buddypress' ) ?></a>
    10841084                                        </div>
    10851085                                </li>
    … …  
    10971097                <img src="<?php echo $group_obj->avatar_full ?>" alt="Group Avatar" class="avatar" />
    10981098        <?php } else { ?>
    1099                 <img src="<?php echo $bp['groups']['image_base'] . '/none.gif' ?>" alt="No Group Avatar" class="avatar" />
     1099                <img src="<?php echo $bp->groups->image_base . '/none.gif' ?>" alt="No Group Avatar" class="avatar" />
    11001100        <?php }
    11011101}
    … …  
    11221122       
    11231123        // If they're not logged in or are banned from the group, no join button.
    1124         if ( !is_user_logged_in() || groups_is_user_banned( $bp['loggedin_userid'], $group->id ) )
     1124        if ( !is_user_logged_in() || groups_is_user_banned( $bp->loggedin_user->id, $group->id ) )
    11251125                return false;
    11261126       
    … …  
    11291129        switch ( $group->status ) {
    11301130                case 'public':
    1131                         if ( BP_Groups_Member::check_is_member( $bp['loggedin_userid'], $group->id ) )
     1131                        if ( BP_Groups_Member::check_is_member( $bp->loggedin_user->id, $group->id ) )
    11321132                                echo '<a class="leave-group" href="' . bp_group_permalink( $group, false ) . '/leave-group">' . __('Leave Group', 'buddypress') . '</a>';                                                                       
    11331133                        else
    … …  
    11361136               
    11371137                case 'private':
    1138                         if ( BP_Groups_Member::check_is_member( $bp['loggedin_userid'], $group->id ) ) {
     1138                        if ( BP_Groups_Member::check_is_member( $bp->loggedin_user->id, $group->id ) ) {
    11391139                                echo '<a class="leave-group" href="' . bp_group_permalink( $group, false ) . '/leave-group">' . __('Leave Group', 'buddypress') . '</a>';                                                                               
    11401140                        } else {
    … …  
    12141214        global $bp;
    12151215       
    1216         $group_ids = BP_Groups_Member::get_random_groups( $bp['current_userid'] );
     1216        $group_ids = BP_Groups_Member::get_random_groups( $bp->displayed_user->id );
    12171217?>     
    12181218        <div class="info-group">
    1219                 <h4><?php bp_word_or_name( __( "My Groups", 'buddypress' ), __( "%s's Groups", 'buddypress' ) ) ?> (<?php echo BP_Groups_Member::total_group_count() ?>) <a href="<?php echo $bp['current_domain'] . $bp['groups']['slug'] ?>"><?php _e('See All', 'buddypress') ?> &raquo;</a></h4>
     1219                <h4><?php bp_word_or_name( __( "My Groups", 'buddypress' ), __( "%s's Groups", 'buddypress' ) ) ?> (<?php echo BP_Groups_Member::total_group_count() ?>) <a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>"><?php _e('See All', 'buddypress') ?> &raquo;</a></h4>
    12201220                <?php if ( $group_ids ) { ?>
    12211221                        <ul class="horiz-gallery">
    … …  
    14111411        global $bp;
    14121412       
    1413         if ( $bp['current_action'] == 'group-finder' )
     1413        if ( $bp->current_action == 'group-finder' )
    14141414                echo apply_filters( 'bp_group_reject_invite_link', 'groupfinder-pag' );
    14151415        else
  • trunk/bp-groups/bp-groups-widgets.php

    r805 r1021  
    3333        <?php if ( $groups['groups'] ) : ?>
    3434                <div class="item-options" id="groups-list-options">
    35                         <img id="ajax-loader-groups" src="<?php echo $bp['groups']['image_base'] ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /> &nbsp;
     35                        <img id="ajax-loader-groups" src="<?php echo $bp->groups->image_base ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /> &nbsp;
    3636                        <a href="<?php echo site_url() . '/groups' ?>" id="newest-groups"><?php _e("Newest", 'buddypress') ?></a> |
    3737                        <a href="<?php echo site_url() . '/groups' ?>" id="recently-active-groups"><?php _e("Active", 'buddypress') ?></a> |
  • trunk/bp-groups/directories/bp-groups-directory-groups.php

    r897 r1021  
    33        global $bp, $current_blog;
    44       
    5         if ( $bp['current_component'] == $bp['groups']['slug'] && $bp['current_action'] == '' ) {
     5        if ( $bp->current_component == $bp->groups->slug && empty( $bp->current_action ) ) {
    66                add_action( 'bp_template_content', 'groups_directory_groups_content' );
    77                add_action( 'bp_template_sidebar', 'groups_directory_groups_sidebar' );
    … …  
    8888                        <div id="group-dir-count" class="pag-count">
    8989                                <?php echo sprintf( __( 'Viewing group %d to %d (%d total active groups)', 'buddypress' ), $from_num, $to_num, $groups['total'] ); ?> &nbsp;
    90                                 <img id="ajax-loader-groups" src="<?php echo $bp['core']['image_base'] ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" />
     90                                <img id="ajax-loader-groups" src="<?php echo $bp->core->image_base ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" />
    9191                        </div>
    9292                       
    … …  
    156156        <div class="widget">
    157157                <h2 class="widgettitle"><?php _e( 'Find Groups', 'buddypress' ) ?></h2>
    158                 <form action="<?php echo site_url() . '/' . $bp['groups']['slug']  . '/search/' ?>" method="post" id="search-groups-form">
     158                <form action="<?php echo site_url() . '/' . $bp->groups->slug  . '/search/' ?>" method="post" id="search-groups-form">
    159159                        <label><input type="text" name="groups_search" id="groups_search" value="<?php if ( isset( $_GET['s'] ) ) { echo $_GET['s']; } else { _e('Search anything...', 'buddypress' ); } ?>"  onfocus="if (this.value == '<?php _e('Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e('Search anything...', 'buddypress' ) ?>';}" /></label>
    160160                        <input type="submit" id="groups_search_submit" name="groups_search_submit" value="Search" />
  • trunk/bp-messages.php

    r1017 r1021  
    2929               
    3030        // Remove indexes so we can alter the field types for these fields.
    31         $wpdb->query( "ALTER TABLE ". $bp['messages']['table_name_threads'] . " DROP INDEX message_ids " );
    32         $wpdb->query( "ALTER TABLE ". $bp['messages']['table_name_threads'] . " DROP INDEX sender_ids " );
    33        
    34         $sql[] = "CREATE TABLE ". $bp['messages']['table_name_threads'] ." (
     31        $wpdb->query( "ALTER TABLE {$bp->messages->table_name_threads} DROP INDEX message_ids " );
     32        $wpdb->query( "ALTER TABLE {$bp->messages->table_name_threads} DROP INDEX sender_ids " );
     33       
     34        $sql[] = "CREATE TABLE {$bp->messages->table_name_threads} (
    3535                                id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    3636                                message_ids longtext NOT NULL,
    … …  
    4444                           ) {$charset_collate};";
    4545       
    46         $sql[] = "CREATE TABLE ". $bp['messages']['table_name_recipients'] ." (
     46        $sql[] = "CREATE TABLE {$bp->messages->table_name_recipients} (
    4747                                id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    4848                                user_id int(11) NOT NULL,
    … …  
    5858                           ) {$charset_collate};";
    5959
    60         $sql[] = "CREATE TABLE ". $bp['messages']['table_name_messages'] ." (
     60        $sql[] = "CREATE TABLE {$bp->messages->table_name_messages} (
    6161                                id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    6262                                sender_id int(11) NOT NULL,
    … …  
    7171                           ) {$charset_collate};";
    7272       
    73         $sql[] = "CREATE TABLE ". $bp['messages']['table_name_notices'] ." (
     73        $sql[] = "CREATE TABLE {$bp->messages->table_name_notices} (
    7474                                id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    7575                                subject varchar(200) NOT NULL,
    … …  
    9797        global $bp, $wpdb;
    9898       
    99         $bp['messages'] = array(
    100                 'table_name'                   => $wpdb->base_prefix . 'bp_messages',
    101                 'table_name_threads'       => $wpdb->base_prefix . 'bp_messages_threads',
    102                 'table_name_messages'      => $wpdb->base_prefix . 'bp_messages_messages',
    103                 'table_name_recipients'    => $wpdb->base_prefix . 'bp_messages_recipients',
    104                 'table_name_notices'       => $wpdb->base_prefix . 'bp_messages_notices',
    105                 'format_activity_function' => 'messages_format_activity',
    106                 'image_base'                       => site_url( MUPLUGINDIR . '/bp-messages/images' ),
    107                 'slug'                                     => BP_MESSAGES_SLUG
    108         );
    109 
    110         $bp['version_numbers'][$bp['messages']['slug']] = BP_MESSAGES_VERSION;
     99        $bp->messages->table_name_threads = $wpdb->base_prefix . 'bp_messages_threads';
     100        $bp->messages->table_name_messages = $wpdb->base_prefix . 'bp_messages_messages';
     101        $bp->messages->table_name_recipients = $wpdb->base_prefix . 'bp_messages_recipients';
     102        $bp->messages->table_name_notices = $wpdb->base_prefix . 'bp_messages_notices';
     103        $bp->messages->format_activity_function = 'messages_format_activity';
     104        $bp->messages->image_base = site_url( MUPLUGINDIR . '/bp-messages/images' );
     105        $bp->messages->slug = BP_MESSAGES_SLUG;
     106
     107        $bp->version_numbers->messages = BP_MESSAGES_VERSION;
    111108}
    112109add_action( 'wp', 'messages_setup_globals', 1 );       
    … …  
    126123        if ( is_site_admin() ) {
    127124                /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    128                 if ( ( $wpdb->get_var( "SHOW TABLES LIKE '%" . $bp['messages']['table_name'] . "%'" ) == false ) || ( get_site_option('bp-messages-db-version') < BP_MESSAGES_DB_VERSION ) )
     125                if ( ( $wpdb->get_var( "SHOW TABLES LIKE '%{$bp->messages->table_name_messages}%'" ) == false ) || ( get_site_option('bp-messages-db-version') < BP_MESSAGES_DB_VERSION ) )
    129126                        messages_install();
    130127        }
    … …  
    146143       
    147144        /* Add 'Profile' to the main navigation */
    148         bp_core_add_nav_item( __('Messages', 'buddypress'), $bp['messages']['slug'], false, false );
    149         bp_core_add_nav_default( $bp['messages']['slug'], 'messages_screen_inbox', 'inbox', bp_is_home() );
    150        
    151         $messages_link = $bp['loggedin_domain'] . $bp['messages']['slug'] . '/';
     145        bp_core_add_nav_item( __('Messages', 'buddypress'), $bp->messages->slug, false, false );
     146        bp_core_add_nav_default( $bp->messages->slug, 'messages_screen_inbox', 'inbox', bp_is_home() );
     147       
     148        $messages_link = $bp->loggedin_user->domain . $bp->messages->slug . '/';
    152149       
    153150        /* Add the subnav items to the profile */
    154         bp_core_add_subnav_item( $bp['messages']['slug'], 'inbox', __('Inbox', 'buddypress') . $count_indicator, $messages_link, 'messages_screen_inbox', false, bp_is_home() );
    155         bp_core_add_subnav_item( $bp['messages']['slug'], 'sentbox', __('Sent Messages', 'buddypress'), $messages_link, 'messages_screen_sentbox', false, bp_is_home() );
    156         bp_core_add_subnav_item( $bp['messages']['slug'], 'compose', __('Compose', 'buddypress'), $messages_link, 'messages_screen_compose', false, bp_is_home() );
    157         bp_core_add_subnav_item( $bp['messages']['slug'], 'notices', __('Notices', 'buddypress'), $messages_link, 'messages_screen_notices', false, true, true );
    158 
    159         if ( $bp['current_component'] == $bp['messages']['slug'] ) {
     151        bp_core_add_subnav_item( $bp->messages->slug, 'inbox', __('Inbox', 'buddypress') . $count_indicator, $messages_link, 'messages_screen_inbox', false, bp_is_home() );
     152        bp_core_add_subnav_item( $bp->messages->slug, 'sentbox', __('Sent Messages', 'buddypress'), $messages_link, 'messages_screen_sentbox', false, bp_is_home() );
     153        bp_core_add_subnav_item( $bp->messages->slug, 'compose', __('Compose', 'buddypress'), $messages_link, 'messages_screen_compose', false, bp_is_home() );
     154        bp_core_add_subnav_item( $bp->messages->slug, 'notices', __('Notices', 'buddypress'), $messages_link, 'messages_screen_notices', false, true, true );
     155
     156        if ( $bp->current_component == $bp->messages->slug ) {
    160157                if ( bp_is_home() ) {
    161                         $bp['bp_options_title'] = __('My Messages', 'buddypress');                     
    162                 } else {
    163                         $bp_options_avatar = bp_core_get_avatar( $bp['current_userid'], 1 );
    164                         $bp['bp_options_title'] = $bp['current_fullname'];
     158                        $bp->bp_options_title = __( 'My Messages', 'buddypress' );                     
     159                } else {
     160                        $bp_options_avatar = bp_core_get_avatar( $bp->displayed_user->id, 1 );
     161                        $bp->bp_options_title = $bp->displayed_user->fullname;
    165162                }
    166163        }
    … …  
    214211                return false;
    215212               
    216         $notice_id = $bp['action_variables'][1];
     213        $notice_id = $bp->action_variables[1];
    217214
    218215        if ( $notice_id && is_numeric($notice_id) ) {
    219216                $notice = new BP_Messages_Notice($notice_id);
    220217
    221                 if ( $bp['action_variables'][0] == 'deactivate' ) {
     218                if ( $bp->action_variables[0] == 'deactivate' ) {
    222219                        if ( !$notice->deactivate() ) {
    223220                                bp_core_add_message( __('There was a problem deactivating that notice.', 'buddypress'), 'error' );     
    … …  
    225222                                bp_core_add_message( __('Notice deactivated.', 'buddypress') );
    226223                        }
    227                 } else if ( $bp['action_variables'][0] == 'activate' ) {
     224                } else if ( $bp->action_variables[0] == 'activate' ) {
    228225                        if ( !$notice->activate() ) {
    229226                                bp_core_add_message( __('There was a problem activating that notice.', 'buddypress'), 'error' );
    … …  
    231228                                bp_core_add_message( __('Notice activated.', 'buddypress') );
    232229                        }
    233                 } else if ( $bp['action_variables'][0] == 'delete' ) {
     230                } else if ( $bp->action_variables[0] == 'delete' ) {
    234231                        if ( !$notice->delete() ) {
    235232                                bp_core_add_message( __('There was a problem deleting that notice.', 'buddypress'), 'buddypress' );
    … …  
    238235                        }
    239236                }
    240                 bp_core_redirect( $bp['loggedin_domain'] . $bp['messages']['slug'] . '/notices' );
     237                bp_core_redirect( $bp->loggedin_user->domain . $bp->messages->slug . '/notices' );
    241238        }
    242239       
    … …  
    279276        global $bp, $thread_id;
    280277       
    281         if ( $bp['current_component'] != $bp['messages']['slug'] || $bp['current_action'] != 'view' )
     278        if ( $bp->current_component != $bp->messages->slug || $bp->current_action != 'view' )
    282279                return false;
    283280               
    284         $thread_id = $bp['action_variables'][0];
     281        $thread_id = $bp->action_variables[0];
    285282
    286283        if ( !$thread_id || !is_numeric($thread_id) || !BP_Messages_Thread::check_access($thread_id) ) {
    287                 bp_core_redirect( $bp['current_domain'] . $bp['current_component'] );
    288         } else {
    289                 $bp['bp_options_nav'][$bp['messages']['slug']]['view'] = array(
     284                bp_core_redirect( $bp->displayed_user->domain . $bp->current_component );
     285        } else {
     286                $bp->bp_options_nav[$bp->messages->slug]['view'] = array(
    290287                        'name' => __('From: ' . BP_Messages_Thread::get_last_sender($thread_id), 'buddypress'),
    291                         'link' => $bp['loggedin_domain'] . $bp['messages']['slug'] . '/'                       
     288                        'link' => $bp->loggedin_user->domain . $bp->messages->slug . '/'                       
    292289                );
    293290
    … …  
    301298        global $bp, $thread_id;
    302299       
    303         if ( $bp['current_component'] != $bp['messages']['slug'] || $bp['action_variables'][0] != 'delete' )
     300        if ( $bp->current_component != $bp->messages->slug || $bp->action_variables[0] != 'delete' )
    304301                return false;
    305302       
    306         $thread_id = $bp['action_variables'][1];
     303        $thread_id = $bp->action_variables[1];
    307304
    308305        if ( !$thread_id || !is_numeric($thread_id) || !BP_Messages_Thread::check_access($thread_id) ) {
    309                 bp_core_redirect( $bp['current_domain'] . $bp['current_component'] . '/' . $bp['current_action'] );
    310         } else {
    311                 //echo $bp['loggedin_domain'] . $bp['current_component'] . '/' . $bp['current_action']; die;
     306                bp_core_redirect( $bp->displayed_user->domain . $bp->current_component . '/' . $bp->current_action );
     307        } else {
     308                //echo $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action; die;
    312309                // delete message
    313310                if ( !messages_delete_thread($thread_id) ) {
    … …  
    316313                        bp_core_add_message( __('Message deleted.', 'buddypress') );
    317314                }
    318                 bp_core_redirect( $bp['loggedin_domain'] . $bp['current_component'] . '/' . $bp['current_action'] );
     315                bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action );
    319316        }
    320317}
    … …  
    325322        global $bp, $thread_ids;
    326323       
    327         if ( $bp['current_component'] != $bp['messages']['slug'] || $bp['action_variables'][0] != 'bulk-delete' )
     324        if ( $bp->current_component != $bp->messages->slug || $bp->action_variables[0] != 'bulk-delete' )
    328325                return false;
    329326       
    … …  
    331328
    332329        if ( !$thread_ids || !BP_Messages_Thread::check_access($thread_ids) ) {
    333                 bp_core_redirect( $bp['current_domain'] . $bp['current_component'] . '/' . $bp['current_action'] );                     
     330                bp_core_redirect( $bp->displayed_user->domain . $bp->current_component . '/' . $bp->current_action );                   
    334331        } else {
    335332                if ( !messages_delete_thread( $thread_ids ) ) {
    … …  
    338335                        bp_core_add_message( __('Messages deleted.', 'buddypress') );
    339336                }
    340                 bp_core_redirect( $bp['loggedin_domain'] . $bp['current_component'] . '/' . $bp['current_action'] );
     337                bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action );
    341338        }
    342339}
    … …  
    370367        if ( $action == 'new_message') {
    371368                if ( (int)$total_items > 1 )
    372                         return apply_filters( 'bp_messages_multiple_new_message_notification', '<a href="' . $bp['loggedin_domain'] . $bp['messages']['slug'] . '/inbox" title="Inbox">' . sprintf( __('You have %d new messages'), (int)$total_items ) . '</a>', $total_items );               
     369                        return apply_filters( 'bp_messages_multiple_new_message_notification', '<a href="' . $bp->loggedin_user->domain . $bp->messages->slug . '/inbox" title="Inbox">' . sprintf( __('You have %d new messages'), (int)$total_items ) . '</a>', $total_items );               
    373370                else
    374                         return apply_filters( 'bp_messages_single_new_message_notification', '<a href="' . $bp['loggedin_domain'] . $bp['messages']['slug'] . '/inbox" title="Inbox">' . sprintf( __('You have %d new message'), (int)$total_items ) . '</a>', $total_items );
     371                        return apply_filters( 'bp_messages_single_new_message_notification', '<a href="' . $bp->loggedin_user->domain . $bp->messages->slug . '/inbox" title="Inbox">' . sprintf( __('You have %d new message'), (int)$total_items ) . '</a>', $total_items );
    375372        }
    376373       
    … …  
    400397                        bp_core_add_message( __('There was an error posting that notice.', 'buddypress'), 'error' );                   
    401398                }
    402                 bp_core_redirect( $bp['loggedin_domain'] . $bp['current_component'] . '/notices' );
     399                bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/notices' );
    403400                return true;
    404401        }
    … …  
    410407                if ( !$from_ajax ) {   
    411408                        bp_core_add_message( __('Please enter at least one valid user to send this message to.', 'buddypress'), 'error' );
    412                         bp_core_redirect( $bp['loggedin_domain'] . $bp['current_component'] . '/compose' );
     409                        bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/compose' );
    413410                } else {
    414411                        return array('status' => 0, 'message' => __('There was an error sending the reply, please try again.', 'buddypress'));
    … …  
    418415        } else if ( count( $recipients ) == 1 && $recipients[0] == $current_user->user_login ) {
    419416                bp_core_add_message( __('You must send your message to one or more users not including yourself.', 'buddypress'), 'error' );
    420                 bp_core_redirect( $bp['loggedin_domain'] . $bp['current_component'] . '/compose' );     
     417                bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/compose' );   
    421418       
    422419        // If the subject or content boxes are empty.
    … …  
    424421                if ( !$from_ajax ) {
    425422                        bp_core_add_message( __('Please make sure you fill in all the fields.', 'buddypress'), 'error' );
    426                         bp_core_redirect( $bp['loggedin_domain'] . $bp['current_component'] . '/compose' );
     423                        bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/compose' );
    427424                } else {
    428425                        return array('status' => 0, 'message' => __('Please make sure you have typed a message before sending a reply.', 'buddypress'));
    … …  
    438435                $pmessage = new BP_Messages_Message;
    439436
    440                 $pmessage->sender_id = $bp['loggedin_userid'];
     437                $pmessage->sender_id = $bp->loggedin_user->id;
    441438                $pmessage->subject = $subject;
    442439                $pmessage->message = $content;
    … …  
    462459                                } else {
    463460                                        bp_core_add_message( $message, $type );
    464                                         bp_core_redirect( $bp['loggedin_domain'] . $bp['current_component'] . '/compose' );
     461                                        bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/compose' );
    465462                                }
    466463                        } else {
    467                                 $message = __('Message sent successfully!', 'buddypress') . ' <a href="' . $bp['loggedin_domain'] . $bp['messages']['slug'] . '/view/' . $pmessage->thread_id . '">' . __('View Message', 'buddypress') . '</a> &raquo;';
     464                                $message = __('Message sent successfully!', 'buddypress') . ' <a href="' . $bp->loggedin_user->domain . $bp->messages->slug . '/view/' . $pmessage->thread_id . '">' . __('View Message', 'buddypress') . '</a> &raquo;';
    468465                                $type = 'success';
    469466                               
    470467                                // Send notices to the recipients
    471468                                for ( $i = 0; $i < count($pmessage->recipients); $i++ ) {
    472                                         if ( $pmessage->recipients[$i] != $bp['loggedin_userid'] ) {
     469                                        if ( $pmessage->recipients[$i] != $bp->loggedin_user->id ) {
    473470                                                bp_core_add_notification( $pmessage->id, $pmessage->recipients[$i], 'messages', 'new_message' );       
    474471                                        }
    … …  
    481478                                } else {
    482479                                        bp_core_add_message( $message );
    483                                         bp_core_redirect( $bp['loggedin_domain'] . $bp['current_component'] . '/inbox' );
     480                                        bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/inbox' );
    484481                                }
    485482                        }
    … …  
    492489                        } else {
    493490                                bp_core_add_message( $message, $type );
    494                                 bp_core_redirect( $bp['loggedin_domain'] . $bp['messages']['slug'] . '/compose' );
     491                                bp_core_redirect( $bp->loggedin_user->domain . $bp->messages->slug . '/compose' );
    495492                        }
    496493                }
    … …  
    601598                                                <tr>
    602599                                                        <td>
    603                                                                 <img src="<?php echo $bp['messages']['image_base'] ?>/email_open.gif" alt="Message" style="vertical-align: top;" /> &nbsp;
     600                                                                <img src="<?php echo $bp->messages->image_base ?>/email_open.gif" alt="Message" style="vertical-align: top;" /> &nbsp;
    604601                                                                <?php _e('Sent between ', 'buddypress') ?> <?php echo BP_Messages_Thread::get_recipient_links($thread->recipients) ?>
    605                                                                 <?php _e('and', 'buddypress') ?> <?php echo bp_core_get_userlink($bp['loggedin_userid']) ?>.
     602                                                                <?php _e('and', 'buddypress') ?> <?php echo bp_core_get_userlink($bp->loggedin_user->id) ?>.
    606603                                                        </td>
    607604                                                </tr>
    … …  
    631628                                                                <div class="avatar-box">
    632629                                                                        <?php if ( function_exists('bp_core_get_avatar') )
    633                                                                                 echo bp_core_get_avatar($bp['loggedin_userid'], 1);
     630                                                                                echo bp_core_get_avatar($bp->loggedin_user->id, 1);
    634631                                                                        ?>
    635632                                       
  • trunk/bp-messages/autocomplete/bp-messages-autocomplete.php

    r659 r1021  
    1010
    1111// Get the friend ids based on the search terms
    12 $friends = friends_search_friends( $_GET['q'], $bp['loggedin_userid'], $_GET['limit'], 1 );
     12$friends = friends_search_friends( $_GET['q'], $bp->loggedin_user->id, $_GET['limit'], 1 );
    1313
    1414if ( $friends['friends'] ) {
  • trunk/bp-messages/bp-messages-ajax.php

    r922 r1021  
    2121                <?php
    2222        } else {
    23                 $result['message'] = '<img src="' . $bp['messages']['image_base'] . '/warning.gif" alt="Warning" /> &nbsp;' . $result['message'];
     23                $result['message'] = '<img src="' . $bp->messages->image_base . '/warning.gif" alt="Warning" /> &nbsp;' . $result['message'];
    2424                echo "-1[[split]]" . $result['message'];
    2525        }
  • trunk/bp-messages/bp-messages-classes.php

    r713 r1021  
    3838                global $wpdb, $bp;
    3939
    40                 $thread = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $bp['messages']['table_name_threads'] . " WHERE id = %d", $id ) );
     40                $thread = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->messages->table_name_threads} WHERE id = %d", $id ) );
    4141               
    4242                if ( $thread ) {
    … …  
    6363                                        foreach ( $this->message_ids as $key => $message_id ) {
    6464                                                if ( $this->box == 'sentbox' ) {
    65                                                         if ( !messages_is_user_sender( $bp['loggedin_userid'], $message_id ) ) {
     65                                                        if ( !messages_is_user_sender( $bp->loggedin_user->id, $message_id ) ) {
    6666                                                                unset( $this->message_ids[$key] );
    6767                                                        } else {
    … …  
    6969                                                        }                                               
    7070                                                } else {
    71                                                         if ( messages_is_user_sender( $bp['loggedin_userid'], $message_id ) ) {
     71                                                        if ( messages_is_user_sender( $bp->loggedin_user->id, $message_id ) ) {
    7272                                                                unset( $this->message_ids[$key] );
    7373                                                        } else {
    … …  
    9494                                $this->unread_count = $this->get_unread();
    9595
    96                                 $last_message = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $bp['messages']['table_name_messages'] . " WHERE id = %d", $this->last_message_id ) );       
     96                                $last_message = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->messages->table_name_messages} WHERE id = %d", $this->last_message_id ) );
    9797                               
    9898                                if ( $last_message ) {
    … …  
    111111                       
    112112                if ( $this->message_ids)
    113                         return $wpdb->get_results( "SELECT * FROM " . $bp['messages']['table_name_messages'] . " WHERE id IN (" . $wpdb->escape($this->message_ids) . ")" );
     113                        return $wpdb->get_results( "SELECT * FROM {$bp->messages->table_name_messages} WHERE id IN (" . $wpdb->escape($this->message_ids) . ")" );
    114114                else
    115115                        return false;
    … …  
    119119                global $wpdb, $bp;
    120120
    121                 $sql = $wpdb->prepare( "SELECT unread_count FROM " . $bp['messages']['table_name_recipients'] . " WHERE thread_id = %d AND user_id = %d", $this->thread_id, $bp['loggedin_userid'] );
     121                $sql = $wpdb->prepare( "SELECT unread_count FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d AND user_id = %d", $this->thread_id, $bp->loggedin_user->id );
    122122                $unread_count = $wpdb->get_var($sql);
    123123               
    … …  
    136136                global $wpdb, $bp;
    137137
    138                 $recipients = $wpdb->get_col( $wpdb->prepare( "SELECT user_id FROM " . $bp['messages']['table_name_recipients'] . " WHERE thread_id = %d", $this->thread_id ) );
     138                $recipients = $wpdb->get_col( $wpdb->prepare( "SELECT user_id FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d", $this->thread_id ) );
    139139
    140140                for ( $i = 0; $i < count($recipients); $i++ ) {
    141141                        $recipient = $recipients[$i];
    142142
    143                         if ( count($recipients) > 1 && $recipient != $bp['loggedin_userid'] )
     143                        if ( count($recipients) > 1 && $recipient != $bp->loggedin_user->id )
    144144                                $recipient_ids[] = $recipient;
    145145                }
    … …  
    153153                global $wpdb, $bp;
    154154               
    155                 $delete_for_user = $wpdb->query( $wpdb->prepare( "UPDATE " . $bp['messages']['table_name_recipients'] . " SET is_deleted = 1 WHERE thread_id = %d AND user_id = %d", $thread_id, $bp['loggedin_userid'] ) );
     155                $delete_for_user = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET is_deleted = 1 WHERE thread_id = %d AND user_id = %d", $thread_id, $bp->loggedin_user->id ) );
    156156               
    157157                // Check to see if any more recipients remain for this message
    158158                // if not, then delete the message from the database.
    159                 $recipients = $wpdb->get_results( $wpdb->prepare( "SELECT id FROM " . $bp['messages']['table_name_recipients'] . " WHERE thread_id = %d AND is_deleted = 0", $thread_id ) );
     159                $recipients = $wpdb->get_results( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d AND is_deleted = 0", $thread_id ) );
    160160
    161161                if ( !$recipients ) {
    162162                        // Get message ids:
    163                         $message_ids = $wpdb->get_var( $wpdb->prepare( "SELECT message_ids FROM " . $bp['messages']['table_name_threads'] . " WHERE id = %d", $thread_id ) );
     163                        $message_ids = $wpdb->get_var( $wpdb->prepare( "SELECT message_ids FROM {$bp->messages->table_name_threads} WHERE id = %d", $thread_id ) );
    164164                        $message_ids = unserialize($message_ids);
    165165                       
    166166                        // delete thread:
    167                         $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['messages']['table_name_threads'] . " WHERE id = %d", $thread_id ) );
     167                        $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->messages->table_name_threads} WHERE id = %d", $thread_id ) );
    168168                       
    169169                        // delete messages:
    170170                        for ( $i = 0; $i < count($message_ids); $i++ ) {
    171                                 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['messages']['table_name_messages'] . " WHERE id = %d", $message_ids[$i] ) );
     171                                $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->messages->table_name_messages} WHERE id = %d", $message_ids[$i] ) );
    172172                        }
    173173                       
    174174                        // delete the recipients
    175                         $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['messages']['table_name_recipients'] . " WHERE id = %d", $thread_id ) );
     175                        $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->messages->table_name_recipients} WHERE id = %d", $thread_id ) );
    176176                }
    177177
    … …  
    186186                        $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
    187187                       
    188                 $sql = $wpdb->prepare( "SELECT r.thread_id FROM " . $bp['messages']['table_name_recipients'] . " r, " . $bp['messages']['table_name_threads'] . " t WHERE t.id = r.thread_id AND r.is_deleted = 0 AND r.user_id = %d$exclude_sender ORDER BY t.last_post_date DESC$pag_sql", $bp['loggedin_userid'] );
     188                $sql = $wpdb->prepare( "SELECT r.thread_id FROM {$bp->messages->table_name_recipients} r, {$bp->messages->table_name_threads} t WHERE t.id = r.thread_id AND r.is_deleted = 0 AND r.user_id = %d$exclude_sender ORDER BY t.last_post_date DESC$pag_sql", $bp->loggedin_user->id );
    189189
    190190                if ( !$thread_ids = $wpdb->get_results($sql) )
    … …  
    207207                global $wpdb, $bp;
    208208               
    209                 $sql = $wpdb->prepare( "UPDATE " . $bp['messages']['table_name_recipients'] . " SET unread_count = 0 WHERE user_id = %d AND thread_id = %d", $bp['loggedin_userid'], $thread_id );
     209                $sql = $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET unread_count = 0 WHERE user_id = %d AND thread_id = %d", $bp->loggedin_user->id, $thread_id );
    210210                $wpdb->query($sql);
    211211        }
    … …  
    214214                global $wpdb, $bp;
    215215               
    216                 $sql = $wpdb->prepare( "UPDATE " . $bp['messages']['table_name_recipients'] . " SET unread_count = 1 WHERE user_id = %d AND thread_id = %d", $bp['loggedin_userid'], $thread_id );
     216                $sql = $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET unread_count = 1 WHERE user_id = %d AND thread_id = %d", $bp->loggedin_user->id, $thread_id );
    217217                $wpdb->query($sql);
    218218        }
    … …  
    225225                        $exclude_sender = ' AND sender_only != 1';
    226226
    227                 return (int) $wpdb->get_var( $wpdb->prepare( "SELECT count(thread_id) FROM " . $bp['messages']['table_name_recipients'] . " WHERE user_id = %d AND is_deleted = 0$exclude_sender", $user_id ) );
     227                return (int) $wpdb->get_var( $wpdb->prepare( "SELECT count(thread_id) FROM {$bp->messages->table_name_recipients} WHERE user_id = %d AND is_deleted = 0$exclude_sender", $user_id ) );
    228228        }
    229229       
    … …  
    231231                global $wpdb, $bp;
    232232               
    233                 $sender_ids = $wpdb->get_var( $wpdb->prepare( "SELECT sender_ids FROM " . $bp['messages']['table_name_threads'] . " WHERE id = %d", $thread_id ) );     
     233                $sender_ids = $wpdb->get_var( $wpdb->prepare( "SELECT sender_ids FROM {$bp->messages->table_name_threads} WHERE id = %d", $thread_id ) );       
    234234               
    235235                if ( !$sender_ids )
    … …  
    238238                $sender_ids = unserialize($sender_ids);
    239239               
    240                 return in_array( $bp['loggedin_userid'], $sender_ids );
     240                return in_array( $bp->loggedin_user->id, $sender_ids );
    241241        }
    242242
    … …  
    244244                global $wpdb, $bp;
    245245
    246                 $sql = $wpdb->prepare("SELECT last_sender_id FROM " . $bp['messages']['table_name_threads'] . " WHERE id = %d", $thread_id);
     246                $sql = $wpdb->prepare("SELECT last_sender_id FROM {$bp->messages->table_name_threads} WHERE id = %d", $thread_id);
    247247
    248248                if ( !$sender_id = $wpdb->get_var($sql) )
    … …  
    255255                global $wpdb, $bp;
    256256
    257                 $sql = $wpdb->prepare( "SELECT unread_count FROM " . $bp['messages']['table_name_recipients'] . " WHERE user_id = %d AND is_deleted = 0", $bp['loggedin_userid'] );
     257                $sql = $wpdb->prepare( "SELECT unread_count FROM {$bp->messages->table_name_recipients} WHERE user_id = %d AND is_deleted = 0", $bp->loggedin_user->id );
    258258
    259259                if ( !$unread_counts = $wpdb->get_results($sql) )
    … …  
    271271                global $wpdb, $bp;
    272272               
    273                 $sql = $wpdb->prepare("SELECT id FROM " . $bp['messages']['table_name_recipients'] . " WHERE thread_id = %d AND user_id = %d", $id, $bp['loggedin_userid'] );
     273                $sql = $wpdb->prepare("SELECT id FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d AND user_id = %d", $id, $bp->loggedin_user->id );
    274274                $has_access = $wpdb->get_var($sql);
    275275
    … …  
    308308
    309309                $this->date_sent = time();
    310                 $this->sender_id = $bp['loggedin_userid'];
     310                $this->sender_id = $bp->loggedin_user->id;
    311311
    312312                if ( $id ) {
    … …  
    318318                global $wpdb, $bp;
    319319               
    320                 $sql = $wpdb->prepare("SELECT * FROM " . $bp['messages']['table_name_messages'] . " WHERE id = %d", $id);
     320                $sql = $wpdb->prepare("SELECT * FROM {$bp->messages->table_name_messages} WHERE id = %d", $id);
    321321
    322322                if ( $message = $wpdb->get_row($sql) ) {
    … …  
    336336
    337337                // First insert the message into the messages table
    338                 if ( !$wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp['messages']['table_name_messages'] . " ( sender_id, subject, message, date_sent, message_order, sender_is_group ) VALUES ( %d, %s, %s, FROM_UNIXTIME(%d), %d, %d )", $this->sender_id, $this->subject, $this->message, $this->date_sent, $this->message_order, $this->sender_is_group ) ) )
     338                if ( !$wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_messages} ( sender_id, subject, message, date_sent, message_order, sender_is_group ) VALUES ( %d, %s, %s, FROM_UNIXTIME(%d), %d, %d )", $this->sender_id, $this->subject, $this->message, $this->date_sent, $this->message_order, $this->sender_is_group ) ) )
    339339                        return false;
    340340                       
    … …  
    342342                if ( $this->thread_id ) {
    343343                        // Select and update the current message ids for the thread.
    344                         $the_ids = $wpdb->get_row( $wpdb->prepare( "SELECT message_ids, sender_ids FROM " . $bp['messages']['table_name_threads'] . " WHERE id = %d", $this->thread_id ) );
     344                        $the_ids = $wpdb->get_row( $wpdb->prepare( "SELECT message_ids, sender_ids FROM {$bp->messages->table_name_threads} WHERE id = %d", $this->thread_id ) );
    345345                        $message_ids = unserialize($the_ids->message_ids);
    346346                        $message_ids[] = $wpdb->insert_id;
    … …  
    359359                       
    360360                        // Update the thread the message belongs to.
    361                         $wpdb->query( $wpdb->prepare( "UPDATE " . $bp['messages']['table_name_threads'] . " SET message_ids = %s, sender_ids = %s, last_message_id = %d, last_sender_id = %d WHERE id = %d", $message_ids, $sender_ids, $wpdb->insert_id, $this->sender_id, $this->thread_id ) );
     361                        $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_threads} SET message_ids = %s, sender_ids = %s, last_message_id = %d, last_sender_id = %d WHERE id = %d", $message_ids, $sender_ids, $wpdb->insert_id, $this->sender_id, $this->thread_id ) );
    362362                                               
    363363                        // Find the recipients and update the unread counts for each
    … …  
    366366                       
    367367                        for ( $i = 0; $i < count($this->recipients); $i++ ) {
    368                                 if ( $this->recipients[$i]->user_id != $bp['loggedin_userid'] )
    369                                         $wpdb->query( $wpdb->prepare( "UPDATE " . $bp['messages']['table_name_recipients'] . " SET unread_count = unread_count + 1, sender_only = 0 WHERE thread_id = %d AND user_id = %d", $this->thread_id, $this->recipients[$i] ) );
     368                                if ( $this->recipients[$i]->user_id != $bp->loggedin_user->id )
     369                                        $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET unread_count = unread_count + 1, sender_only = 0 WHERE thread_id = %d AND user_id = %d", $this->thread_id, $this->recipients[$i] ) );
    370370                        }
    371371                } else {
    … …  
    373373                        $message_id = $wpdb->insert_id;
    374374                        $serialized_message_id = serialize( array( (int)$message_id ) );
    375                         $serialized_sender_id = serialize( array( (int)$bp['loggedin_userid'] ) );
    376                        
    377                         $sql = $wpdb->prepare( "INSERT INTO " . $bp['messages']['table_name_threads'] . " ( message_ids, sender_ids, first_post_date, last_post_date, last_message_id, last_sender_id ) VALUES ( %s, %s, FROM_UNIXTIME(%d), FROM_UNIXTIME(%d), %d, %d )", $serialized_message_id, $serialized_sender_id, $this->date_sent, $this->date_sent, $message_id, $this->sender_id );
     375                        $serialized_sender_id = serialize( array( (int)$bp->loggedin_user->id ) );
     376                       
     377                        $sql = $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_threads} ( message_ids, sender_ids, first_post_date, last_post_date, last_message_id, last_sender_id ) VALUES ( %s, %s, FROM_UNIXTIME(%d), FROM_UNIXTIME(%d), %d, %d )", $serialized_message_id, $serialized_sender_id, $this->date_sent, $this->date_sent, $message_id, $this->sender_id );
    378378                       
    379379                        if ( $wpdb->query($sql) === false )
    … …  
    385385                        // Add a new entry for each recipient;
    386386                        for ( $i = 0; $i < count($this->recipients); $i++ ) {
    387                                 $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp['messages']['table_name_recipients'] . " ( user_id, thread_id, unread_count ) VALUES ( %d, %d, 1 )", $this->recipients[$i], $this->thread_id ) );
     387                                $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_recipients} ( user_id, thread_id, unread_count ) VALUES ( %d, %d, 1 )", $this->recipients[$i], $this->thread_id ) );
    388388                        }
    389389                       
    390390                        if ( !in_array( $this->sender_id, $this->recipients ) ) {
    391391                                // Finally, add a recipient entry for the sender, as replies need to go to this person too.
    392                                 $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp['messages']['table_name_recipients'] . " ( user_id, thread_id, unread_count, sender_only ) VALUES ( %d, %d, 0, 0 )", $this->sender_id, $this->thread_id ) );
     392                                $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_recipients} ( user_id, thread_id, unread_count, sender_only ) VALUES ( %d, %d, 0, 0 )", $this->sender_id, $this->thread_id ) );
    393393                        }
    394394                }
    … …  
    403403                global $bp, $wpdb;
    404404               
    405                 return $wpdb->get_results( $wpdb->prepare( "SELECT user_id FROM " . $bp['messages']['table_name_recipients'] . " WHERE thread_id = %d", $this->thread_id ) );
     405                return $wpdb->get_results( $wpdb->prepare( "SELECT user_id FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d", $this->thread_id ) );
    406406        }
    407407       
    … …  
    425425                global $wpdb, $bp;
    426426               
    427                 $message_ids = $wpdb->get_var( $wpdb->prepare( "SELECT message_ids FROM " . $bp['messages']['table_name_threads'] . " WHERE id = %d", $thread_id ) );
     427                $message_ids = $wpdb->get_var( $wpdb->prepare( "SELECT message_ids FROM {$bp->messages->table_name_threads} WHERE id = %d", $thread_id ) );
    428428                $message_ids = implode( ',', unserialize($message_ids));
    429429
    430                 $sql = $wpdb->prepare( "SELECT id FROM " . $bp['messages']['table_name_messages'] . "  WHERE sender_id = %d AND id IN (" . $wpdb->escape($message_ids) . ") ORDER BY date_sent DESC LIMIT 1", $bp['loggedin_userid'] );
     430                $sql = $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_messages}  WHERE sender_id = %d AND id IN (" . $wpdb->escape($message_ids) . ") ORDER BY date_sent DESC LIMIT 1", $bp->loggedin_user->id );
    431431                return $wpdb->get_var($sql);
    432432        }       
    … …  
    434434        function is_user_sender( $user_id, $message_id ) {
    435435                global $wpdb, $bp;
    436                 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM " . $bp['messages']['table_name_messages'] . " WHERE sender_id = %d AND id = %d", $user_id, $message_id ) );
     436                return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_messages} WHERE sender_id = %d AND id = %d", $user_id, $message_id ) );
    437437        }
    438438       
    439439        function get_message_sender( $message_id ) {
    440440                global $wpdb, $bp;
    441                 return $wpdb->get_var( $wpdb->prepare( "SELECT sender_id FROM " . $bp['messages']['table_name_messages'] . " WHERE id = %d", $message_id ) );           
     441                return $wpdb->get_var( $wpdb->prepare( "SELECT sender_id FROM {$bp->messages->table_name_messages} WHERE id = %d", $message_id ) );             
    442442        }
    443443}
    … …  
    460460                global $wpdb, $bp;
    461461               
    462                 $notice = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $bp['messages']['table_name_notices'] . " WHERE id = %d", $this->id ) );
     462                $notice = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->messages->table_name_notices} WHERE id = %d", $this->id ) );
    463463               
    464464                if ( $notice ) {
    … …  
    474474               
    475475                if ( !$this->id ) {
    476                         $sql = $wpdb->prepare( "INSERT INTO " . $bp['messages']['table_name_notices'] . " (subject, message, date_sent, is_active) VALUES (%s, %s, FROM_UNIXTIME(%d), %d)", $this->subject, $this->message, $this->date_sent, $this->is_active );       
     476                        $sql = $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_notices} (subject, message, date_sent, is_active) VALUES (%s, %s, FROM_UNIXTIME(%d), %d)", $this->subject, $this->message, $this->date_sent, $this->is_active );
    477477                } else {
    478                         $sql = $wpdb->prepare( "UPDATE " . $bp['messages']['table_name_notices'] . " SET subject = %s, message = %s, is_active = %d WHERE id = %d", $this->subject, $this->message, $this->is_active, $this->id );                             
     478                        $sql = $wpdb->prepare( "UPDATE {$bp->messages->table_name_notices} SET subject = %s, message = %s, is_active = %d WHERE id = %d", $this->subject, $this->message, $this->is_active, $this->id );                               
    479479                }
    480480       
    … …  
    486486                       
    487487                // Now deactivate all notices apart from the new one.
    488                 $wpdb->query( $wpdb->prepare( "UPDATE " . $bp['messages']['table_name_notices'] . " SET is_active = 0 WHERE id != %d", $id ) );
    489                
    490                 update_usermeta( $bp['loggedin_userid'], 'last_activity', date( 'Y-m-d H:i:s' ) );
     488                $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_notices} SET is_active = 0 WHERE id != %d", $id ) );
     489               
     490                update_usermeta( $bp->loggedin_user->id, 'last_activity', date( 'Y-m-d H:i:s' ) );
    491491               
    492492                return true;
    … …  
    512512                global $wpdb, $bp;
    513513               
    514                 $sql = $wpdb->prepare( "DELETE FROM " . $bp['messages']['table_name_notices'] . " WHERE id = %d", $this->id );
     514                $sql = $wpdb->prepare( "DELETE FROM {$bp->messages->table_name_notices} WHERE id = %d", $this->id );
    515515               
    516516                if ( !$wpdb->query($sql) )
    … …  
    525525                global $wpdb, $bp;
    526526               
    527                 $notices = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $bp['messages']['table_name_notices'] . " ORDER BY date_sent DESC" ) );
     527                $notices = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->messages->table_name_notices} ORDER BY date_sent DESC" ) );
    528528                return $notices;
    529529        }
    … …  
    532532                global $wpdb, $bp;
    533533               
    534                 $notice_count = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $bp['messages']['table_name_notices'] ) );
     534                $notice_count = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $bp->messages->table_name_notices ) );
    535535                return $notice_count;
    536536        }
    … …  
    539539                global $wpdb, $bp;
    540540               
    541                 $notice_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM " . $bp['messages']['table_name_notices'] . " WHERE is_active = 1") );
     541                $notice_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_notices} WHERE is_active = 1") );
    542542                return new BP_Messages_Notice($notice_id);
    543543        }
  • trunk/bp-messages/bp-messages-cssjs.php

    r884 r1021  
    44        global $bp;
    55
    6         if ( $bp['current_component'] == $bp['messages']['slug'] )
     6        if ( $bp->current_component == $bp->messages->slug )
    77                wp_enqueue_script( 'bp-messages-js', site_url( MUPLUGINDIR . '/bp-messages/js/general.php' ) );
    88
    99        // Include the autocomplete JS for composing a message.
    10         if ( $bp['current_component'] == $bp['messages']['slug'] && $bp['current_action'] == 'compose') {
     10        if ( $bp->current_component == $bp->messages->slug && $bp->current_action == 'compose') {
    1111                wp_enqueue_script( 'bp-jquery-autocomplete', site_url( MUPLUGINDIR . '/bp-messages/js/autocomplete/jquery.autocomplete.js' ), 'jquery' );
    1212                wp_enqueue_script( 'bp-jquery-autocomplete-fb', site_url( MUPLUGINDIR . '/bp-messages/js/autocomplete/jquery.autocompletefb.js' ), 'jquery' );
    … …  
    2323        global $bp;
    2424       
    25         if ( $bp['current_component'] == $bp['messages']['slug'] && $bp['current_action'] == 'compose') {
     25        if ( $bp->current_component == $bp->messages->slug && $bp->current_action == 'compose') {
    2626                wp_enqueue_style( 'bp-messages-autocomplete', site_url( MUPLUGINDIR . '/bp-messages/css/autocomplete/jquery.autocompletefb.css' ) );   
    2727                wp_print_styles();
  • trunk/bp-messages/bp-messages-templatetags.php

    r920 r1021  
    9898        global $bp, $messages_template;
    9999
    100         if ( $bp['current_action'] == 'notices' && !is_site_admin() ) {
    101                 wp_redirect( $bp['current_userid'] );
     100        if ( $bp->current_action == 'notices' && !is_site_admin() ) {
     101                wp_redirect( $bp->displayed_user->id );
    102102        } else {
    103                 if ( $bp['current_action'] == 'inbox' )
    104                         bp_core_delete_notifications_for_user_by_type( $bp['loggedin_userid'], 'messages', 'new_message' );
    105        
    106                 $messages_template = new BP_Messages_Template( $bp['loggedin_userid'], $bp['current_action'] );
     103                if ( $bp->current_action == 'inbox' )
     104                        bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'messages', 'new_message' );
     105       
     106                $messages_template = new BP_Messages_Template( $bp->loggedin_user->id, $bp->current_action );
    107107        }
    108108       
    … …  
    147147function bp_message_thread_view_link() {
    148148        global $messages_template, $bp;
    149         echo apply_filters( 'bp_message_thread_view_link', $bp['loggedin_domain'] . $bp['messages']['slug'] . '/view/' . $messages_template->thread->thread_id );
     149        echo apply_filters( 'bp_message_thread_view_link', $bp->loggedin_user->domain . $bp->messages->slug . '/view/' . $messages_template->thread->thread_id );
    150150}
    151151
    152152function bp_message_thread_delete_link() {
    153153        global $messages_template, $bp;
    154         echo apply_filters( 'bp_message_thread_delete_link', $bp['loggedin_domain'] . $bp['messages']['slug'] . '/' . $bp['current_action'] . '/delete/' . $messages_template->thread->thread_id );
     154        echo apply_filters( 'bp_message_thread_delete_link', $bp->loggedin_user->domain . $bp->messages->slug . '/' . $bp->current_action . '/delete/' . $messages_template->thread->thread_id );
    155155}
    156156
    … …  
    197197        global $bp;
    198198       
    199         echo apply_filters( 'bp_messages_form_action', $bp['loggedin_domain'] . $bp['messages']['slug'] . '/' . $bp['current_action'] );
     199        echo apply_filters( 'bp_messages_form_action', $bp->loggedin_user->domain . $bp->messages->slug . '/' . $bp->current_action );
    200200}
    201201
    … …  
    219219        global $bp;
    220220       
    221         if ( $bp['current_action'] != 'sentbox' ) {
     221        if ( $bp->current_action != 'sentbox' ) {
    222222?>
    223223                <?php _e( 'Select:', 'buddypress' ) ?>
    … …  
    231231                <a href="#" id="mark_as_unread"><?php _e('Mark as Unread', 'buddypress') ?></a> &nbsp;
    232232        <?php } ?>
    233                 <a href="#" id="delete_<?php echo $bp['current_action'] ?>_messages"><?php _e('Delete Selected', 'buddypress') ?></a> &nbsp;
     233                <a href="#" id="delete_<?php echo $bp->current_action ?>_messages"><?php _e('Delete Selected', 'buddypress') ?></a> &nbsp;
    234234<?php   
    235235}
    … …  
    263263        global $messages_template, $bp;
    264264       
    265         echo apply_filters( 'bp_message_notice_delete_link', $bp['loggedin_domain'] . $bp['messages']['slug'] . '/notices/delete/' . $messages_template->thread->id );
     265        echo apply_filters( 'bp_message_notice_delete_link', $bp->loggedin_user->domain . $bp->messages->slug . '/notices/delete/' . $messages_template->thread->id );
    266266}
    267267
    … …  
    270270
    271271        if ( $messages_template->thread->is_active == "1" ) {
    272                 $link = $bp['loggedin_domain'] . $bp['messages']['slug'] . '/notices/deactivate/' . $messages_template->thread->id;
     272                $link = $bp->loggedin_user->domain . $bp->messages->slug . '/notices/deactivate/' . $messages_template->thread->id;
    273273        } else {
    274                 $link = $bp['loggedin_domain'] . $bp['messages']['slug'] . '/notices/activate/' . $messages_template->thread->id;               
     274                $link = $bp->loggedin_user->domain . $bp->messages->slug . '/notices/activate/' . $messages_template->thread->id;               
    275275        }
    276276        echo apply_filters( 'bp_message_activate_deactivate_link', $link );
    … …  
    316316                return false;
    317317       
    318         $ud = get_userdata( $bp['current_userid'] );
     318        $ud = get_userdata( $bp->displayed_user->id );
    319319        ?>
    320320        <div class="generic-button">
    321                 <a class="send-message" title="<?php _e( 'Send Message', 'buddypress' ) ?>" href="<?php echo $bp['loggedin_domain'] . $bp['messages']['slug'] ?>/compose/?r=<?php echo $ud->user_login ?>"><?php _e( 'Send Message', 'buddypress' ) ?></a>
     321                <a class="send-message" title="<?php _e( 'Send Message', 'buddypress' ) ?>" href="<?php echo $bp->loggedin_user->domain . $bp->messages->slug ?>/compose/?r=<?php echo $ud->user_login ?>"><?php _e( 'Send Message', 'buddypress' ) ?></a>
    322322        </div>
    323323        <?php
    … …  
    326326function bp_message_loading_image_src() {
    327327        global $bp;
    328         echo $bp['messages']['image_base'] . '/ajax-loader.gif';
     328        echo $bp->messages->image_base . '/ajax-loader.gif';
    329329}
    330330
  • trunk/bp-wire.php

    r974 r1021  
    2727        global $bp, $wpdb;
    2828       
    29         $bp['wire'] = array(
    30                 'image_base' => site_url( MUPLUGINDIR . '/bp-wire/images' ),
    31                 'slug'           => BP_WIRE_SLUG
    32         );
     29        $bp->wire->image_base = site_url( MUPLUGINDIR . '/bp-wire/images' );
     30        $bp->wire->slug = BP_WIRE_SLUG;
    3331
    34         $bp['version_numbers'][$bp['wire']['slug']] = BP_WIRE_VERSION;
     32        $bp->version_numbers->wire = BP_WIRE_VERSION;
    3533}
    3634add_action( 'wp', 'bp_wire_setup_globals', 1 );
    … …  
    4745
    4846        /* Add 'Wire' to the main navigation */
    49         bp_core_add_nav_item( __('Wire', 'buddypress'), $bp['wire']['slug'] );
    50         bp_core_add_nav_default( $bp['wire']['slug'], 'bp_wire_screen_latest', 'all-posts' );
     47        bp_core_add_nav_item( __('Wire', 'buddypress'), $bp->wire->slug );
     48        bp_core_add_nav_default( $bp->wire->slug, 'bp_wire_screen_latest', 'all-posts' );
    5149
    5250        /* Add the subnav items to the wire nav */
    53         bp_core_add_subnav_item( $bp['wire']['slug'], 'all-posts', __('All Posts', 'buddypress'), $bp['loggedin_domain'] . $bp['wire']['slug'] . '/', 'bp_wire_screen_latest' );
     51        bp_core_add_subnav_item( $bp->wire->slug, 'all-posts', __('All Posts', 'buddypress'), $bp->loggedin_user->domain . $bp->wire->slug . '/', 'bp_wire_screen_latest' );
    5452       
    55         if ( $bp['current_component'] == $bp['wire']['slug'] ) {
     53        if ( $bp->current_component == $bp->wire->slug ) {
    5654                if ( bp_is_home() ) {
    57                         $bp['bp_options_title'] = __('My Wire', 'buddypress');
     55                        $bp->bp_options_title = __('My Wire', 'buddypress');
    5856                } else {
    59                         $bp['bp_options_avatar'] = bp_core_get_avatar( $bp['current_userid'], 1 );
    60                         $bp['bp_options_title'] = $bp['current_fullname'];
     57                        $bp->bp_options_avatar = bp_core_get_avatar( $bp->displayed_user->id, 1 );
     58                        $bp->bp_options_title = $bp->displayed_user->fullname;
    6159                }
    6260        }
    … …  
    7573        if ( function_exists('bp_activity_record') ) {
    7674                extract($args);
     75
    7776                bp_activity_record( $item_id, $component_name, $component_action, $is_private, $secondary_item_id, $user_id, $secondary_user_id );
    7877        }
    … …  
    9392       
    9493        if ( !$table_name )
    95                 $table_name = $bp[$component_name]['table_name_wire'];
     94                $table_name = $bp->{$component_name}->table_name_wire;
    9695
    9796        $wire_post = new BP_Wire_Post( $table_name );
    9897        $wire_post->item_id = $item_id;
    99         $wire_post->user_id = $bp['loggedin_userid'];
     98        $wire_post->user_id = $bp->loggedin_user->id;
    10099        $wire_post->date_posted = time();
    101        
    102100
    103101        $allowed_tags = apply_filters( 'bp_wire_post_allowed_tags', '<a>,<b>,<strong>,<i>,<em>,<img>' );
    … …  
    126124
    127125        if ( !$table_name )
    128                 $table_name = $bp[$component_name]['table_name_wire'];
     126                $table_name = $bp->{$component_name}->table_name_wire;
    129127       
    130128        $wire_post = new BP_Wire_Post( $table_name, $wire_post_id );
    131129       
    132         if ( !$bp['is_item_admin'] ) {
    133                 if ( $wire_post->user_id != $bp['loggedin_userid'] )
     130        if ( !$bp->is_item_admin ) {
     131                if ( $wire_post->user_id != $bp->loggedin_user->id )
    134132                        return false;
    135133        }
  • trunk/bp-wire/bp-wire-ajax.php

    r531 r1021  
    2222                                <div class="wire-post-metadata">
    2323                                        <?php bp_wire_post_author_avatar() ?>
    24                                         On <?php bp_wire_post_date() ?>
    25                                         <?php bp_wire_post_author_name() ?> said:
     24                                        <?php _e( 'On', 'buddypress' ) ?> <?php bp_wire_post_date() ?>
     25                                        <?php bp_wire_post_author_name() ?> <?php _e( 'said:', 'buddypress' ) ?>
    2626                                        <?php bp_wire_delete_link() ?>
    2727                                </div>
  • trunk/bp-wire/bp-wire-classes.php

    r511 r1021  
    2424                global $wpdb, $bp;
    2525
    26                 $sql = $wpdb->prepare( "SELECT * FROM " . $this->table_name . " WHERE id = %d", $this->id );
     26                $sql = $wpdb->prepare( "SELECT * FROM {$this->table_name} WHERE id = %d", $this->id );
    2727
    2828                $wire_post = $wpdb->get_row($sql);
    … …  
    4141                if ( $this->id ) {
    4242                        $sql = $wpdb->prepare(
    43                                 "UPDATE " . $this->table_name . " SET
     43                                "UPDATE {$this->table_name} SET
    4444                                        item_id = %d,
    4545                                        user_id = %d,
    … …  
    5757                } else {
    5858                        $sql = $wpdb->prepare(
    59                                 "INSERT INTO " . $this->table_name . " (
     59                                "INSERT INTO {$this->table_name} (
    6060                                        item_id,
    6161                                        user_id,
    … …  
    8484                global $wpdb, $bp;
    8585               
    86                 return $wpdb->query( $wpdb->prepare( "DELETE FROM " . $this->table_name . " WHERE id = %d", $this->id ) );
     86                return $wpdb->query( $wpdb->prepare( "DELETE FROM {$this->table_name} WHERE id = %d", $this->id ) );
    8787        }
    8888       
    … …  
    9595                        $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
    9696               
    97                 $wire_posts = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $table_name . " WHERE item_id = %d  ORDER BY date_posted DESC $pag_sql", $item_id ) );
    98                 $count = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $table_name . " WHERE item_id = %d", $item_id ) );
     97                $wire_posts = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$table_name} WHERE item_id = %d  ORDER BY date_posted DESC $pag_sql", $item_id ) );
     98                $count = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$table_name} WHERE item_id = %d", $item_id ) );
    9999               
    100100                return array( 'wire_posts' => $wire_posts, 'count' => $count );
  • trunk/bp-wire/bp-wire-templatetags.php

    r900 r1021  
    2121                global $bp;
    2222               
    23                 if ( $bp['current_component'] == $bp['wire']['slug'] ) {
    24                         $this->table_name = $bp['profile']['table_name_wire'];
     23                if ( $bp->current_component == $bp->wire->slug ) {
     24                        $this->table_name = $bp->profile->table_name_wire;
    2525                       
    2626                        // Seeing as we're viewing a users wire, lets remove any new wire
    2727                        // post notifications
    28                         if ( $bp['current_action'] == 'all-posts' )
    29                                 bp_core_delete_notifications_for_user_by_type( $bp['loggedin_userid'], 'xprofile', 'new_wire_post' );
     28                        if ( $bp->current_action == 'all-posts' )
     29                                bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'xprofile', 'new_wire_post' );
    3030                       
    3131                } else {
    32                         $this->table_name = $bp[$bp['current_component']]['table_name_wire'];
     32                        $this->table_name = $bp->{$bp->current_component}->table_name_wire;
    3333                }
    3434               
    … …  
    4242                $this->wire_post_count = count($this->wire_posts);
    4343               
    44                 if ( (int)get_site_option('non-friend-wire-posting') && ( $bp['current_component'] == $bp['profile']['slug'] || $bp['current_component'] == $bp['wire']['slug'] ) )
     44                if ( (int)get_site_option('non-friend-wire-posting') && ( $bp->current_component == $bp->profile->slug || $bp->current_component == $bp->wire->slug ) )
    4545                        $this->can_post = 1;
    4646                else
    … …  
    4848               
    4949                $this->pag_links = paginate_links( array(
    50                         'base' => add_query_arg( 'wpage', '%#%', $bp['current_domain'] ),
     50                        'base' => add_query_arg( 'wpage', '%#%', $bp->displayed_user->domain ),
    5151                        'format' => '',
    5252                        'total' => ceil($this->total_wire_post_count / $this->pag_num),
    … …  
    217217        global $bp;
    218218       
    219         echo apply_filters( 'bp_wire_ajax_loader_src', $bp['wire']['image_base'] . '/ajax-loader.gif' );
     219        echo apply_filters( 'bp_wire_ajax_loader_src', $bp->wire->image_base . '/ajax-loader.gif' );
    220220}
    221221
    … …  
    257257        global $bp;
    258258       
    259         if ( $bp['current_item'] == '')
    260                 $uri = $bp['current_action'];
    261         else
    262                 $uri = $bp['current_item'];
    263        
    264         if ( $bp['current_component'] == 'wire' || $bp['current_component'] == 'profile' ) {
    265                 echo apply_filters( 'bp_wire_get_action', $bp['current_domain'] . $bp['wire']['slug'] . '/post/' );
     259        if ( empty( $bp->current_item ) )
     260                $uri = $bp->current_action;
     261        else
     262                $uri = $bp->current_item;
     263       
     264        if ( $bp->current_component == 'wire' || $bp->current_component == 'profile' ) {
     265                echo apply_filters( 'bp_wire_get_action', $bp->displayed_user->domain . $bp->wire->slug . '/post/' );
    266266        } else {
    267                 echo apply_filters( 'bp_wire_get_action', site_url() . '/' . $bp[$bp['current_component']]['slug'] . '/' . $uri . '/wire/post/' );
     267                echo apply_filters( 'bp_wire_get_action', site_url() . '/' . $bp[$bp->current_component]['slug'] . '/' . $uri . '/wire/post/' );
    268268        }
    269269}
    … …  
    272272        global $bp;
    273273       
    274         echo apply_filters( 'bp_wire_poster_avatar', bp_core_get_avatar( $bp['loggedin_userid'], 1 ) );
     274        echo apply_filters( 'bp_wire_poster_avatar', bp_core_get_avatar( $bp->loggedin_user->id, 1 ) );
    275275}
    276276
    … …  
    279279       
    280280        if ( $echo )
    281                 echo apply_filters( 'bp_wire_poster_name', '<a href="' . $bp['loggedin_domain'] . $bp['profile']['slug'] . '">' . __('You', 'buddypress') . '</a>' );
    282         else
    283                 return apply_filters( 'bp_wire_poster_name', '<a href="' . $bp['loggedin_domain'] . $bp['profile']['slug'] . '">' . __('You', 'buddypress') . '</a>' );
     281                echo apply_filters( 'bp_wire_poster_name', '<a href="' . $bp->loggedin_user->domain . $bp->profile->slug . '">' . __('You', 'buddypress') . '</a>' );
     282        else
     283                return apply_filters( 'bp_wire_poster_name', '<a href="' . $bp->loggedin_user->domain . $bp->profile->slug . '">' . __('You', 'buddypress') . '</a>' );
    284284}
    285285
    … …  
    297297        global $wire_posts_template, $bp;
    298298
    299         if ( $bp['current_item'] == '')
    300                 $uri = $bp['current_action'];
    301         else
    302                 $uri = $bp['current_item'];
    303                
    304         if ( ( $wire_posts_template->wire_post->user_id == $bp['loggedin_userid'] ) || $bp['is_item_admin'] ) {
    305                 if ( $bp['current_component'] == 'wire' || $bp['current_component'] == 'profile' ) {
    306                         echo apply_filters( 'bp_wire_delete_link', '<a href="' . $bp['current_domain'] . $bp['wire']['slug'] . '/delete/' . $wire_posts_template->wire_post->id . '">[' . __('Delete', 'buddypress') . ']</a>' );
     299        if ( empty( $bp->current_item ) )
     300                $uri = $bp->current_action;
     301        else
     302                $uri = $bp->current_item;
     303               
     304        if ( ( $wire_posts_template->wire_post->user_id == $bp->loggedin_user->id ) || $bp->is_item_admin ) {
     305                if ( $bp->current_component == 'wire' || $bp->current_component == 'profile' ) {
     306                        echo apply_filters( 'bp_wire_delete_link', '<a href="' . $bp->displayed_user->domain . $bp->wire->slug . '/delete/' . $wire_posts_template->wire_post->id . '">[' . __('Delete', 'buddypress') . ']</a>' );
    307307                } else {
    308                         echo apply_filters( 'bp_wire_delete_link', '<a href="' . site_url() . '/' . $bp[$bp['current_component']]['slug'] . '/' . $uri . '/wire/delete/' . $wire_posts_template->wire_post->id . '">[' . __('Delete', 'buddypress') . ']</a>' );
     308                        echo apply_filters( 'bp_wire_delete_link', '<a href="' . site_url() . '/' . $bp[$bp->current_component]['slug'] . '/' . $uri . '/wire/delete/' . $wire_posts_template->wire_post->id . '">[' . __('Delete', 'buddypress') . ']</a>' );
    309309                }
    310310        }
    … …  
    314314        global $bp;
    315315       
    316         if ( $bp['current_item'] == '')
    317                 $uri = $bp['current_action'];
    318         else
    319                 $uri = $bp['current_item'];
    320        
    321         if ( $bp['current_component'] == 'wire' || $bp['current_component'] == 'profile') {
    322                 echo apply_filters( 'bp_wire_see_all_link', $bp['current_domain'] . $bp['wire']['slug'] );
     316        if ( empty( $bp->current_item ) )
     317                $uri = $bp->current_action;
     318        else
     319                $uri = $bp->current_item;
     320       
     321        if ( $bp->current_component == 'wire' || $bp->current_component == 'profile') {
     322                echo apply_filters( 'bp_wire_see_all_link', $bp->displayed_user->domain . $bp->wire->slug );
    323323        } else {
    324                 echo apply_filters( 'bp_wire_see_all_link', $bp['root_domain'] . '/' . $bp['groups']['slug'] . '/' . $uri . '/wire' );
     324                echo apply_filters( 'bp_wire_see_all_link', $bp->root_domain . '/' . $bp->groups->slug . '/' . $uri . '/wire' );
    325325        }
    326326}
  • trunk/bp-xprofile.php

    r1017 r1021  
    4949                $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
    5050       
    51         if ( get_site_option( 'bp-xprofile-base-group-name' ) == '' )
     51        if ( '' == get_site_option( 'bp-xprofile-base-group-name' ) )
    5252                update_site_option( 'bp-xprofile-base-group-name', 'Base' );
    5353       
    54         if ( get_site_option( 'bp-xprofile-fullname-field-name' ) == '' )
     54        if ( '' == get_site_option( 'bp-xprofile-fullname-field-name' ) )
    5555                update_site_option( 'bp-xprofile-fullname-field-name', 'Full Name' );   
    5656       
    57         $sql[] = "CREATE TABLE " . $bp['profile']['table_name_groups'] . " (
     57        $sql[] = "CREATE TABLE {$bp->profile->table_name_groups} (
    5858                          id int(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
    5959                          name varchar(150) NOT NULL,
    … …  
    6363        ) {$charset_collate};";
    6464       
    65         $sql[] = "CREATE TABLE " . $bp['profile']['table_name_fields'] . " (
     65        $sql[] = "CREATE TABLE {$bp->profile->table_name_fields} (
    6666                          id int(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
    6767                          group_id int(11) unsigned NOT NULL,
    … …  
    8484        ) {$charset_collate};";
    8585       
    86         $sql[] = "CREATE TABLE " . $bp['profile']['table_name_data'] . " (
     86        $sql[] = "CREATE TABLE {$bp->profile->table_name_data} (
    8787                          id int(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
    8888                          field_id int(11) unsigned NOT NULL,
    … …  
    9494        ) {$charset_collate};";
    9595       
    96         if ( get_site_option( 'bp-xprofile-db-version' ) == '' ) {
    97                 $sql[] = "INSERT INTO ". $bp['profile']['table_name_groups'] . " VALUES ( 1, '" . get_site_option( 'bp-xprofile-base-group-name' ) . "', '', 0 );";
    98        
    99                 $sql[] = "INSERT INTO ". $bp['profile']['table_name_fields'] . " (
     96        if ( '' == get_site_option( 'bp-xprofile-db-version' ) ) {
     97                $sql[] = "INSERT INTO {$bp->profile->table_name_groups} VALUES ( 1, '" . get_site_option( 'bp-xprofile-base-group-name' ) . "', '', 0 );";
     98       
     99                $sql[] = "INSERT INTO {$bp->profile->table_name_fields} (
    100100                                        id, group_id, parent_id, type, name, description, is_required, field_order, option_order, order_by, is_public, can_delete
    101101                                  ) VALUES (
    … …  
    117117                $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
    118118
    119         $sql[] = "CREATE TABLE ". $bp['profile']['table_name_wire'] ." (
    120                         id int(11) NOT NULL AUTO_INCREMENT,
    121                         item_id int(11) NOT NULL,
    122                         user_id int(11) NOT NULL,
    123                         content longtext NOT NULL,
    124                         date_posted datetime NOT NULL,
    125                         PRIMARY KEY id (id),
    126                         KEY item_id (item_id),
    127                     KEY user_id (user_id)
    128                    ) {$charset_collate};";
     119        $sql[] = "CREATE TABLE {$bp->profile->table_name_wire} (
     120                           id int(11) NOT NULL AUTO_INCREMENT,
     121                           item_id int(11) NOT NULL,
     122                           user_id int(11) NOT NULL,
     123                           content longtext NOT NULL,
     124                           date_posted datetime NOT NULL,
     125                           PRIMARY KEY id (id),
     126                           KEY item_id (item_id),
     127                       KEY user_id (user_id)
     128                       ) {$charset_collate};";
    129129
    130130        require_once( ABSPATH . 'wp-admin/upgrade-functions.php' );
    … …  
    146146        global $bp, $wpdb;
    147147       
    148         $bp['profile'] = array(
    149                 'table_name_groups' => $wpdb->base_prefix . 'bp_xprofile_groups',
    150                 'table_name_fields' => $wpdb->base_prefix . 'bp_xprofile_fields',
    151                 'table_name_data'       => $wpdb->base_prefix . 'bp_xprofile_data',
    152                 'format_activity_function' => 'xprofile_format_activity',
    153                 'image_base'            => site_url( MUPLUGINDIR . '/bp-xprofile/images' ),
    154                 'slug'                          => BP_XPROFILE_SLUG
    155         );
    156        
    157         $bp['version_numbers'][$bp['profile']['slug']] = BP_XPROFILE_VERSION;
     148        $bp->profile->table_name_groups = $wpdb->base_prefix . 'bp_xprofile_groups';
     149        $bp->profile->table_name_fields = $wpdb->base_prefix . 'bp_xprofile_fields';
     150        $bp->profile->table_name_data = $wpdb->base_prefix . 'bp_xprofile_data';
     151        $bp->profile->format_activity_function = 'xprofile_format_activity';
     152        $bp->profile->image_base = site_url( MUPLUGINDIR . '/bp-xprofile/images' );
     153        $bp->profile->slug = BP_XPROFILE_SLUG;
     154
     155        $bp->version_numbers->profile = BP_XPROFILE_VERSION;
    158156       
    159157        if ( function_exists('bp_wire_install') )
    160                 $bp['profile']['table_name_wire'] = $wpdb->base_prefix . 'bp_xprofile_wire';
     158                $bp->profile->table_name_wire = $wpdb->base_prefix . 'bp_xprofile_wire';
    161159}
    162160add_action( 'wp', 'xprofile_setup_globals', 1 );       
    … …  
    189187
    190188        /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    191         if ( ( $wpdb->get_var("SHOW TABLES LIKE '%" . $bp['profile']['table_name_groups'] . "%'") == false ) || ( get_site_option('bp-xprofile-db-version') < BP_XPROFILE_DB_VERSION )  )
     189        if ( ( $wpdb->get_var("SHOW TABLES LIKE '%{$bp->profile->table_name_groups}%'") == false ) || ( get_site_option('bp-xprofile-db-version') < BP_XPROFILE_DB_VERSION )  )
    192190                xprofile_install();
    193191       
    194         if ( ( function_exists('bp_wire_install') && $wpdb->get_var("SHOW TABLES LIKE '%" . $bp['profile']['table_name_wire'] . "%'") == false ) || ( get_site_option('bp-xprofile-db-version') < BP_XPROFILE_DB_VERSION )  )
     192        if ( ( function_exists('bp_wire_install') && $wpdb->get_var("SHOW TABLES LIKE '%{$bp->profile->table_name_wire}%'") == false ) || ( get_site_option('bp-xprofile-db-version') < BP_XPROFILE_DB_VERSION )  )
    195193                xprofile_wire_install();
    196194}
    … …  
    214212       
    215213        /* Add 'Profile' to the main navigation */
    216         bp_core_add_nav_item( __('Profile', 'buddypress'), $bp['profile']['slug'] );
    217         bp_core_add_nav_default( $bp['profile']['slug'], 'xprofile_screen_display_profile', 'public' );
    218        
    219         $profile_link = $bp['loggedin_domain'] . $bp['profile']['slug'] . '/';
     214        bp_core_add_nav_item( __('Profile', 'buddypress'), $bp->profile->slug );
     215        bp_core_add_nav_default( $bp->profile->slug, 'xprofile_screen_display_profile', 'public' );
     216       
     217        $profile_link = $bp->loggedin_user->domain . $bp->profile->slug . '/';
    220218       
    221219        /* Add the subnav items to the profile */
    222         bp_core_add_subnav_item( $bp['profile']['slug'], 'public', __('Public', 'buddypress'), $profile_link, 'xprofile_screen_display_profile' );
    223         bp_core_add_subnav_item( $bp['profile']['slug'], 'edit', __('Edit Profile', 'buddypress'), $profile_link, 'xprofile_screen_edit_profile' );
    224         bp_core_add_subnav_item( $bp['profile']['slug'], 'change-avatar', __('Change Avatar', 'buddypress'), $profile_link, 'xprofile_screen_change_avatar' );
    225 
    226         if ( $bp['current_component'] == $bp['profile']['slug'] ) {
     220        bp_core_add_subnav_item( $bp->profile->slug, 'public', __('Public', 'buddypress'), $profile_link, 'xprofile_screen_display_profile' );
     221        bp_core_add_subnav_item( $bp->profile->slug, 'edit', __('Edit Profile', 'buddypress'), $profile_link, 'xprofile_screen_edit_profile' );
     222        bp_core_add_subnav_item( $bp->profile->slug, 'change-avatar', __('Change Avatar', 'buddypress'), $profile_link, 'xprofile_screen_change_avatar' );
     223
     224        if ( $bp->current_component == $bp->profile->slug ) {
    227225                if ( bp_is_home() ) {
    228                         $bp['bp_options_title'] = __('My Profile', 'buddypress');
     226                        $bp->bp_options_title = __('My Profile', 'buddypress');
    229227                } else {
    230                         $bp['bp_options_avatar'] = bp_core_get_avatar( $bp['current_userid'], 1 );
    231                         $bp['bp_options_title'] = $bp['current_fullname'];
     228                        $bp->bp_options_avatar = bp_core_get_avatar( $bp->displayed_user->id, 1 );
     229                        $bp->bp_options_title = $bp->displayed_user->fullname;
    232230                }
    233231        }
    … …  
    254252        // logged in user. $is_new_friend is set in bp-core/bp-core-catchuri.php in bp_core_set_uri_globals()
    255253        if ( $is_new_friend )
    256                 bp_core_delete_notifications_for_user_by_item_id( $bp['loggedin_userid'], $bp['current_userid'], 'friends', 'friendship_accepted' );
     254                bp_core_delete_notifications_for_user_by_item_id( $bp->loggedin_user->id, $bp->displayed_user->id, 'friends', 'friendship_accepted' );
    257255       
    258256        do_action( 'xprofile_screen_display_profile', $is_new_friend );
    … …  
    307305function xprofile_screen_notification_settings() {
    308306        global $current_user; ?>
     307        <?php if ( function_exists('bp_wire_install') ) { ?>
    309308        <table class="notification-settings" id="profile-notification-settings">
    310309                <tr>
    … …  
    314313                        <th class="no"><?php _e( 'No', 'buddypress' )?></th>
    315314                </tr>
    316                 <?php if ( function_exists('bp_wire_install') ) { ?>
     315
    317316                <tr>
    318317                        <td></td>
    … …  
    321320                        <td class="no"><input type="radio" name="notifications[notification_profile_wire_post]" value="no" <?php if ( get_usermeta( $current_user->id, 'notification_profile_wire_post' ) == 'no' ) { ?>checked="checked" <?php } ?>/></td>
    322321                </tr>
    323                 <?php } ?>
    324322               
    325323                <?php do_action( 'xprofile_screen_notification_settings' ) ?>
    326324        </table>
     325        <?php } ?>
    327326<?php   
    328327}
    … …  
    346345        global $bp;
    347346       
    348         if ( 'delete-avatar' != $bp['current_action'] )
     347        if ( 'delete-avatar' != $bp->current_action )
    349348                return false;
    350349       
    … …  
    371370        global $bp;
    372371       
    373         if ( $bp['current_component'] != $bp['wire']['slug'] )
     372        if ( $bp->current_component != $bp->wire->slug )
    374373                return false;
    375374       
    376         if ( 'post' != $bp['current_action'] )
     375        if ( 'post' != $bp->current_action )
    377376                return false;
    378377       
    379         if ( !$wire_post_id = bp_wire_new_post( $bp['current_userid'], $_POST['wire-post-textarea'], $bp['profile']['slug'], false, $bp['profile']['table_name_wire'] ) ) {
     378        if ( !$wire_post_id = bp_wire_new_post( $bp->displayed_user->id, $_POST['wire-post-textarea'], $bp->profile->slug, false, $bp->profile->table_name_wire ) ) {
    380379                bp_core_add_message( __('Wire message could not be posted. Please try again.', 'buddypress'), 'error' );
    381380        } else {
    … …  
    385384        }
    386385
    387         if ( !strpos( $_SERVER['HTTP_REFERER'], $bp['wire']['slug'] ) ) {
    388                 bp_core_redirect( $bp['current_domain'] );
     386        if ( !strpos( $_SERVER['HTTP_REFERER'], $bp->wire->slug ) ) {
     387                bp_core_redirect( $bp->displayed_user->domain );
    389388        } else {
    390                 bp_core_redirect( $bp['current_domain'] . $bp['wire']['slug'] );
     389                bp_core_redirect( $bp->displayed_user->domain . $bp->wire->slug );
    391390        }
    392391}
    … …  
    408407        global $bp;
    409408       
    410         if ( $bp['current_component'] != $bp['wire']['slug'] )
     409        if ( $bp->current_component != $bp->wire->slug )
    411410                return false;
    412411       
    413         if ( $bp['current_action'] != 'delete' )
     412        if ( $bp->current_action != 'delete' )
    414413                return false;
    415414                       
    416         $wire_post_id = $bp['action_variables'][0];
    417        
    418         if ( bp_wire_delete_post( $wire_post_id, $bp['profile']['slug'], $bp['profile']['table_name_wire'] ) ) {
     415        $wire_post_id = $bp->action_variables[0];
     416       
     417        if ( bp_wire_delete_post( $wire_post_id, $bp->profile->slug, $bp->profile->table_name_wire ) ) {
    419418                bp_core_add_message( __('Wire message successfully deleted.', 'buddypress') );
    420419
    … …  
    424423        }
    425424       
    426         if ( !strpos( $_SERVER['HTTP_REFERER'], $bp['wire']['slug'] ) ) {
    427                 bp_core_redirect( $bp['current_domain'] );
     425        if ( !strpos( $_SERVER['HTTP_REFERER'], $bp->wire->slug ) ) {
     426                bp_core_redirect( $bp->displayed_user->domain );
    428427        } else {
    429                 bp_core_redirect( $bp['current_domain']. $bp['wire']['slug'] );
     428                bp_core_redirect( $bp->displayed_user->domain. $bp->wire->slug );
    430429        }
    431430}
    … …  
    499498                case 'new_wire_post':
    500499                        if ( class_exists('BP_Wire_Post') ) {
    501                                 $wire_post = new BP_Wire_Post( $bp['profile']['table_name_wire'], $item_id );
     500                                $wire_post = new BP_Wire_Post( $bp->profile->table_name_wire, $item_id );
    502501                        }
    503502                       
    … …  
    505504                                return false;
    506505                       
    507                         if ( ( $wire_post->item_id == $bp['loggedin_userid'] && $wire_post->user_id == $bp['loggedin_userid'] ) || ( $wire_post->item_id == $bp['current_userid'] && $wire_post->user_id == $bp['current_userid'] ) ) {
     506                        if ( ( $wire_post->item_id == $bp->loggedin_user->id && $wire_post->user_id == $bp->loggedin_user->id ) || ( $wire_post->item_id == $bp->displayed_user->id && $wire_post->user_id == $bp->displayed_user->id ) ) {
    508507                               
    509508                                $from_user_link = bp_core_get_userlink($wire_post->user_id);
    … …  
    513512                                $return_values['primary_link'] = bp_core_get_userlink( $wire_post->user_id, false, true );
    514513                       
    515                         } else if ( ( $wire_post->item_id != $bp['loggedin_userid'] && $wire_post->user_id == $bp['loggedin_userid'] ) || ( $wire_post->item_id != $bp['current_userid'] && $wire_post->user_id == $bp['current_userid'] ) ) {
     514                        } else if ( ( $wire_post->item_id != $bp->loggedin_user->id && $wire_post->user_id == $bp->loggedin_user->id ) || ( $wire_post->item_id != $bp->displayed_user->id && $wire_post->user_id == $bp->displayed_user->id ) ) {
    516515                       
    517516                                $from_user_link = bp_core_get_userlink($wire_post->user_id);
    … …  
    546545                        return array(
    547546                                'primary_link' => bp_core_get_userlink( $user_id, false, true ),
    548                                 'content' => apply_filters( 'xprofile_updated_profile_activity', sprintf( __('%s updated the "%s" information on their profile', 'buddypress'), $user_link, '<a href="' . $bp['current_domain'] . $bp['profile']['slug'] . '">' . $profile_group->name . '</a>' ) . ' <span class="time-since">%s</span>', $user_link, $profile_group->name )
     547                                'content' => apply_filters( 'xprofile_updated_profile_activity', sprintf( __('%s updated the "%s" information on their profile', 'buddypress'), $user_link, '<a href="' . $bp->displayed_user->domain . $bp->profile->slug . '">' . $profile_group->name . '</a>' ) . ' <span class="time-since">%s</span>', $user_link, $profile_group->name )
    549548                        );
    550549                break;
    … …  
    574573        if ( $action == 'new_wire_post') {
    575574                if ( (int)$total_items > 1 ) {
    576                         return apply_filters( 'bp_xprofile_multiple_new_wire_post_notification', '<a href="' . $bp['loggedin_domain'] . $bp['wire']['slug'] . '" title="Wire">' . sprintf( __('You have %d new posts on your wire'), (int)$total_items ) . '</a>', $total_items );             
     575                        return apply_filters( 'bp_xprofile_multiple_new_wire_post_notification', '<a href="' . $bp->loggedin_user->domain . $bp->wire->slug . '" title="Wire">' . sprintf( __('You have %d new posts on your wire'), (int)$total_items ) . '</a>', $total_items );             
    577576                } else {
    578577                        $user_fullname = bp_core_global_user_fullname( $item_id );
    579                         return apply_filters( 'bp_xprofile_single_new_wire_post_notification', '<a href="' . $bp['loggedin_domain'] . $bp['wire']['slug'] . '" title="Wire">' . sprintf( __('%s posted on your wire'), $user_fullname ) . '</a>', $user_fullname );
     578                        return apply_filters( 'bp_xprofile_single_new_wire_post_notification', '<a href="' . $bp->loggedin_user->domain . $bp->wire->slug . '" title="Wire">' . sprintf( __('%s posted on your wire'), $user_fullname ) . '</a>', $user_fullname );
    580579                }
    581580        }
    … …  
    647646                                                // If the field is required and has been left blank then we need to add a callback error.
    648647                                                if ( ( $field->is_required && !isset($current_field) ) ||
    649                                                      ( $field->is_required && $current_field == '' ) ) {
     648                                                     ( $field->is_required && empty( $current_field ) ) ) {
    650649                                                       
    651650                                                        // Add the error message to the errors array
    … …  
    655654                                                // If the field is not required and the field has been left blank, delete any values for the
    656655                                                // field from the database.
    657                                                 } else if ( !$field->is_required && ( $current_field == '' || is_null($current_field) ) ) {
     656                                                } else if ( !$field->is_required && ( empty( $current_field ) || is_null($current_field) ) ) {
    658657                                                       
    659658                                                        // Create a new profile data object for the logged in user based on field ID.                                                           
    … …  
    795794        $field_data[0]->value = xprofile_format_profile_field( $field_data[0]->type, $field_data[0]->value );
    796795       
    797         if ( !$field_data[0]->value || $field_data[0]->value == '' )
     796        if ( !$field_data[0]->value || empty( $field_data[0]->value ) )
    798797                return false;
    799798       
    … …  
    813812 */
    814813function xprofile_format_profile_field( $field_type, $field_value ) {
    815         if ( !isset($field_value) || $field_value == '' )
     814        if ( !isset($field_value) || empty( $field_value ) )
    816815                return false;
    817816       
  • trunk/bp-xprofile/bp-xprofile-admin.php

    r1017 r1021  
    9898                                                                <td><span title="<?php echo $field->desc; ?>"><?php echo $field->name; ?> <?php if(!$field->can_delete) { ?>(Core)<?php } ?></span></td>
    9999                                                                <td><?php echo $field->type; ?></td>
    100                                                                 <td style="text-align:center;"><?php if ( $field->is_required ) { echo '<img src="' . $bp['profile']['image_base'] . '/tick.gif" alt="Yes" />'; } else { ?>--<?php } ?></td>
     100                                                                <td style="text-align:center;"><?php if ( $field->is_required ) { echo '<img src="' . $bp->profile->image_base . '/tick.gif" alt="Yes" />'; } else { ?>--<?php } ?></td>
    101101                                                                <td style="text-align:center;"><?php if ( !$field->can_delete ) { ?><strike><?php _e( 'Edit', 'buddypress' ) ?></strike><?php } else { ?><a class="edit" href="admin.php?page=xprofile_settings&amp;group_id=<?php echo $groups[$i]->id; ?>&amp;field_id=<?php echo $field->id; ?>&amp;mode=edit_field"><?php _e( 'Edit', 'buddypress' ) ?></a><?php } ?></td>
    102102                                                                <td style="text-align:center;"><?php if ( !$field->can_delete ) { ?><strike><?php _e( 'Delete', 'buddypress' ) ?></strike><?php } else { ?><a class="delete" href="admin.php?page=xprofile_settings&amp;field_id=<?php echo $field->id; ?>&amp;mode=delete_field"><?php _e( 'Delete', 'buddypress' ) ?></a><?php } ?></td>
  • trunk/bp-xprofile/bp-xprofile-classes.php

    r850 r1021  
    2929                global $wpdb, $bp;
    3030               
    31                 $sql = $wpdb->prepare("SELECT * FROM " . $bp['profile']['table_name_groups'] . " WHERE id = %d", $id);
     31                $sql = $wpdb->prepare("SELECT * FROM {$bp->profile->table_name_groups} WHERE id = %d", $id);
    3232
    3333                if ( $group = $wpdb->get_row($sql) ) {
    … …  
    4747
    4848                if ( $this->id != null ) {
    49                         $sql = $wpdb->prepare("UPDATE " . $bp['profile']['table_name_groups'] . " SET name = %s, description = %s WHERE id = %d", $this->name, $this->description, $this->id);
    50                 } else {
    51                         $sql = $wpdb->prepare("INSERT INTO " . $bp['profile']['table_name_groups'] . " (name, description, can_delete) VALUES (%s, %s, 1)", $this->name, $this->description);           
     49                        $sql = $wpdb->prepare("UPDATE {$bp->profile->table_name_groups} SET name = %s, description = %s WHERE id = %d", $this->name, $this->description, $this->id);
     50                } else {
     51                        $sql = $wpdb->prepare("INSERT INTO {$bp->profile->table_name_groups} (name, description, can_delete) VALUES (%s, %s, 1)", $this->name, $this->description);             
    5252                }
    5353               
    … …  
    6464                        return false;
    6565               
    66                 $sql = $wpdb->prepare("DELETE FROM " . $bp['profile']['table_name_groups'] . " WHERE id = %d", $this->id);
     66                $sql = $wpdb->prepare( "DELETE FROM {$bp->profile->table_name_groups} WHERE id = %d", $this->id );
    6767
    6868                if ( $wpdb->query($sql) === false) {
    … …  
    8585
    8686                // Get field ids for the current group.
    87                 $sql = $wpdb->prepare("SELECT id, type FROM " . $bp['profile']['table_name_fields'] . " WHERE group_id = %d AND parent_id = 0 ORDER BY id", $this->id);
     87                $sql = $wpdb->prepare("SELECT id, type FROM {$bp->profile->table_name_fields} WHERE group_id = %d AND parent_id = 0 ORDER BY id", $this->id);
    8888
    8989                if(!$fields = $wpdb->get_results($sql))                 
    … …  
    143143
    144144                if ( $hide_empty ) {
    145                         $sql = $wpdb->prepare("SELECT DISTINCT g.* FROM " . $bp['profile']['table_name_groups'] . " g INNER JOIN " . $bp['profile']['table_name_fields'] . " f ON g.id = f.group_id ORDER BY g.id ASC");
    146                 } else {
    147                         $sql = $wpdb->prepare("SELECT * FROM " . $bp['profile']['table_name_groups'] . " ORDER BY id ASC");
     145                        $sql = $wpdb->prepare( "SELECT DISTINCT g.* FROM {$bp->profile->table_name_groups} g INNER JOIN {$bp->profile->table_name_fields} f ON g.id = f.group_id ORDER BY g.id ASC" );
     146                } else {
     147                        $sql = $wpdb->prepare( "SELECT * FROM {$bp->profile->table_name_groups} ORDER BY id ASC" );
    148148                }
    149149
    … …  
    163163               
    164164                // Validate Form
    165                 if ( $_POST['group_name'] == '' ) {
     165                if ( empty( $_POST['group_name'] ) ) {
    166166                        $message = __('Please make sure you give the group a name.', 'buddypress');
    167167                        return false;
    … …  
    204204                }
    205205               
    206                 $sql = $wpdb->prepare("SELECT * FROM " . $bp['profile']['table_name_fields'] . " WHERE id = %d", $id);
     206                $sql = $wpdb->prepare( "SELECT * FROM {$bp->profile->table_name_fields} WHERE id = %d", $id );
    207207       
    208208                if ( $field = $wpdb->get_row($sql) ) {
    … …  
    233233                        return false;
    234234                       
    235                 $sql = $wpdb->prepare("DELETE FROM " . $bp['profile']['table_name_fields'] . " WHERE id = %d OR parent_id = %d", $this->id, $this->id);
     235                $sql = $wpdb->prepare("DELETE FROM {$bp->profile->table_name_fields} WHERE id = %d OR parent_id = %d", $this->id, $this->id );
    236236
    237237                if ( $wpdb->query($sql) === false )
    … …  
    248248               
    249249                if ( $this->id != null ) {
    250                         $sql = $wpdb->prepare("UPDATE " . $bp['profile']['table_name_fields'] . " SET group_id = %d, parent_id = 0, type = %s, name = %s, description = %s, is_required = %d, is_public = %d, order_by = %s WHERE id = %d", $this->group_id, $this->type, $this->name, $this->desc, $this->is_required, $this->is_public, $this->order_by, $this->id);
    251                 } else {
    252                         $sql = $wpdb->prepare("INSERT INTO " . $bp['profile']['table_name_fields'] . " (group_id, parent_id, type, name, description, is_required, is_public, order_by) VALUES (%d, 0, %s, %s, %s, %d, %d, %s)", $this->group_id, $this->type, $this->name, $this->desc, $this->is_required, $this->is_public, $this->order_by);
     250                        $sql = $wpdb->prepare("UPDATE {$bp->profile->table_name_fields} SET group_id = %d, parent_id = 0, type = %s, name = %s, description = %s, is_required = %d, is_public = %d, order_by = %s WHERE id = %d", $this->group_id, $this->type, $this->name, $this->desc, $this->is_required, $this->is_public, $this->order_by, $this->id);
     251                } else {
     252                        $sql = $wpdb->prepare("INSERT INTO {$bp->profile->table_name_fields} (group_id, parent_id, type, name, description, is_required, is_public, order_by) VALUES (%d, 0, %s, %s, %s, %d, %d, %s)", $this->group_id, $this->type, $this->name, $this->desc, $this->is_required, $this->is_public, $this->order_by);
    253253                }
    254254                if ( $wpdb->query($sql) !== false ) {
    … …  
    298298                                                               
    299299                                                        if ( $num > 0 ) {
    300                                                                 $sql = $wpdb->prepare( "INSERT INTO " . $bp['profile']['table_name_fields'] . " (group_id, parent_id, type, name, description, is_required, option_order) VALUES (%d, %d, 'option', %s, %s, 0, %d)", $this->group_id, $parent_id, $name, $description, $option_order);
     300                                                                $sql = $wpdb->prepare( "INSERT INTO {$bp->profile->table_name_fields} (group_id, parent_id, type, name, description, is_required, option_order) VALUES (%d, %d, 'option', %s, %s, 0, %d)", $this->group_id, $parent_id, $name, $description, $option_order);
    301301                                                                $wpdb->query($sql);
    302302                                                        }
    … …  
    334334                                                        if ( $option_value != "" ) {
    335335                                                                // don't insert an empty option.
    336                                                                 $sql = $wpdb->prepare("INSERT INTO " . $bp['profile']['table_name_fields'] . " (group_id, parent_id, type, name, description, is_required, option_order, is_default_option) VALUES (%d, %d, 'option', %s, '', 0, %d, %d)", $this->group_id, $parent_id, $option_value, $counter, $is_default);
     336                                                                $sql = $wpdb->prepare("INSERT INTO {$bp->profile->table_name_fields} (group_id, parent_id, type, name, description, is_required, option_order, is_default_option) VALUES (%d, %d, 'option', %s, '', 0, %d, %d)", $this->group_id, $parent_id, $option_value, $counter, $is_default);
    337337
    338338                                                                if ( $wpdb->query($sql) === false ) {
    … …  
    464464                               
    465465                                if ( !$this->is_required ) {
    466                                         $html .= '<a class="clear-value" style="text-decoration: none;" href="javascript:clear(\'field_' . $this->id . '\');"><img src="' . $bp['profile']['image_base'] . '/cross.gif" alt="Clear" /> Clear</a>';
     466                                        $html .= '<a class="clear-value" style="text-decoration: none;" href="javascript:clear(\'field_' . $this->id . '\');"><img src="' . $bp->profile->image_base . '/cross.gif" alt="Clear" /> Clear</a>';
    467467                                }
    468468                               
    … …  
    596596                }
    597597               
    598                 $sql = $wpdb->prepare( "SELECT * FROM " . $bp['profile']['table_name_fields'] . " WHERE parent_id = %d AND group_id = %d $sort_sql", $parent_id, $this->group_id );
     598                $sql = $wpdb->prepare( "SELECT * FROM {$bp->profile->table_name_fields} WHERE parent_id = %d AND group_id = %d $sort_sql", $parent_id, $this->group_id );
    599599
    600600                if ( !$children = $wpdb->get_results($sql) )
    … …  
    607607                global $wpdb, $bp;
    608608
    609                 $sql = $wpdb->prepare("DELETE FROM " . $bp['profile']['table_name_fields'] . " WHERE parent_id = %d", $this->id);
     609                $sql = $wpdb->prepare("DELETE FROM {$bp->profile->table_name_fields} WHERE parent_id = %d", $this->id);
    610610
    611611                $wpdb->query($sql);
    … …  
    738738                                <p class="submit">
    739739                                                &nbsp;<input type="submit" value="<?php _e("Save", 'buddypress') ?> &raquo;" name="saveField" id="saveField" style="font-weight: bold" />
    740                                                  <?php _e('or', 'buddypress') ?> <a href="admin.php?page=xprofile_settings" style="color: red"><?php _e('Cancel', 'buddypress') ?></a>
     740                                                 <?php _e('or', 'buddypress') ?> <a href="admin.php?page=xprofile_settings" style="color: red"><?php _e( 'Cancel', 'buddypress' ) ?></a>
    741741                                </p>
    742742                       
    … …  
    751751                <div class="clear">&nbsp;</div><br />
    752752               
    753                 <h2>Add Prebuilt Field</h2>
     753                <h2><?php _e( 'Add Prebuilt Field', 'buddypress' ) ?></h2>
    754754                <?php $this->render_prebuilt_fields(); ?>
    755755               
    … …  
    894894                global $wpdb, $bp;
    895895               
    896                 $sql = $wpdb->prepare("SELECT f.id FROM " . $bp['profile']['table_name_fields'] . " AS f, " . $bp['profile']['table_name_groups'] . " AS g WHERE g.name = %s AND f.parent_id = 0        AND g.id = f.group_id ORDER BY f.id", get_site_option('bp-xprofile-base-group-name') );
     896                $sql = $wpdb->prepare( "SELECT f.id FROM {$bp->profile->table_name_fields} AS f, {$bp->profile->table_name_groups} AS g WHERE g.name = %s AND f.parent_id = 0   AND g.id = f.group_id ORDER BY f.id", get_site_option('bp-xprofile-base-group-name') );
    897897
    898898                if ( !$temp_fields = $wpdb->get_results($sql) )
    … …  
    910910               
    911911                // Validate Form
    912                 if ( $_POST['title'] == '' || $_POST['required'] == '' || $_POST['fieldtype'] == '' ) {
     912                if ( empty( $_POST['title'] ) || empty( $_POST['required'] ) || empty( $_POST['fieldtype'] ) ) {
    913913                        $message = __('Please make sure you fill out all required fields.', 'buddypress');
    914914                        return false;
    … …  
    934934
    935935                if ( $field_id ) {
    936                         $sql = $wpdb->prepare("SELECT type FROM " . $bp['profile']['table_name_fields'] . " WHERE id = %d", $field_id);
     936                        $sql = $wpdb->prepare( "SELECT type FROM {$bp->profile->table_name_fields} WHERE id = %d", $field_id );
    937937
    938938                        if ( !$field_type = $wpdb->get_var($sql) )
    … …  
    949949
    950950                if ( $group_id ) {
    951                         $sql = $wpdb->prepare("DELETE FROM " . $bp['profile']['table_name_fields'] . " WHERE group_id = %d", $group_id);
     951                        $sql = $wpdb->prepare( "DELETE FROM {$bp->profile->table_name_fields} WHERE group_id = %d", $group_id );
    952952
    953953                        if ( $wpdb->get_var($sql) === false ) {
    … …  
    982982                        $user_id = $userdata->ID;
    983983               
    984                 $sql = $wpdb->prepare("SELECT * FROM " . $bp['profile']['table_name_data'] . " WHERE field_id = %d AND user_id = %d", $field_id, $user_id);
     984                $sql = $wpdb->prepare( "SELECT * FROM {$bp->profile->table_name_data} WHERE field_id = %d AND user_id = %d", $field_id, $user_id );
    985985
    986986                if ( $profiledata = $wpdb->get_row($sql) ) {
    … …  
    997997               
    998998                // check to see if there is data already for the user.
    999                 $sql = $wpdb->prepare("SELECT id FROM " . $bp['profile']['table_name_data'] . " WHERE user_id = %d AND field_id = %d", $userdata->ID, $this->field_id);
     999                $sql = $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_data} WHERE user_id = %d AND field_id = %d", $userdata->ID, $this->field_id );
    10001000
    10011001                if ( !$wpdb->get_row($sql) )
    … …  
    10091009               
    10101010                // check to see if this data is actually for a valid field.
    1011                 $sql = $wpdb->prepare("SELECT id FROM " . $bp['profile']['table_name_fields'] . " WHERE id = %d", $this->field_id);
     1011                $sql = $wpdb->prepare("SELECT id FROM {$bp->profile->table_name_fields} WHERE id = %d", $this->field_id );
    10121012
    10131013                if ( !$wpdb->get_row($sql) )
    … …  
    10241024                if ( $this->is_valid_field() ) {
    10251025                        if ( $this->exists() && $this->value != '' ) {
    1026                                 $sql = $wpdb->prepare("UPDATE " . $bp['profile']['table_name_data'] . " SET value = %s, last_updated = %s WHERE user_id = %d AND field_id = %d", $this->value, $this->last_updated, $this->user_id, $this->field_id);
    1027                         } else if ( $this->exists() and $this->value == '' ) {
     1026                                $sql = $wpdb->prepare( "UPDATE {$bp->profile->table_name_data} SET value = %s, last_updated = %s WHERE user_id = %d AND field_id = %d", $this->value, $this->last_updated, $this->user_id, $this->field_id );
     1027                        } else if ( $this->exists() && empty( $this->value ) ) {
    10281028                                // Data removed, delete the entry.
    10291029                                $this->delete();
    10301030                        } else {
    1031                                 $sql = $wpdb->prepare("INSERT INTO " . $bp['profile']['table_name_data'] . " (user_id, field_id, value, last_updated) VALUES (%d, %d, %s, %s)", $this->user_id, $this->field_id, $this->value, $this->last_updated);
     1031                                $sql = $wpdb->prepare("INSERT INTO {$bp->profile->table_name_data} (user_id, field_id, value, last_updated) VALUES (%d, %d, %s, %s)", $this->user_id, $this->field_id, $this->value, $this->last_updated );
    10321032                        }
    10331033                                               
    … …  
    10471047                global $wpdb, $bp;
    10481048               
    1049                 $sql = $wpdb->prepare("DELETE FROM " . $bp['profile']['table_name_data'] . " WHERE field_id = %d AND user_id = %d", $this->field_id, $this->user_id);
     1049                $sql = $wpdb->prepare( "DELETE FROM {$bp->profile->table_name_data} WHERE field_id = %d AND user_id = %d", $this->field_id, $this->user_id );
    10501050
    10511051                if ( $wpdb->query($sql) === false )
    … …  
    10611061
    10621062                if ( !$user_id )
    1063                         $user_id = $bp['current_userid'];
    1064 
    1065                 $sql = $wpdb->prepare("SELECT * FROM " . $bp['profile']['table_name_data'] . " WHERE field_id = %d AND user_id = %d", $field_id, $user_id );
     1063                        $user_id = $bp->displayed_user->id;
     1064
     1065                $sql = $wpdb->prepare("SELECT * FROM {$bp->profile->table_name_data} WHERE field_id = %d AND user_id = %d", $field_id, $user_id );
    10661066
    10671067                if ( $profile_data = $wpdb->get_row($sql) ) {
    … …  
    10791079
    10801080                if ( !$user_id )
    1081                         $user_id = $bp['current_userid'];
    1082                
    1083                 if ( !$bp['profile'] )
     1081                        $user_id = $bp->displayed_user->id;
     1082               
     1083                if ( !$bp->profile )
    10841084                        xprofile_setup_globals();
    10851085               
    … …  
    10991099                }
    11001100
    1101                 $sql = $wpdb->prepare( "SELECT d.value, f.name FROM " . $bp['profile']['table_name_data'] . " d, " . $bp['profile']['table_name_fields'] . " f WHERE d.field_id = f.id AND d.user_id = %d AND f.parent_id = 0 $field_sql", $user_id );
     1101                $sql = $wpdb->prepare( "SELECT d.value, f.name FROM {$bp->profile->table_name_data} d, {$bp->profile->table_name_fields} f WHERE d.field_id = f.id AND d.user_id = %d AND f.parent_id = 0 $field_sql", $user_id );
    11021102
    11031103                if ( !$values = $wpdb->get_results($sql) )
    … …  
    11261126                global $wpdb, $userdata, $bp;
    11271127
    1128                 $sql = $wpdb->prepare("DELETE FROM " . $bp['profile']['table_name_data'] . " WHERE field_id = %d", $field_id);
     1128                $sql = $wpdb->prepare( "DELETE FROM {$bp->profile->table_name_data} WHERE field_id = %d", $field_id );
    11291129
    11301130                if ( $wpdb->query($sql) === false )
    … …  
    11371137                global $wpdb, $bp;
    11381138               
    1139                 $last_updated = $wpdb->get_var( $wpdb->prepare( "SELECT last_updated FROM " . $bp['profile']['table_name_data'] . " WHERE user_id = %d ORDER BY last_updated LIMIT 1", $user_id ) );
     1139                $last_updated = $wpdb->get_var( $wpdb->prepare( "SELECT last_updated FROM {$bp->profile->table_name_data} WHERE user_id = %d ORDER BY last_updated LIMIT 1", $user_id ) );
    11401140               
    11411141                return $last_updated;
    … …  
    11451145                global $wpdb, $bp;
    11461146               
    1147                 return $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['profile']['table_name_data'] . " WHERE user_id = %d", $user_id ) ); 
     1147                return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->profile->table_name_data} WHERE user_id = %d", $user_id ) );   
    11481148        }
    11491149       
    … …  
    11541154                        $exclude_sql = $wpdb->prepare( " AND pf.id != 1" );
    11551155                               
    1156                 return $wpdb->get_results( $wpdb->prepare( "SELECT pf.type, pf.name, pd.value FROM " . $bp['profile']['table_name_data'] . " pd INNER JOIN " . $bp['profile']['table_name_fields'] . " pf ON pd.field_id = pf.id AND pd.user_id = %d {$exclude_sql} ORDER BY RAND() LIMIT 1", $user_id ) );                     
     1156                return $wpdb->get_results( $wpdb->prepare( "SELECT pf.type, pf.name, pd.value FROM {$bp->profile->table_name_data} pd INNER JOIN {$bp->profile->table_name_fields} pf ON pd.field_id = pf.id AND pd.user_id = %d {$exclude_sql} ORDER BY RAND() LIMIT 1", $user_id ) );                 
    11571157        }
    11581158       
    … …  
    11611161
    11621162                if ( !$user_id )
    1163                         $user_id = $bp['current_userid'];
     1163                        $user_id = $bp->displayed_user->id;
    11641164
    11651165                $data = bp_get_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $user_id );
  • trunk/bp-xprofile/bp-xprofile-cssjs.php

    r938 r1021  
    3737        global $bp;
    3838
    39         if ( $_SERVER['SCRIPT_NAME'] == '/wp-activate.php' || $bp['current_component'] == ACTIVATION_SLUG || $bp['current_action'] == 'change-avatar' ) {
     39        if ( $_SERVER['SCRIPT_NAME'] == '/wp-activate.php' || $bp->current_component == ACTIVATION_SLUG || $bp->current_action == 'change-avatar' ) {
    4040                //wp_enqueue_script('jquery');
    4141                //wp_enqueue_script('prototype');
  • trunk/bp-xprofile/bp-xprofile-filters.php

    r858 r1021  
    1717
    1818function xprofile_filter_format_field_value( $field_value, $field_type ) {
    19         if ( !isset($field_value) || $field_value == '' )
     19        if ( !isset($field_value) || empty( $field_value ) )
    2020                return false;
    2121
  • trunk/bp-xprofile/bp-xprofile-notifications.php

    r565 r1021  
    2222        global $bp, $current_user;
    2323       
    24         if ( $bp['current_component'] == $bp['wire']['slug'] && !bp_is_home() ) {
     24        if ( $bp->current_component == $bp->wire->slug && !bp_is_home() ) {
    2525                bp_core_add_notification( $poster_id, $user_id, 'xprofile', 'new_wire_post' );
    2626
    27                 if ( !get_usermeta( $bp['loggedin_userid'], 'notification_profile_wire_post' ) || get_usermeta( $bp['loggedin_userid'], 'notification_profile_wire_post' ) == 'yes' ) {
     27                if ( !get_usermeta( $bp->loggedin_user->id, 'notification_profile_wire_post' ) || get_usermeta( $bp->loggedin_user->id, 'notification_profile_wire_post' ) == 'yes' ) {
    2828                        $poster_name = bp_fetch_user_fullname( $poster_id, false );
    29                         $wire_post = new BP_Wire_Post( $bp['profile']['table_name_wire'], $wire_post_id, true );
     29                        $wire_post = new BP_Wire_Post( $bp->profile->table_name_wire, $wire_post_id, true );
    3030                        $ud = get_userdata($user_id);
    3131                       
  • trunk/bp-xprofile/bp-xprofile-signup.php

    r730 r1021  
    130130                        );
    131131                       
    132                         if ( $field->is_required && $value == '' ) {
     132                        if ( $field->is_required && empty( $value ) ) {
    133133                                $bp_xprofile_callback[$counter]["error_msg"] = $field->name . ' cannot be left blank.';
    134134                                $has_errors = true;
    … …  
    225225        global $bp;
    226226       
    227         if ( $bp['current_component'] != $bp['blogs']['slug'] )
     227        if ( $bp->current_component != $bp->blogs->slug )
    228228                return $_SESSION['xprofile_meta'];
    229229        else
    … …  
    268268        // Loop through each bit of profile data and save it to profile.
    269269        for ( $i = 0; $i < count($field_ids); $i++ ) {
    270                 if ( $field_ids[$i] == '' ) continue;
     270                if ( empty( $field_ids[$i] ) ) continue;
    271271               
    272272                $field_value = $meta["field_{$field_ids[$i]}"];
  • trunk/bp-xprofile/bp-xprofile-templatetags.php

    r884 r1021  
    140140        global $bp, $profile_template;
    141141
    142         $profile_template = new BP_XProfile_Template($bp['current_userid']);
     142        $profile_template = new BP_XProfile_Template($bp->displayed_user->id);
    143143       
    144144        return $profile_template->has_groups();
    … …  
    227227        $groups = BP_XProfile_Group::get_all();
    228228       
    229         if ( $group_name == '' )
     229        if ( empty( $group_name ) )
    230230                $group_name = bp_profile_group_name(false);
    231231       
    … …  
    237237                }
    238238
    239                 echo '<li' . $selected . '><a href="' . $bp['loggedin_domain'] . $bp['profile']['slug'] . '/edit/group/' . $groups[$i]->id . '">' . $groups[$i]->name . '</a></li>';
     239                echo '<li' . $selected . '><a href="' . $bp->loggedin_user->domain . $bp->profile->slug . '/edit/group/' . $groups[$i]->id . '">' . $groups[$i]->name . '</a></li>';
    240240        }
    241241       
    … …  
    246246        global $bp;
    247247       
    248         $group_id = $bp['action_variables'][1];
     248        $group_id = $bp->action_variables[1];
    249249       
    250250        if ( !is_numeric( $group_id ) )
    … …  
    263263        global $bp;
    264264
    265         $group_id = $bp['action_variables'][1];
     265        $group_id = $bp->action_variables[1];
    266266
    267267        if ( !is_numeric( $group_id ) )
    268268                $group_id = 1; // 'Basic' group.
    269269       
    270         xprofile_edit( $group_id, $bp['loggedin_domain'] . $bp['profile']['slug'] . '/edit/group/' . $group_id . '/?mode=save' );
     270        xprofile_edit( $group_id, $bp->loggedin_user->domain . $bp->profile->slug . '/edit/group/' . $group_id . '/?mode=save' );
    271271}
    272272
    … …  
    274274        global $bp;
    275275         
    276         bp_core_avatar_admin( null, $bp['loggedin_domain'] . $bp['profile']['slug'] . '/change-avatar/', $bp['loggedin_domain'] . $bp['profile']['slug'] . '/delete-avatar/' );
     276        bp_core_avatar_admin( null, $bp->loggedin_user->domain . $bp->profile->slug . '/change-avatar/', $bp->loggedin_user->domain . $bp->profile->slug . '/delete-avatar/' );
    277277}
    278278
    … …  
    280280        global $bp;
    281281       
    282         $last_updated = get_usermeta( $bp['current_userid'], 'profile_last_updated' );
     282        $last_updated = get_usermeta( $bp->displayed_user->id, 'profile_last_updated' );
    283283
    284284        if ( !$last_updated ) {
    … …  
    294294        ?>
    295295        <div class="generic-button">
    296                 <a class="edit" title="<?php _e( 'Edit Profile', 'buddypress' ) ?>" href="<?php echo $bp['loggedin_domain'] . $bp['profile']['slug'] ?>/edit"><?php _e( 'Edit Profile', 'buddypress' ) ?></a>
     296                <a class="edit" title="<?php _e( 'Edit Profile', 'buddypress' ) ?>" href="<?php echo $bp->loggedin_user->domain . $bp->profile->slug ?>/edit"><?php _e( 'Edit Profile', 'buddypress' ) ?></a>
    297297        </div>
    298298        <?php
  • trunk/buddypress-theme/buddypress-home/functions.php

    r954 r1021  
    4747        global $bp, $query_string;
    4848       
    49         if ( $bp['current_component'] == HOME_BLOG_SLUG  ) {
     49        if ( $bp->current_component == HOME_BLOG_SLUG  ) {
    5050                $pos = strpos( $query_string, 'pagename=' . HOME_BLOG_SLUG );
    5151               
    … …  
    6868        global $bp, $current_blog;
    6969       
    70         if ( $bp['current_component'] == REGISTER_SLUG && $bp['current_action'] == '' ) {
     70        if ( $bp->current_component == REGISTER_SLUG && $bp->current_action == '' ) {
    7171                bp_core_signup_set_headers();
    7272                bp_core_load_template( 'register', true );
    … …  
    7878        global $bp, $current_blog;
    7979       
    80         if ( $bp['current_component'] == ACTIVATION_SLUG && $bp['current_action'] == '' ) {
     80        if ( $bp->current_component == ACTIVATION_SLUG && $bp->current_action == '' ) {
    8181                bp_core_activation_set_headers();
    8282                bp_core_load_template( 'activate', true );
  • trunk/buddypress-theme/member-themes/buddypress-member/functions.php

    r875 r1021  
    1111        global $bp, $is_single_group;
    1212
    13         if ( !bp_is_home() && $bp['current_component'] == 'profile' ||
    14                                                   $bp['current_component'] == 'blog' ||
    15                                                   $bp['current_component'] == 'friends' ||
    16                                                   $bp['current_component'] == 'blogs' ) {
    17                 if ( $bp['current_userid'] != $bp['loggedin_userid'] )
     13        if ( !bp_is_home() && $bp->current_component == 'profile' ||
     14                                                  $bp->current_component == 'blog' ||
     15                                                  $bp->current_component == 'friends' ||
     16                                                  $bp->current_component == 'blogs' ) {
     17                if ( $bp->displayed_user->id != $bp->loggedin_user->id )
    1818                        echo ' class="arrow"';
    1919        }
    2020       
    21         if ( ( $bp['current_component'] == 'groups' && $is_single_group ) || ( $bp['current_component'] == 'groups' && !bp_is_home() ) )
     21        if ( ( $bp->current_component == 'groups' && $is_single_group ) || ( $bp->current_component == 'groups' && !bp_is_home() ) )
    2222                echo ' class="arrow"'; 
    2323}
    … …  
    2626        global $bp;
    2727
    28         if ( ($bp['current_userid'] != $bp['loggedin_userid']) )
     28        if ( ($bp->displayed_user->id != $bp->loggedin_user->id) )
    2929                echo ' class="icons"';
    3030}
Note: See TracChangeset for help on using the changeset viewer.