Skip to:
Content

BuddyPress.org

Changeset 4844


Ignore:
Timestamp:
07/25/2011 12:01:55 AM (13 years ago)
Author:
boonebgorges
Message:

Global/slug audit for groups component. Also regularizes the way that some group forum actions are concatenated. See #3325

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-template.php

    r4840 r4844  
    761761    } else {
    762762        // When no $position is specified, check the entire array
    763         $is_action_variable = in_array( $action_variable, bp_action_variables() );
     763        $is_action_variable = in_array( $action_variable, (array)bp_action_variables() );
    764764    }
    765765   
  • trunk/bp-forums/bp-forums-template.php

    r4821 r4844  
    13801380}
    13811381    function bp_get_forum_topic_action() {
    1382         global $bp;
    1383 
    1384         return apply_filters( 'bp_get_forum_topic_action', bp_get_root_domain() . esc_attr( $_SERVER['REQUEST_URI'] ) );
     1382        return apply_filters( 'bp_get_forum_topic_action', $_SERVER['REQUEST_URI'] );
    13851383    }
    13861384
  • trunk/bp-groups/bp-groups-actions.php

    r4823 r4844  
    3030
    3131    // If no current step is set, reset everything so we can start a fresh group creation
    32     if ( !isset( $bp->action_variables[1] ) || !$bp->groups->current_create_step = $bp->action_variables[1] ) {
     32    if ( !bp_action_variable( 1 ) ) {
    3333
    3434        unset( $bp->groups->current_create_step );
     
    4343
    4444    // If this is a creation step that is not recognized, just redirect them back to the first screen
    45     if ( $bp->action_variables[1] && !$bp->groups->group_creation_steps[$bp->action_variables[1]] ) {
     45    if ( $step = bp_action_variable( 1 ) && !$bp->groups->group_creation_steps[$step] ) {
    4646        bp_core_add_message( __('There was an error saving group details. Please try again.', 'buddypress'), 'error' );
    4747        bp_core_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/' );
  • trunk/bp-groups/bp-groups-classes.php

    r4823 r4844  
    12511251
    12521252            // Catch the edit screen and forward it to the plugin template
    1253             if ( bp_is_groups_component() && bp_is_current_action( 'admin' ) && !empty( $bp->action_variables[0] ) && $this->slug == $bp->action_variables[0] ) {
     1253            if ( bp_is_groups_component() && bp_is_current_action( 'admin' ) && bp_is_action_variable( $this->slug, 0 ) ) {
    12541254                // Check whether the user is saving changes
    12551255                $this->edit_screen_save();
  • trunk/bp-groups/bp-groups-loader.php

    r4823 r4844  
    9797            // When in a single group, the first action is bumped down one because of the
    9898            // group name, so we need to adjust this and set the group name to current_item.
    99             $bp->current_item   = isset( $bp->current_action )      ? $bp->current_action      : false;
    100             $bp->current_action = isset( $bp->action_variables[0] ) ? $bp->action_variables[0] : false;
     99            $bp->current_item   = bp_current_action();
     100            $bp->current_action = bp_action_variable( 0 );
    101101            array_shift( $bp->action_variables );
    102102
  • trunk/bp-groups/bp-groups-screens.php

    r4823 r4844  
    3939
    4040function groups_screen_group_invites() {
    41     global $bp;
    42 
    43     $group_id = 0;
    44     if ( isset( $bp->action_variables[1] ) )
    45         $group_id = $bp->action_variables[1];
    46 
    47     if ( isset( $bp->action_variables ) && in_array( 'accept', (array)$bp->action_variables ) && is_numeric( $group_id ) ) {
     41    $group_id = (int)bp_action_variable( 1 );
     42
     43    if ( bp_is_action_variable( 'accept' ) && is_numeric( $group_id ) ) {
    4844        // Check the nonce
    4945        if ( !check_admin_referer( 'groups_accept_invite' ) )
    5046            return false;
    5147
    52         if ( !groups_accept_invite( $bp->loggedin_user->id, $group_id ) ) {
     48        if ( !groups_accept_invite( bp_loggedin_user_id(), $group_id ) ) {
    5349            bp_core_add_message( __('Group invite could not be accepted', 'buddypress'), 'error' );
    5450        } else {
     
    5955
    6056            groups_record_activity( array(
    61                 'action'  => apply_filters_ref_array( 'groups_activity_accepted_invite_action', array( sprintf( __( '%1$s joined the group %2$s', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $group ) . '">' . esc_attr( $group->name ) . '</a>' ), $bp->loggedin_user->id, &$group ) ),
     57                'action'  => apply_filters_ref_array( 'groups_activity_accepted_invite_action', array( sprintf( __( '%1$s joined the group %2$s', 'buddypress'), bp_core_get_userlink( bp_loggedin_user_id() ), '<a href="' . bp_get_group_permalink( $group ) . '">' . esc_attr( $group->name ) . '</a>' ), bp_loggedin_user_id(), &$group ) ),
    6258                'type'    => 'joined_group',
    6359                'item_id' => $group->id
     
    6561        }
    6662
    67         bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action );
    68 
    69     } elseif ( isset( $bp->action_variables ) && in_array( 'reject', (array)$bp->action_variables ) && is_numeric( $group_id ) ) {
     63        bp_core_redirect( bp_loggedin_user_domain() . bp_get_groups_slug() . '/' . bp_current_action() );
     64
     65    } else if ( bp_is_action_variable( 'reject' ) && is_numeric( $group_id ) ) {
    7066        // Check the nonce
    7167        if ( !check_admin_referer( 'groups_reject_invite' ) )
    7268            return false;
    7369
    74         if ( !groups_reject_invite( $bp->loggedin_user->id, $group_id ) )
     70        if ( !groups_reject_invite( bp_loggedin_user_id(), $group_id ) )
    7571            bp_core_add_message( __('Group invite could not be rejected', 'buddypress'), 'error' );
    7672        else
    7773            bp_core_add_message( __('Group invite rejected', 'buddypress') );
    7874
    79         bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action );
     75        bp_core_redirect( bp_loggedin_user_domain() . bp_get_groups_slug() . '/' . bp_current_action() );
    8076    }
    8177
    8278    // Remove notifications
    83     bp_core_delete_notifications_by_type( $bp->loggedin_user->id, $bp->groups->id, 'group_invite' );
     79    bp_core_delete_notifications_by_type( bp_loggedin_user_id(), 'groups', 'group_invite' );
    8480
    8581    do_action( 'groups_screen_group_invites', $group_id );
     
    105101}
    106102
     103/**
     104 * This screen function handles actions related to group forums
     105 *
     106 * @package BuddyPress
     107 */
    107108function groups_screen_group_forum() {
    108109    global $bp;
     
    111112        return false;
    112113
    113     if ( !empty( $bp->action_variables[0] ) && 'topic' != $bp->action_variables[0] ) {
     114    if ( bp_action_variable( 0 ) && !bp_is_action_variable( 'topic', 0 ) ) {
    114115        bp_do_404();
    115116        return;
     
    124125
    125126        // Fetch the details we need
    126         $topic_slug     = !empty( $bp->action_variables[1] ) ? $bp->action_variables[1] : false;
     127        $topic_slug = (string)bp_action_variable( 1 );
    127128        $topic_id       = bp_forums_get_topic_id_from_slug( $topic_slug );
    128129        $forum_id       = groups_get_groupmeta( $bp->groups->current_group->id, 'forum_id' );
     
    135136
    136137            // Posting a reply
    137             if ( !$user_is_banned && !isset( $bp->action_variables[2] ) && isset( $_POST['submit_reply'] ) ) {
     138            if ( !$user_is_banned && !bp_action_variable( 2 ) && isset( $_POST['submit_reply'] ) ) {
    138139                // Check the nonce
    139140                check_admin_referer( 'bp_forums_new_reply' );
     
    153154                    $query_vars = '?' . $_SERVER['QUERY_STRING'];
    154155
    155                 bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic_slug . '/' . $query_vars . '#post-' . $post_id );
     156                bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) . 'forum/topic/' . $topic_slug . '/' . $query_vars . '#post-' . $post_id );
    156157            }
    157158
    158159            // Sticky a topic
    159             else if ( isset( $bp->action_variables[2] ) && 'stick' == $bp->action_variables[2] && ( isset( $bp->is_item_admin ) || isset( $bp->is_item_mod ) ) ) {
     160            else if ( bp_is_action_variable( 'stick', 2 ) && ( isset( $bp->is_item_admin ) || isset( $bp->is_item_mod ) ) ) {
    160161                // Check the nonce
    161162                check_admin_referer( 'bp_forums_stick_topic' );
     
    171172
    172173            // Un-Sticky a topic
    173             else if ( isset( $bp->action_variables[2] ) && 'unstick' == $bp->action_variables[2] && ( isset( $bp->is_item_admin ) || isset( $bp->is_item_mod ) ) ) {
     174            else if ( bp_is_action_variable( 'unstick', 2 ) && ( isset( $bp->is_item_admin ) || isset( $bp->is_item_mod ) ) ) {
    174175                // Check the nonce
    175176                check_admin_referer( 'bp_forums_unstick_topic' );
     
    185186
    186187            // Close a topic
    187             else if ( isset( $bp->action_variables[2] ) && 'close' == $bp->action_variables[2] && ( isset( $bp->is_item_admin ) || isset( $bp->is_item_mod ) ) ) {
     188            else if ( bp_is_action_variable( 'close', 2 ) && ( isset( $bp->is_item_admin ) || isset( $bp->is_item_mod ) ) ) {
    188189                // Check the nonce
    189190                check_admin_referer( 'bp_forums_close_topic' );
     
    199200
    200201            // Open a topic
    201             else if ( isset( $bp->action_variables[2] ) && 'open' == $bp->action_variables[2] && ( isset( $bp->is_item_admin ) || isset( $bp->is_item_mod ) ) ) {
     202            else if ( bp_is_action_variable( 'open', 2 ) && ( isset( $bp->is_item_admin ) || isset( $bp->is_item_mod ) ) ) {
    202203                // Check the nonce
    203204                check_admin_referer( 'bp_forums_open_topic' );
     
    213214
    214215            // Delete a topic
    215             else if ( empty( $user_is_banned ) && isset( $bp->action_variables[2] ) && 'delete' == $bp->action_variables[2] && empty( $bp->action_variables[3] ) ) {
     216            else if ( empty( $user_is_banned ) && bp_is_action_variable( 'delete', 2 ) && !bp_action_variable( 3 ) ) {
    216217                // Fetch the topic
    217218                $topic = bp_forums_get_topic_details( $topic_id );
     
    232233
    233234                do_action( 'groups_delete_forum_topic', $topic_id );
    234                 bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'forum/' );
     235                bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) . 'forum/' );
    235236            }
    236237
    237238            // Editing a topic
    238             else if ( empty( $user_is_banned ) && isset( $bp->action_variables[2] ) && 'edit' == $bp->action_variables[2] && empty( $bp->action_variables[3] ) ) {
     239            else if ( empty( $user_is_banned ) && bp_is_action_variable( 'edit', 2 ) && !bp_action_variable( 3 ) ) {
    239240                // Fetch the topic
    240241                $topic = bp_forums_get_topic_details( $topic_id );
     
    256257
    257258                    do_action( 'groups_edit_forum_topic', $topic_id );
    258                     bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic_slug . '/' );
     259                    bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) . 'forum/topic/' . $topic_slug . '/' );
    259260                }
    260261
     
    263264
    264265            // Delete a post
    265             elseif ( empty( $user_is_banned ) && isset( $bp->action_variables[2] ) && 'delete' == $bp->action_variables[2] && isset( $bp->action_variables[4] ) && $post_id = $bp->action_variables[4] ) {
     266            else if ( empty( $user_is_banned ) && bp_is_action_variable( 'delete', 2 ) && $post_id = bp_action_variable( 4 ) ) {
    266267                // Fetch the post
    267268                $post = bp_forums_get_post( $post_id );
     
    276277                do_action( 'groups_before_delete_forum_post', $post_id );
    277278
    278                 if ( !groups_delete_group_forum_post( $bp->action_variables[4], $topic_id ) )
     279                if ( !groups_delete_group_forum_post( $post_id ) )
    279280                    bp_core_add_message( __( 'There was an error deleting that post', 'buddypress'), 'error' );
    280281                else
     
    286287
    287288            // Editing a post
    288             elseif ( empty( $user_is_banned ) && isset( $bp->action_variables[2] ) && 'edit' == $bp->action_variables[2] && isset( $bp->action_variables[4] ) && $post_id = $bp->action_variables[4] ) {
     289            else if ( empty( $user_is_banned ) && bp_is_action_variable( 'edit', 2 ) && $post_id = bp_action_variable( 4 ) ) {
    289290                // Fetch the post
    290                 $post = bp_forums_get_post( $bp->action_variables[4] );
     291                $post = bp_forums_get_post( $post_id );
    291292
    292293                // Check the logged in user can edit this topic
     
    298299                    check_admin_referer( 'bp_forums_edit_post' );
    299300
    300                     if ( !$post_id = groups_update_group_forum_post( $post_id, $_POST['post_text'], $topic_id, $_GET['topic_page'] ) )
     301                    $topic_page = isset( $_GET['topic_page'] ) ? $_GET['topic_page'] : false;
     302
     303                    if ( !$post_id = groups_update_group_forum_post( $post_id, $_POST['post_text'], $topic_id, $topic_page ) )
    301304                        bp_core_add_message( __( 'There was an error when editing that post', 'buddypress'), 'error' );
    302305                    else
     
    387390
    388391    if ( $bp->is_single_item ) {
    389         if ( !empty( $bp->action_variables[0] ) && 'send' == $bp->action_variables[0] ) {
     392        if ( bp_is_action_variable( 'send', 0 ) ) {
    390393
    391394            if ( !check_admin_referer( 'groups_send_invites', '_wpnonce_send_invites' ) )
     
    404407            bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );
    405408
    406         } elseif ( empty( $bp->action_variables[0] ) ) {
     409        } elseif ( !bp_action_variable( 0 ) ) {
    407410            // Show send invite page
    408411            bp_core_load_template( apply_filters( 'groups_template_group_invite', 'groups/single/home' ) );
     
    444447    global $bp;
    445448
    446     if ( !bp_is_groups_component() || !bp_is_active( 'activity' ) || ( bp_is_active( 'activity' ) && !bp_is_current_action( bp_get_activity_slug() ) ) || empty( $bp->action_variables[0] ) )
     449    if ( !bp_is_groups_component() || !bp_is_active( 'activity' ) || ( bp_is_active( 'activity' ) && !bp_is_current_action( bp_get_activity_slug() ) ) || !bp_action_variable( 0 ) )
    447450        return false;
    448451
     
    454457
    455458function groups_screen_group_admin() {
    456     global $bp;
    457 
    458459    if ( !bp_is_groups_component() || !bp_is_current_action( 'admin' ) )
    459460        return false;
    460461
    461     if ( !empty( $bp->action_variables[0] ) )
     462    if ( bp_action_variables() )
    462463        return false;
    463464
    464     bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/edit-details/' );
     465    bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) . 'admin/edit-details/' );
    465466}
    466467
     
    468469    global $bp;
    469470
    470     if ( bp_is_groups_component() && isset( $bp->action_variables[0] ) && 'edit-details' == $bp->action_variables[0] ) {
     471    if ( bp_is_groups_component() && bp_is_action_variable( 'edit-details', 0 ) ) {
    471472
    472473        if ( $bp->is_item_admin || $bp->is_item_mod  ) {
     
    486487                do_action( 'groups_group_details_edited', $bp->groups->current_group->id );
    487488
    488                 bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/edit-details/' );
     489                bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) . 'admin/edit-details/' );
    489490            }
    490491
     
    500501    global $bp;
    501502
    502     if ( bp_is_groups_component() && isset( $bp->action_variables[0] ) && 'group-settings' == $bp->action_variables[0] ) {
     503    if ( bp_is_groups_component() && bp_is_action_variable( 'group-settings', 0 ) ) {
    503504
    504505        if ( !$bp->is_item_admin )
     
    529530            do_action( 'groups_group_settings_edited', $bp->groups->current_group->id );
    530531
    531             bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/group-settings/' );
     532            bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) . 'admin/group-settings/' );
    532533        }
    533534
     
    542543    global $bp;
    543544
    544     if ( bp_is_groups_component() && isset( $bp->action_variables[0] ) && 'group-avatar' == $bp->action_variables[0] ) {
     545    if ( bp_is_groups_component() && bp_is_action_variable( 'group-avatar', 0 ) ) {
    545546
    546547        if ( !$bp->is_item_admin )
     
    548549
    549550        // If the group admin has deleted the admin avatar
    550         if ( isset( $bp->action_variables[1] ) && 'delete' == $bp->action_variables[1] ) {
     551        if ( bp_is_action_variable( 'delete', 1 ) ) {
    551552
    552553            // Check the nonce
     
    597598add_action( 'bp_screens', 'groups_screen_group_admin_avatar' );
    598599
     600/**
     601 * This function handles actions related to member management on the group admin.
     602 *
     603 * @package BuddyPress
     604 */
    599605function groups_screen_group_admin_manage_members() {
    600606    global $bp;
    601607
    602     if ( bp_is_groups_component() && isset( $bp->action_variables[0] ) && 'manage-members' == $bp->action_variables[0] ) {
     608    if ( bp_is_groups_component() && bp_is_action_variable( 'manage-members', 0 ) ) {
    603609
    604610        if ( !$bp->is_item_admin )
    605611            return false;
    606612
    607         if ( isset( $bp->action_variables[1] ) && isset( $bp->action_variables[2] ) && isset( $bp->action_variables[3] ) ) {
    608             if ( 'promote' == $bp->action_variables[1] && ( 'mod' == $bp->action_variables[2] || 'admin' == $bp->action_variables[2] ) && is_numeric( $bp->action_variables[3] ) ) {
    609                 $user_id = $bp->action_variables[3];
    610                 $status  = $bp->action_variables[2];
    611 
     613        if ( bp_action_variable( 1 ) && bp_action_variable( 2 ) && bp_action_variable( 3 ) ) {
     614            if ( bp_is_action_variable( 'promote', 1 ) && ( bp_is_action_variable( 'mod', 2 ) || bp_is_action_variable( 'admin', 2 ) ) && is_numeric( bp_action_variable( 3 ) ) ) {
     615                $user_id = bp_action_variable( 3 );
     616                $status  = bp_action_variable( 2 );
     617               
    612618                // Check the nonce first.
    613619                if ( !check_admin_referer( 'groups_promote_member' ) )
     
    622628                do_action( 'groups_promoted_member', $user_id, $bp->groups->current_group->id );
    623629
    624                 bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/manage-members/' );
    625             }
    626         }
    627 
    628         if ( isset( $bp->action_variables[1] ) && isset( $bp->action_variables[2] ) ) {
    629             if ( 'demote' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
    630                 $user_id = $bp->action_variables[2];
     630                bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) . 'admin/manage-members/' );
     631            }
     632        }
     633
     634        if ( bp_action_variable( 1 ) && bp_action_variable( 2 ) ) {
     635            if ( bp_is_action_variable( 'demote', 1 ) && is_numeric( bp_action_variable( 2 ) ) ) {
     636                $user_id = bp_action_variable( 2 );
    631637
    632638                // Check the nonce first.
     
    642648                do_action( 'groups_demoted_member', $user_id, $bp->groups->current_group->id );
    643649
    644                 bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/manage-members/' );
    645             }
    646 
    647             if ( 'ban' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
    648                 $user_id = $bp->action_variables[2];
    649 
     650                bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) . 'admin/manage-members/' );
     651            }
     652
     653            if ( bp_is_action_variable( 'ban', 1 ) && is_numeric( bp_action_variable( 2 ) ) ) {
     654                $user_id = bp_action_variable( 2 );
     655               
    650656                // Check the nonce first.
    651657                if ( !check_admin_referer( 'groups_ban_member' ) )
     
    660666                do_action( 'groups_banned_member', $user_id, $bp->groups->current_group->id );
    661667
    662                 bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/manage-members/' );
    663             }
    664 
    665             if ( 'unban' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
    666                 $user_id = $bp->action_variables[2];
    667 
     668                bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) . 'admin/manage-members/' );
     669            }
     670
     671            if ( bp_is_action_variable( 'unban', 1 ) && is_numeric( bp_action_variable( 2 ) ) ) {
     672                $user_id = bp_action_variable( 2 );
     673               
    668674                // Check the nonce first.
    669675                if ( !check_admin_referer( 'groups_unban_member' ) )
     
    678684                do_action( 'groups_unbanned_member', $user_id, $bp->groups->current_group->id );
    679685
    680                 bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/manage-members/' );
    681             }
    682 
    683             if ( 'remove' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
    684                 $user_id = $bp->action_variables[2];
    685 
     686                bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) . 'admin/manage-members/' );
     687            }
     688
     689            if ( bp_is_action_variable( 'remove', 1 ) && is_numeric( bp_action_variable( 2 ) ) ) {
     690                $user_id = bp_action_variable( 2 );
     691               
    686692                // Check the nonce first.
    687693                if ( !check_admin_referer( 'groups_remove_member' ) )
     
    696702                do_action( 'groups_removed_member', $user_id, $bp->groups->current_group->id );
    697703
    698                 bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/manage-members/' );
     704                bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) . 'admin/manage-members/' );
    699705            }
    700706        }
     
    710716    global $bp;
    711717
    712     if ( bp_is_groups_component() && isset( $bp->action_variables[0] ) && 'membership-requests' == $bp->action_variables[0] ) {
    713 
    714         // Ask for a login if the user is coming here via an email notification
    715         if ( !is_user_logged_in() )
    716             bp_core_redirect( site_url( 'wp-login.php?redirect_to=' . bp_get_root_domain() . '/' . $bp->current_component . '/' . bp_current_item() . '/admin/membership-requests/' ) );
     718    if ( bp_is_groups_component() && bp_is_action_variable( 'membership-requests', 0 ) ) {
    717719
    718720        if ( !$bp->is_item_admin || 'public' == $bp->groups->current_group->status )
     
    720722
    721723        // Remove any screen notifications
    722         bp_core_delete_notifications_by_type( $bp->loggedin_user->id, $bp->groups->id, 'new_membership_request' );
    723 
    724         $request_action = ( !empty( $bp->action_variables[1] ) ? $bp->action_variables[1] : '' );
    725         $membership_id  = ( !empty( $bp->action_variables[2] ) ? $bp->action_variables[2] : 0 );
     724        bp_core_delete_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'new_membership_request' );
     725
     726        $request_action = (string)bp_action_variable( 1 );
     727        $membership_id  = (int)bp_action_variable( 2 );
    726728
    727729        if ( !empty( $request_action ) && !empty( $membership_id ) ) {
     
    751753
    752754            do_action( 'groups_group_request_managed', $bp->groups->current_group->id, $request_action, $membership_id );
    753             bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/membership-requests/' );
     755            bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) . 'admin/membership-requests/' );
    754756        }
    755757
     
    763765    global $bp;
    764766
    765     if ( bp_is_groups_component() && isset( $bp->action_variables[0] ) && 'delete-group' == $bp->action_variables[0] ) {
     767    if ( bp_is_groups_component() && bp_is_action_variable( 'delete-group', 0 ) ) {
    766768
    767769        if ( !$bp->is_item_admin && !is_super_admin() )
     
    783785                do_action( 'groups_group_deleted', $bp->groups->current_group->id );
    784786
    785                 bp_core_redirect( $bp->loggedin_user->domain . bp_get_groups_slug() . '/' );
    786             }
    787 
    788             bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component );
     787                bp_core_redirect( bp_loggedin_user_domain() . bp_get_groups_slug() . '/' );
     788            }
     789
     790            bp_core_redirect( bp_loggedin_user_domain() . bp_get_groups_slug() );
    789791        }
    790792
  • trunk/bp-groups/bp-groups-template.php

    r4823 r4844  
    12671267        $group = ( $groups_template->group ) ? $groups_template->group : $bp->groups->current_group;
    12681268
    1269     $current_tab = $bp->action_variables[0];
     1269    $current_tab = bp_action_variable( 0 );
    12701270?>
    12711271    <?php if ( $bp->is_item_admin || $bp->is_item_mod ) { ?>
     
    13141314}
    13151315    function bp_get_group_admin_form_action( $page = false, $group = false ) {
    1316         global $bp, $groups_template;
     1316        global $groups_template;
    13171317
    13181318        if ( !$group )
     
    13201320
    13211321        if ( !$page )
    1322             $page = $bp->action_variables[0];
     1322            $page = bp_action_variable( 0 );
    13231323
    13241324        return apply_filters( 'bp_group_admin_form_action', bp_get_group_permalink( $group ) . 'admin/' . $page );
     
    13261326
    13271327function bp_group_has_requested_membership( $group = false ) {
    1328     global $bp, $groups_template;
     1328    global $groups_template;
    13291329
    13301330    if ( !$group )
    13311331        $group =& $groups_template->group;
    13321332
    1333     if ( groups_check_for_membership_request( $bp->loggedin_user->id, $group->id ) )
     1333    if ( groups_check_for_membership_request( bp_loggedin_user_id(), $group->id ) )
    13341334        return true;
    13351335
     
    20152015        global $bp;
    20162016
    2017         if ( empty( $bp->action_variables[1] ) )
     2017        if ( !bp_action_variable( 1 ) )
    20182018            $bp->action_variables[1] = array_shift( array_keys( $bp->groups->group_creation_steps ) );
    20192019
    2020         return apply_filters( 'bp_get_group_creation_form_action', bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . $bp->action_variables[1] );
     2020        return apply_filters( 'bp_get_group_creation_form_action', bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . bp_action_variable( 1 ) );
    20212021    }
    20222022
     
    20292029
    20302030    /* If this the first step, we can just accept and return true */
    2031     if ( !$bp->action_variables[1] && array_shift( array_keys( $bp->groups->group_creation_steps ) ) == $step_slug )
     2031    if ( !bp_action_variable( 1 ) && array_shift( array_keys( $bp->groups->group_creation_steps ) ) == $step_slug )
    20322032        return true;
    20332033
     
    20392039
    20402040    /* Check the current step against the step parameter */
    2041     if ( $bp->action_variables[1] == $step_slug )
     2041    if ( bp_is_action_variable( $step_slug ) )
    20422042        return true;
    20432043
     
    21752175
    21762176        foreach ( (array)$bp->groups->group_creation_steps as $slug => $name ) {
    2177             if ( $slug == $bp->action_variables[1] )
     2177            if ( bp_is_action_variable( $slug ) )
    21782178                break;
    21792179
     
    21812181        }
    21822182
    2183         return apply_filters( 'bp_get_group_creation_previous_link', $bp->loggedin_user->domain . bp_get_groups_slug() . '/create/step/' . array_pop( $previous_steps ) );
     2183        return apply_filters( 'bp_get_group_creation_previous_link', bp_get_root_domain() . bp_get_groups_slug() . '/create/step/' . array_pop( $previous_steps ) );
    21842184    }
    21852185
     
    22612261}
    22622262
     2263/**
     2264 * Displays group header tabs
     2265 *
     2266 * @package BuddyPress
     2267 * @todo Deprecate?
     2268 */
    22632269function bp_groups_header_tabs() {
    2264     global $bp, $create_group_step, $completed_to_step;
     2270    global $create_group_step, $completed_to_step;
    22652271?>
    2266     <li<?php if ( !isset($bp->action_variables[0]) || 'recently-active' == $bp->action_variables[0] ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . bp_get_groups_slug() ?>/my-groups/recently-active"><?php _e( 'Recently Active', 'buddypress' ) ?></a></li>
    2267     <li<?php if ( 'recently-joined' == $bp->action_variables[0] ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . bp_get_groups_slug() ?>/my-groups/recently-joined"><?php _e( 'Recently Joined', 'buddypress' ) ?></a></li>
    2268     <li<?php if ( 'most-popular'    == $bp->action_variables[0] ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . bp_get_groups_slug() ?>/my-groups/most-popular"><?php _e( 'Most Popular', 'buddypress' ) ?></a></li>
    2269     <li<?php if ( 'admin-of'        == $bp->action_variables[0] ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . bp_get_groups_slug() ?>/my-groups/admin-of"><?php _e( 'Administrator Of', 'buddypress' ) ?></a></li>
    2270     <li<?php if ( 'mod-of'          == $bp->action_variables[0] ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . bp_get_groups_slug() ?>/my-groups/mod-of"><?php _e( 'Moderator Of', 'buddypress' ) ?></a></li>
    2271     <li<?php if ( 'alphabetically'  == $bp->action_variables[0] ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . bp_get_groups_slug() ?>/my-groups/alphabetically"><?php _e( 'Alphabetically', 'buddypress' ) ?></a></li>
     2272    <li<?php if ( !bp_action_variable( 0 ) || bp_is_action_variable( 'recently-active', 0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . bp_get_groups_slug() ?>/my-groups/recently-active"><?php _e( 'Recently Active', 'buddypress' ) ?></a></li>
     2273    <li<?php if ( bp_is_action_variable( 'recently-joined', 0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . bp_get_groups_slug() ?>/my-groups/recently-joined"><?php _e( 'Recently Joined', 'buddypress' ) ?></a></li>
     2274    <li<?php if ( bp_is_action_variable( 'most-popular', 0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . bp_get_groups_slug() ?>/my-groups/most-popular"><?php _e( 'Most Popular', 'buddypress' ) ?></a></li>
     2275    <li<?php if ( bp_is_action_variable( 'admin-of', 0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . bp_get_groups_slug() ?>/my-groups/admin-of"><?php _e( 'Administrator Of', 'buddypress' ) ?></a></li>
     2276    <li<?php if ( bp_is_action_variable( 'mod-of', 0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . bp_get_groups_slug() ?>/my-groups/mod-of"><?php _e( 'Moderator Of', 'buddypress' ) ?></a></li>
     2277    <li<?php if ( bp_is_action_variable( 'alphabetically' ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . bp_get_groups_slug() ?>/my-groups/alphabetically"><?php _e( 'Alphabetically', 'buddypress' ) ?></a></li>
    22722278<?php
    22732279    do_action( 'groups_header_tabs' );
    22742280}
    22752281
     2282/**
     2283 * Displays group filter titles
     2284 *
     2285 * @package BuddyPress
     2286 * @todo Deprecate?
     2287 */
    22762288function bp_groups_filter_title() {
    2277     global $bp;
    2278 
    2279     $current_filter = $bp->action_variables[0];
     2289    $current_filter = bp_action_variable( 0 );
    22802290
    22812291    switch ( $current_filter ) {
     
    23032313
    23042314function bp_is_group_admin_screen( $slug ) {
    2305     global $bp;
    2306 
    23072315    if ( !bp_is_groups_component() || !bp_is_current_action( 'admin' ) )
    23082316        return false;
    23092317
    2310     if ( $bp->action_variables[0] == $slug )
     2318    if ( bp_is_action_variable( $slug ) )
    23112319        return true;
    23122320
Note: See TracChangeset for help on using the changeset viewer.