Skip to:
Content

BuddyPress.org

Changeset 1021 for trunk/bp-activity.php


Ignore:
Timestamp:
02/06/2009 03:07:48 AM (17 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

File:
1 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       
Note: See TracChangeset for help on using the changeset viewer.