Ticket #2600: 2600-2.patch
File 2600-2.patch, 7.5 KB (added by , 13 years ago) |
---|
-
bp-groups.php
7 7 function groups_setup_globals() { 8 8 global $bp, $wpdb; 9 9 10 if ( !defined( 'BP_GROUPS_SLUG' ) ) 11 define ( 'BP_GROUPS_SLUG', $bp->pages->groups->slug ); 12 10 if ( !defined( 'BP_GROUPS_SLUG' ) ) { 11 $slug_chunks = explode( '/', $bp->pages->groups->slug ); 12 define( 'BP_GROUPS_SLUG', array_pop( $slug_chunks ) ); 13 } 14 13 15 /* For internal identification */ 14 16 $bp->groups->id = 'groups'; 15 17 $bp->groups->name = $bp->pages->groups->name; 16 18 $bp->groups->slug = BP_GROUPS_SLUG; 19 $bp->groups->directory_slug = $bp->pages->groups->slug; 17 20 18 21 $bp->groups->table_name = $bp->table_prefix . 'bp_groups'; 19 22 $bp->groups->table_name_members = $bp->table_prefix . 'bp_groups_members'; … … 47 50 function groups_setup_nav() { 48 51 global $bp; 49 52 50 if ( $bp->current_component == $bp->groups-> slug && $group_id = BP_Groups_Group::group_exists($bp->current_action) ) {53 if ( $bp->current_component == $bp->groups->directory_slug && $group_id = BP_Groups_Group::group_exists($bp->current_action) ) { 51 54 52 55 /* This is a single group page. */ 53 56 $bp->is_single_item = true; … … 79 82 bp_core_new_subnav_item( array( 'name' => __( 'My Groups', 'buddypress' ), 'slug' => 'my-groups', 'parent_url' => $groups_link, 'parent_slug' => $bp->groups->name, 'screen_function' => 'groups_screen_my_groups', 'position' => 10, 'item_css_id' => 'groups-my-groups' ) ); 80 83 bp_core_new_subnav_item( array( 'name' => __( 'Invites', 'buddypress' ), 'slug' => 'invites', 'parent_url' => $groups_link, 'parent_slug' => $bp->groups->name, 'screen_function' => 'groups_screen_group_invites', 'position' => 30, 'user_has_access' => bp_is_my_profile() ) ); 81 84 82 if ( $bp->current_component == $bp->groups-> slug ) {85 if ( $bp->current_component == $bp->groups->directory_slug ) { 83 86 84 87 if ( bp_is_my_profile() && !$bp->is_single_item ) { 85 88 … … 156 159 function groups_directory_groups_setup() { 157 160 global $bp; 158 161 159 if ( $bp->current_component == $bp->groups-> slug && empty( $bp->current_action ) && empty( $bp->current_item ) ) {162 if ( $bp->current_component == $bp->groups->directory_slug && empty( $bp->current_action ) && empty( $bp->current_item ) ) { 160 163 $bp->is_directory = true; 161 164 162 165 do_action( 'groups_directory_groups_setup' ); … … 585 588 function groups_screen_group_activity_permalink() { 586 589 global $bp; 587 590 588 if ( $bp->current_component != $bp->groups-> slug || $bp->current_action != $bp->activity->slug || empty( $bp->action_variables[0] ) )591 if ( $bp->current_component != $bp->groups->directory_slug || $bp->current_action != $bp->activity->slug || empty( $bp->action_variables[0] ) ) 589 592 return false; 590 593 591 594 $bp->is_single_item = true; … … 597 600 function groups_screen_group_admin() { 598 601 global $bp; 599 602 600 if ( $bp->current_component != BP_GROUPS_SLUG|| 'admin' != $bp->current_action )603 if ( $bp->current_component != $bp->groups->directory_slug || 'admin' != $bp->current_action ) 601 604 return false; 602 605 603 606 if ( !empty( $bp->action_variables[0] ) ) … … 609 612 function groups_screen_group_admin_edit_details() { 610 613 global $bp; 611 614 612 if ( $bp->current_component == $bp->groups-> slug && 'edit-details' == $bp->action_variables[0] ) {615 if ( $bp->current_component == $bp->groups->directory_slug && 'edit-details' == $bp->action_variables[0] ) { 613 616 614 617 if ( $bp->is_item_admin || $bp->is_item_mod ) { 615 618 … … 641 644 function groups_screen_group_admin_settings() { 642 645 global $bp; 643 646 644 if ( $bp->current_component == $bp->groups-> slug && 'group-settings' == $bp->action_variables[0] ) {647 if ( $bp->current_component == $bp->groups->directory_slug && 'group-settings' == $bp->action_variables[0] ) { 645 648 646 649 if ( !$bp->is_item_admin ) 647 650 return false; … … 678 681 function groups_screen_group_admin_avatar() { 679 682 global $bp; 680 683 681 if ( $bp->current_component == $bp->groups-> slug && 'group-avatar' == $bp->action_variables[0] ) {684 if ( $bp->current_component == $bp->groups->directory_slug && 'group-avatar' == $bp->action_variables[0] ) { 682 685 683 686 if ( !$bp->is_item_admin ) 684 687 return false; … … 736 739 function groups_screen_group_admin_manage_members() { 737 740 global $bp; 738 741 739 if ( $bp->current_component == $bp->groups-> slug && 'manage-members' == $bp->action_variables[0] ) {742 if ( $bp->current_component == $bp->groups->directory_slug && 'manage-members' == $bp->action_variables[0] ) { 740 743 741 744 if ( !$bp->is_item_admin ) 742 745 return false; … … 842 845 function groups_screen_group_admin_requests() { 843 846 global $bp; 844 847 845 if ( $bp->current_component == $bp->groups-> slug && 'membership-requests' == $bp->action_variables[0] ) {848 if ( $bp->current_component == $bp->groups->directory_slug && 'membership-requests' == $bp->action_variables[0] ) { 846 849 847 850 /* Ask for a login if the user is coming here via an email notification */ 848 851 if ( !is_user_logged_in() ) … … 900 903 function groups_screen_group_admin_delete_group() { 901 904 global $bp; 902 905 903 if ( $bp->current_component == $bp->groups-> slug && 'delete-group' == $bp->action_variables[0] ) {906 if ( $bp->current_component == $bp->groups->directory_slug && 'delete-group' == $bp->action_variables[0] ) { 904 907 905 908 if ( !$bp->is_item_admin && !is_super_admin() ) 906 909 return false; … … 989 992 global $bp; 990 993 991 994 /* If we're not at domain.org/groups/create/ then return false */ 992 if ( $bp->current_component != $bp->groups-> slug || 'create' != $bp->current_action )995 if ( $bp->current_component != $bp->groups->directory_slug || 'create' != $bp->current_action ) 993 996 return false; 994 997 995 998 if ( !is_user_logged_in() ) … … 1162 1165 function groups_action_join_group() { 1163 1166 global $bp; 1164 1167 1165 if ( !$bp->is_single_item || $bp->current_component != $bp->groups-> slug || $bp->current_action != 'join' )1168 if ( !$bp->is_single_item || $bp->current_component != $bp->groups->directory_slug || $bp->current_action != 'join' ) 1166 1169 return false; 1167 1170 1168 1171 // Nonce check … … 1197 1200 function groups_action_leave_group() { 1198 1201 global $bp; 1199 1202 1200 if ( !$bp->is_single_item || $bp->current_component != $bp->groups-> slug || $bp->current_action != 'leave-group' )1203 if ( !$bp->is_single_item || $bp->current_component != $bp->groups->directory_slug || $bp->current_action != 'leave-group' ) 1201 1204 return false; 1202 1205 1203 1206 // Nonce check … … 1222 1225 function groups_action_sort_creation_steps() { 1223 1226 global $bp; 1224 1227 1225 if ( $bp->current_component != BP_GROUPS_SLUG&& $bp->current_action != 'create' )1228 if ( $bp->current_component != $bp->groups->directory_slug && $bp->current_action != 'create' ) 1226 1229 return false; 1227 1230 1228 1231 if ( !is_array( $bp->groups->group_creation_steps ) ) … … 1246 1249 function groups_action_redirect_to_random_group() { 1247 1250 global $bp, $wpdb; 1248 1251 1249 if ( $bp->current_component == $bp->groups-> slug && isset( $_GET['random-group'] ) ) {1252 if ( $bp->current_component == $bp->groups->directory_slug && isset( $_GET['random-group'] ) ) { 1250 1253 $group = groups_get_groups( array( 'type' => 'random', 'per_page' => 1 ) ); 1251 1254 1252 1255 bp_core_redirect( $bp->root_domain . '/' . $bp->groups->slug . '/' . $group['groups'][0]->slug . '/' ); … … 1257 1260 function groups_action_group_feed() { 1258 1261 global $bp, $wp_query; 1259 1262 1260 if ( !bp_is_active( 'activity' ) || $bp->current_component != $bp->groups-> slug || !isset( $bp->groups->current_group ) || $bp->current_action != 'feed' )1263 if ( !bp_is_active( 'activity' ) || $bp->current_component != $bp->groups->directory_slug || !isset( $bp->groups->current_group ) || $bp->current_action != 'feed' ) 1261 1264 return false; 1262 1265 1263 1266 $wp_query->is_404 = false;