Skip to:
Content

BuddyPress.org

Changeset 1021 for trunk/bp-groups.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-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       
Note: See TracChangeset for help on using the changeset viewer.