Skip to:
Content

BuddyPress.org

Ticket #2600: 2600-2.patch

File 2600-2.patch, 7.5 KB (added by boonebgorges, 14 years ago)
  • bp-groups.php

     
    77function groups_setup_globals() {
    88        global $bp, $wpdb;
    99
    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       
    1315        /* For internal identification */
    1416        $bp->groups->id = 'groups';
    1517        $bp->groups->name = $bp->pages->groups->name;
    1618        $bp->groups->slug = BP_GROUPS_SLUG;
     19        $bp->groups->directory_slug = $bp->pages->groups->slug;
    1720
    1821        $bp->groups->table_name           = $bp->table_prefix . 'bp_groups';
    1922        $bp->groups->table_name_members   = $bp->table_prefix . 'bp_groups_members';
     
    4750function groups_setup_nav() {
    4851        global $bp;
    4952
    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) ) {
    5154
    5255                /* This is a single group page. */
    5356                $bp->is_single_item = true;
     
    7982        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' ) );
    8083        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() ) );
    8184
    82         if ( $bp->current_component == $bp->groups->slug ) {
     85        if ( $bp->current_component == $bp->groups->directory_slug ) {
    8386
    8487                if ( bp_is_my_profile() && !$bp->is_single_item ) {
    8588
     
    156159function groups_directory_groups_setup() {
    157160        global $bp;
    158161
    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 ) ) {
    160163                $bp->is_directory = true;
    161164
    162165                do_action( 'groups_directory_groups_setup' );
     
    585588function groups_screen_group_activity_permalink() {
    586589        global $bp;
    587590
    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] ) )
    589592                return false;
    590593
    591594        $bp->is_single_item = true;
     
    597600function groups_screen_group_admin() {
    598601        global $bp;
    599602
    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 )
    601604                return false;
    602605
    603606        if ( !empty( $bp->action_variables[0] ) )
     
    609612function groups_screen_group_admin_edit_details() {
    610613        global $bp;
    611614
    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] ) {
    613616
    614617                if ( $bp->is_item_admin || $bp->is_item_mod  ) {
    615618
     
    641644function groups_screen_group_admin_settings() {
    642645        global $bp;
    643646
    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] ) {
    645648
    646649                if ( !$bp->is_item_admin )
    647650                        return false;
     
    678681function groups_screen_group_admin_avatar() {
    679682        global $bp;
    680683
    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] ) {
    682685
    683686                if ( !$bp->is_item_admin )
    684687                        return false;
     
    736739function groups_screen_group_admin_manage_members() {
    737740        global $bp;
    738741
    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] ) {
    740743
    741744                if ( !$bp->is_item_admin )
    742745                        return false;
     
    842845function groups_screen_group_admin_requests() {
    843846        global $bp;
    844847
    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] ) {
    846849
    847850                /* Ask for a login if the user is coming here via an email notification */
    848851                if ( !is_user_logged_in() )
     
    900903function groups_screen_group_admin_delete_group() {
    901904        global $bp;
    902905
    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] ) {
    904907
    905908                if ( !$bp->is_item_admin && !is_super_admin() )
    906909                        return false;
     
    989992        global $bp;
    990993
    991994        /* 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 )
    993996                return false;
    994997
    995998        if ( !is_user_logged_in() )
     
    11621165function groups_action_join_group() {
    11631166        global $bp;
    11641167
    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' )
    11661169                return false;
    11671170
    11681171        // Nonce check
     
    11971200function groups_action_leave_group() {
    11981201        global $bp;
    11991202
    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' )
    12011204                return false;
    12021205
    12031206        // Nonce check
     
    12221225function groups_action_sort_creation_steps() {
    12231226        global $bp;
    12241227
    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' )
    12261229                return false;
    12271230
    12281231        if ( !is_array( $bp->groups->group_creation_steps ) )
     
    12461249function groups_action_redirect_to_random_group() {
    12471250        global $bp, $wpdb;
    12481251
    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'] ) ) {
    12501253                $group = groups_get_groups( array( 'type' => 'random', 'per_page' => 1 ) );
    12511254
    12521255                bp_core_redirect( $bp->root_domain . '/' . $bp->groups->slug . '/' . $group['groups'][0]->slug . '/' );
     
    12571260function groups_action_group_feed() {
    12581261        global $bp, $wp_query;
    12591262
    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' )
    12611264                return false;
    12621265
    12631266        $wp_query->is_404 = false;