Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/02/2015 01:58:52 AM (9 years ago)
Author:
tw2113
Message:

More documentation cleanup for the Members component.

See #6402.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-members/bp-members-admin.php

    r10314 r10322  
    1515 * Load Members admin area.
    1616 *
    17  * @package BuddyPress
    18  * @subpackage membersAdministration
    19  *
    2017 * @since 2.0.0
    2118 */
     
    103100
    104101        // Paths and URLs
    105         $this->admin_dir = trailingslashit( $bp->plugin_dir  . 'bp-members/admin' ); // Admin path
    106         $this->admin_url = trailingslashit( $bp->plugin_url  . 'bp-members/admin' ); // Admin URL
    107         $this->css_url   = trailingslashit( $this->admin_url . 'css' ); // Admin CSS URL
    108         $this->js_url    = trailingslashit( $this->admin_url . 'js'  ); // Admin CSS URL
    109 
    110         // Capability depends on config
     102        $this->admin_dir = trailingslashit( $bp->plugin_dir  . 'bp-members/admin' ); // Admin path.
     103        $this->admin_url = trailingslashit( $bp->plugin_url  . 'bp-members/admin' ); // Admin URL.
     104        $this->css_url   = trailingslashit( $this->admin_url . 'css' ); // Admin CSS URL.
     105        $this->js_url    = trailingslashit( $this->admin_url . 'js'  ); // Admin CSS URL.
     106
     107        // Capability depends on config.
    111108        $this->capability = bp_core_do_network_admin() ? 'manage_network_users' : 'edit_users';
    112109
    113         // The Edit Profile Screen id
     110        // The Edit Profile Screen id.
    114111        $this->user_page = '';
    115112
    116         // The Show Profile Screen id
     113        // The Show Profile Screen id.
    117114        $this->user_profile = is_network_admin() ? 'users' : 'profile';
    118115
    119         // The current user id
     116        // The current user id.
    120117        $this->current_user_id = get_current_user_id();
    121118
    122         // The user id being edited
     119        // The user id being edited.
    123120        $this->user_id = 0;
    124121
    125         // Is a member editing their own profile
     122        // Is a member editing their own profile.
    126123        $this->is_self_profile = false;
    127124
    128         // The screen ids to load specific css for
     125        // The screen ids to load specific css for.
    129126        $this->screen_id = array();
    130127
    131         // The stats metabox default position
     128        // The stats metabox default position.
    132129        $this->stats_metabox = new StdClass();
    133130
    134         // BuddyPress edit user's profile args
     131        // BuddyPress edit user's profile args.
    135132        $this->edit_profile_args = array( 'page' => 'bp-profile-edit' );
    136133        $this->edit_profile_url  = '';
    137134        $this->edit_url          = '';
    138135
    139         // Data specific to signups
     136        // Data specific to signups.
    140137        $this->users_page   = '';
    141138        $this->signups_page = '';
     
    143140        $this->users_screen = bp_core_do_network_admin() ? 'users-network' : 'users';
    144141
    145         // Specific config: BuddyPress is not network activated
     142        // Specific config: BuddyPress is not network activated.
    146143        $this->subsite_activated = (bool) is_multisite() && ! bp_is_network_activated();
    147144
    148         // When BuddyPress is not network activated, only Super Admin can moderate signups
     145        // When BuddyPress is not network activated, only Super Admin can moderate signups.
    149146        if ( ! empty( $this->subsite_activated ) ) {
    150147            $this->capability = 'manage_network_users';
     
    159156    private function setup_actions() {
    160157
    161         /** Extended Profile **************************************************/
    162 
    163         // Enqueue all admin JS and CSS
     158        /** Extended Profile *************************************************
     159         */
     160
     161        // Enqueue all admin JS and CSS.
    164162        add_action( 'bp_admin_enqueue_scripts', array( $this, 'enqueue_scripts'   )        );
    165163
    166         // Add some page specific output to the <head>
     164        // Add some page specific output to the <head>.
    167165        add_action( 'bp_admin_head',            array( $this, 'admin_head'        ), 999   );
    168166
    169         // Add menu item to all users menu
     167        // Add menu item to all users menu.
    170168        add_action( 'admin_menu',               array( $this, 'admin_menus'       ), 5     );
    171169        add_action( 'network_admin_menu',       array( $this, 'admin_menus'       ), 5     );
    172170        add_action( 'user_admin_menu',          array( $this, 'user_profile_menu' ), 5     );
    173171
    174         // Create the Profile Navigation (Profile/Extended Profile)
     172        // Create the Profile Navigation (Profile/Extended Profile).
    175173        add_action( 'edit_user_profile',        array( $this, 'profile_nav'       ), 99, 1 );
    176174        add_action( 'show_user_profile',        array( $this, 'profile_nav'       ), 99, 1 );
    177175
    178         // Editing users of a specific site
     176        // Editing users of a specific site.
    179177        add_action( "admin_head-site-users.php", array( $this, 'profile_admin_head' ) );
    180178
    181         // Add a row action to users listing
     179        // Add a row action to users listing.
    182180        if ( bp_core_do_network_admin() ) {
    183181            add_filter( 'ms_user_row_actions',        array( $this, 'row_actions'                    ), 10, 2 );
     
    186184        }
    187185
    188         // Add user row actions for single site
     186        // Add user row actions for single site.
    189187        add_filter( 'user_row_actions', array( $this, 'row_actions' ), 10, 2 );
    190188
     
    192190        add_action( 'bp_members_admin_load', array( $this, 'process_member_type_update' ) );
    193191
    194         /** Signups ***********************************************************/
     192        /** Signups **********************************************************
     193         */
    195194
    196195        if ( is_admin() ) {
    197196
    198             // Filter non multisite user query to remove sign-up users
     197            // Filter non multisite user query to remove sign-up users.
    199198            if ( ! is_multisite() ) {
    200199                add_action( 'pre_user_query', array( $this, 'remove_signups_from_user_query' ), 10, 1 );
    201200            }
    202201
    203             // Reorganise the views navigation in users.php and signups page
     202            // Reorganise the views navigation in users.php and signups page.
    204203            if ( current_user_can( $this->capability ) ) {
    205204                add_filter( "views_{$this->users_screen}", array( $this, 'signup_filter_view'    ), 10, 1 );
     
    226225        $this->user_id = (int) get_current_user_id();
    227226
    228         // We'll need a user ID when not on self profile
     227        // We'll need a user ID when not on self profile.
    229228        if ( ! empty( $_GET['user_id'] ) ) {
    230229            $this->user_id = (int) $_GET['user_id'];
     
    237236     * Can the current user edit the one displayed.
    238237     *
    239      * self profile editing / or bp_moderate check.
     238     * Self profile editing / or bp_moderate check.
    240239     * This might be replaced by more granular capabilities
    241240     * in the future.
     
    250249        $retval = false;
    251250
    252         // Bail if no user ID was passed
     251        // Bail if no user ID was passed.
    253252        if ( empty( $user_id ) ) {
    254253            return $retval;
    255254        }
    256255
    257         // Member can edit if they are viewing their own profile
     256        // Member can edit if they are viewing their own profile.
    258257        if ( $this->current_user_id === $user_id ) {
    259258            $retval = true;
    260259
    261         // Trust the 'bp_moderate' capability
     260        // Trust the 'bp_moderate' capability.
    262261        } else {
    263262            $retval = bp_current_user_can( 'bp_moderate' );
     
    276275    private function get_user_notice() {
    277276
    278         // Setup empty notice for return value
     277        // Setup empty notice for return value.
    279278        $notice = array();
    280279
    281         // Updates
     280        // Updates.
    282281        if ( ! empty( $_REQUEST['updated'] ) ) {
    283282            switch ( $_REQUEST['updated'] ) {
     
    309308        }
    310309
    311         // Errors
     310        // Errors.
    312311        if ( ! empty( $_REQUEST['error'] ) ) {
    313312            switch ( $_REQUEST['error'] ) {
     
    363362    public function user_profile_menu() {
    364363
    365         // Setup the hooks array
     364        // Setup the hooks array.
    366365        $hooks = array();
    367366
    368         // Add the faux "Edit Profile" submenu page
     367        // Add the faux "Edit Profile" submenu page.
    369368        $hooks['user'] = $this->user_page = add_submenu_page(
    370369            'profile.php',
     
    376375        );
    377376
    378         // Setup the screen ID's
     377        // Setup the screen ID's.
    379378        $this->screen_id = array(
    380379            $this->user_page    . '-user',
     
    382381        );
    383382
    384         // Loop through new hooks and add method actions
     383        // Loop through new hooks and add method actions.
    385384        foreach ( $hooks as $key => $hook ) {
    386385            add_action( "load-{$hook}", array( $this, $key . '_admin_load' ) );
    387386        }
    388387
    389         // Add the profile_admin_head method to proper admin_head actions
     388        // Add the profile_admin_head method to proper admin_head actions.
    390389        add_action( "admin_head-{$this->user_page}", array( $this, 'profile_admin_head' ) );
    391390        add_action( "admin_head-profile.php",        array( $this, 'profile_admin_head' ) );
     
    401400    public function admin_menus() {
    402401
    403         // Setup the hooks array
     402        // Setup the hooks array.
    404403        $hooks = array();
    405404
    406         // Manage user's profile
     405        // Manage user's profile.
    407406        $hooks['user'] = $this->user_page = add_submenu_page(
    408407            $this->user_profile . '.php',
     
    414413        );
    415414
    416         // Only show sign-ups where they belong
     415        // Only show sign-ups where they belong.
    417416        if ( ! is_multisite() || is_network_admin() ) {
    418417
    419             // Manage signups
     418            // Manage signups.
    420419            $hooks['signups'] = $this->signups_page = add_users_page(
    421420                __( 'Manage Signups',  'buddypress' ),
     
    431430        $this->users_page  = 'users';
    432431
    433         // Self profile check is needed for this pages
     432        // Self profile check is needed for this pages.
    434433        $page_head = array(
    435434            $edit_page        . '.php',
     
    439438        );
    440439
    441         // Append '-network' to each array item if in network admin
     440        // Append '-network' to each array item if in network admin.
    442441        if ( is_network_admin() ) {
    443442            $edit_page          .= '-network';
     
    448447        }
    449448
    450         // Setup the screen ID's
     449        // Setup the screen ID's.
    451450        $this->screen_id = array(
    452451            $edit_page,
     
    455454        );
    456455
    457         // Loop through new hooks and add method actions
     456        // Loop through new hooks and add method actions.
    458457        foreach ( $hooks as $key => $hook ) {
    459458            add_action( "load-{$hook}", array( $this, $key . '_admin_load' ) );
    460459        }
    461460
    462         // Add the profile_admin_head method to proper admin_head actions
     461        // Add the profile_admin_head method to proper admin_head actions.
    463462        foreach ( $page_head as $head ) {
    464463            add_action( "admin_head-{$head}", array( $this, 'profile_admin_head' ) );
     
    478477            $this->is_self_profile = true;
    479478
    480         // Is the user attempting to edit their own profile
     479        // Is the user attempting to edit their own profile.
    481480        } elseif ( isset( $_GET['user_id' ] ) || ( isset( $_GET['page'] ) && ( 'bp-profile-edit' === $_GET['page'] ) ) ) {
    482481            $this->is_self_profile = (bool) ( $this->get_user_id() === $this->current_user_id );
     
    490489        }
    491490
    492         // Editing your own profile, so recheck some vars
     491        // Editing your own profile, so recheck some vars.
    493492        if ( true === $this->is_self_profile ) {
    494493
    495             // Use profile.php as the edit page
     494            // Use profile.php as the edit page.
    496495            $edit_page = 'profile.php';
    497496
    498             // Set profile.php as the parent & sub files to correct the menu nav
     497            // Set profile.php as the parent & sub files to correct the menu nav.
    499498            if ( is_blog_admin() || is_user_admin() ) {
    500499                $parent_file  = 'profile.php';
     
    502501            }
    503502
    504         // Not editing yourself, so use user-edit.php
     503        // Not editing yourself, so use user-edit.php.
    505504        } else {
    506505            $edit_page = 'user-edit.php';
     
    566565        }
    567566
    568         // Only load JavaScript for BuddyPress profile
     567        // Only load JavaScript for BuddyPress profile.
    569568        if ( get_current_screen()->id == $this->user_page ) {
    570569            $js = $this->js_url . "admin{$min}.js";
     
    599598     * @param object|null $user   User to create profile navigation for.
    600599     * @param string      $active Which profile to highlight.
    601      *
    602600     * @return string
    603601     */
    604602    public function profile_nav( $user = null, $active = 'WordPress' ) {
    605603
    606         // Bail if no user ID exists here
     604        // Bail if no user ID exists here.
    607605        if ( empty( $user->ID ) ) {
    608606            return;
    609607        }
    610608
    611         // Add the user ID to query arguments when not editing yourself
     609        // Add the user ID to query arguments when not editing yourself.
    612610        if ( false === $this->is_self_profile ) {
    613611            $query_args = array( 'user_id' => $user->ID );
     
    616614        }
    617615
    618         // Conditionally add a referer if it exists in the existing request
     616        // Conditionally add a referer if it exists in the existing request.
    619617        if ( ! empty( $_REQUEST['wp_http_referer'] ) ) {
    620618            $query_args['wp_http_referer'] = urlencode( stripslashes_deep( $_REQUEST['wp_http_referer'] ) );
    621619        }
    622620
    623         // Setup the two distinct "edit" URL's
     621        // Setup the two distinct "edit" URL's.
    624622        $community_url = add_query_arg( $query_args, $this->edit_profile_url );
    625623        $wordpress_url = add_query_arg( $query_args, $this->edit_url         );
     
    662660    public function user_admin_load() {
    663661
    664         // Get the user ID
     662        // Get the user ID.
    665663        $user_id = $this->get_user_id();
    666664
    667         // can current user edit this profile ?
     665        // Can current user edit this profile?
    668666        if ( ! $this->member_can_edit( $user_id ) ) {
    669667            wp_die( __( 'You cannot edit the requested user.', 'buddypress' ) );
    670668        }
    671669
    672         // Build redirection URL
     670        // Build redirection URL.
    673671        $redirect_to = remove_query_arg( array( 'action', 'error', 'updated', 'spam', 'ham', 'delete_avatar' ), $_SERVER['REQUEST_URI'] );
    674672        $doaction    = ! empty( $_REQUEST['action'] ) ? $_REQUEST['action'] : false;
     
    701699        $allowed_actions = apply_filters( 'bp_members_admin_allowed_actions', array( 'update', 'delete_avatar', 'spam', 'ham' ) );
    702700
    703         // Prepare the display of the Community Profile screen
     701        // Prepare the display of the Community Profile screen.
    704702        if ( ! in_array( $doaction, $allowed_actions ) ) {
    705703            add_screen_option( 'layout_columns', array( 'default' => 2, 'max' => 2, ) );
     
    714712            ) );
    715713
    716             // Help panel - sidebar links
     714            // Help panel - sidebar links.
    717715            get_current_screen()->set_help_sidebar(
    718716                '<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .
     
    731729            );
    732730
    733             // In case xprofile is not active
     731            // In case xprofile is not active.
    734732            $this->stats_metabox->context  = 'normal';
    735733            $this->stats_metabox->priority = 'core';
     
    748746            do_action_ref_array( 'bp_members_admin_xprofile_metabox', array( $user_id, get_current_screen()->id, $this->stats_metabox ) );
    749747
    750             // If xProfile is inactive, difficult to know what's profile we're on
     748            // If xProfile is inactive, difficult to know what's profile we're on.
    751749            if ( 'normal' === $this->stats_metabox->context ) {
    752750                $display_name = bp_core_get_user_displayname( $user_id );
     
    755753            }
    756754
    757             // User Stat metabox
     755            // User Stat metabox.
    758756            add_meta_box(
    759757                'bp_members_admin_user_stats',
     
    793791            do_action( 'bp_members_admin_user_metaboxes', $this->is_self_profile, $user_id );
    794792
    795             // Enqueue JavaScript files
     793            // Enqueue JavaScript files.
    796794            wp_enqueue_script( 'postbox'   );
    797795            wp_enqueue_script( 'dashboard' );
    798796
    799         // Spam or Ham user
     797        // Spam or Ham user.
    800798        } elseif ( in_array( $doaction, array( 'spam', 'ham' ) ) && empty( $this->is_self_profile ) ) {
    801799
     
    810808            bp_core_redirect( $redirect_to );
    811809
    812         // Update other stuff once above ones are done
     810        // Update other stuff once above ones are done.
    813811        } else {
    814812            $this->redirect = $redirect_to;
     
    841839        }
    842840
    843         // Get the user ID
     841        // Get the user ID.
    844842        $user_id = $this->get_user_id();
    845843        $user    = get_user_to_edit( $user_id );
    846844
    847         // Construct title
     845        // Construct title.
    848846        if ( true === $this->is_self_profile ) {
    849847            $title = __( 'Profile',   'buddypress' );
     
    852850        }
    853851
    854         // Construct URL for form
     852        // Construct URL for form.
    855853        $request_url     = remove_query_arg( array( 'action', 'error', 'updated', 'spam', 'ham' ), $_SERVER['REQUEST_URI'] );
    856854        $form_action_url = add_query_arg( 'action', 'update', $request_url );
     
    860858        }
    861859
    862         // Prepare notice for admin
     860        // Prepare notice for admin.
    863861        $notice = $this->get_user_notice();
    864862
     
    947945    public function user_admin_status_metabox( $user = null ) {
    948946
    949         // Bail if no user id or if the user has not activated their account yet
     947        // Bail if no user id or if the user has not activated their account yet.
    950948        if ( empty( $user->ID ) ) {
    951949            return;
    952950        }
    953951
    954         // Bail if user has not been activated yet (how did you get here?)
     952        // Bail if user has not been activated yet (how did you get here?).
    955953        if ( isset( $user->user_status ) && ( 2 == $user->user_status ) ) : ?>
    956954
     
    966964                    <?php
    967965
    968                     // Get the spam status once here to compare against below
     966                    // Get the spam status once here to compare against below.
    969967                    $is_spammer = bp_is_user_spammer( $user->ID );
    970968
     
    989987                        <?php
    990988
    991                         // translators: Publish box date format, see http://php.net/date
     989                        // Translators: Publish box date format, see http://php.net/date.
    992990                        $datef = __( 'M j, Y @ G:i', 'buddypress' );
    993991                        $date  = date_i18n( $datef, strtotime( $user->user_registered ) );
     
    10361034    public function user_admin_stats_metabox( $user = null ) {
    10371035
    1038         // Bail if no user ID
     1036        // Bail if no user ID.
    10391037        if ( empty( $user->ID ) ) {
    10401038            return;
    10411039        }
    10421040
    1043         // If account is not activated last activity is the time user registered
     1041        // If account is not activated last activity is the time user registered.
    10441042        if ( isset( $user->user_status ) && 2 == $user->user_status ) {
    10451043            $last_active = $user->user_registered;
    10461044
    1047         // Account is activated, getting user's last activity
     1045        // Account is activated, getting user's last activity.
    10481046        } else {
    10491047            $last_active = bp_get_user_last_activity( $user->ID );
     
    10571055
    10581056            <?php
    1059             // Loading other stats only if user has activated their account
     1057            // Loading other stats only if user has activated their account.
    10601058            if ( empty( $user->user_status ) ) {
    10611059
     
    11481146     * @param array|string $actions WordPress row actions (edit, delete).
    11491147     * @param object       $user    The object for the user row.
    1150      *
    11511148     * @return array Merged actions.
    11521149     */
    11531150    public function row_actions( $actions = '', $user = null ) {
    11541151
    1155         // Bail if no user ID
     1152        // Bail if no user ID.
    11561153        if ( empty( $user->ID ) ) {
    11571154            return;
    11581155        }
    11591156
    1160         // Setup args array
     1157        // Setup args array.
    11611158        $args = array();
    11621159
    1163         // Add the user ID if it's not for the current user
     1160        // Add the user ID if it's not for the current user.
    11641161        if ( $user->ID !== $this->current_user_id ) {
    11651162            $args['user_id'] = $user->ID;
    11661163        }
    11671164
    1168         // Add the referer
     1165        // Add the referer.
    11691166        $args['wp_http_referer'] = urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) );
    11701167
    1171         // Add the "Extended" link if the current user can edit this user
     1168        // Add the "Extended" link if the current user can edit this user.
    11721169        if ( current_user_can( 'edit_user', $user->ID ) || bp_current_user_can( 'bp_moderate' ) ) {
    11731170
    1174             // Add query args and setup the Extended link
     1171            // Add query args and setup the Extended link.
    11751172            $edit_profile      = add_query_arg( $args, $this->edit_profile_url );
    11761173            $edit_profile_link = sprintf( '<a href="%1$s">%2$s</a>',  esc_url( $edit_profile ), esc_html__( 'Extended', 'buddypress' ) );
     
    11781175            /**
    11791176             * Check the edit action is available
    1180              * and preserve the order edit | profile | remove/delete
     1177             * and preserve the order edit | profile | remove/delete.
    11811178             */
    11821179            if ( ! empty( $actions['edit'] ) ) {
     
    11891186                );
    11901187
    1191             // If not available simply add the edit profile action
     1188            // If not available simply add the edit profile action.
    11921189            } else {
    11931190                $new_edit_actions = array( 'edit-profile' => $edit_profile_link );
     
    12191216     * @param string $url          Profile URL.
    12201217     * @param int    $user_id      User ID.
    1221      *
    12221218     * @return string
    12231219     */
     
    12451241     * @since 2.0.0
    12461242     *
    1247      * @param int    $value
    1248      * @param string $option
    1249      * @param int    $new_value
    1250      *
     1243     * @param int    $value     Value for signup option.
     1244     * @param string $option    Value for the option key.
     1245     * @param int    $new_value Value for the saved option.
    12511246     * @return int The pagination preferences.
    12521247     */
     
    12561251        }
    12571252
    1258         // Per page
     1253        // Per page.
    12591254        $new_value = (int) $new_value;
    12601255        if ( $new_value < 1 || $new_value > 999 ) {
     
    12741269     *
    12751270     * @param WP_User_Query $query The users query.
    1276      *
    12771271     * @return WP_User_Query The users query without the signups.
    12781272     */
     
    12801274        global $wpdb;
    12811275
    1282         // Bail if this is an ajax request
     1276        // Bail if this is an ajax request.
    12831277        if ( defined( 'DOING_AJAX' ) ) {
    12841278            return;
    12851279        }
    12861280
    1287         // Bail if updating BuddyPress
     1281        // Bail if updating BuddyPress.
    12881282        if ( bp_is_update() ) {
    12891283            return;
    12901284        }
    12911285
    1292         // Bail if there is no current admin screen
     1286        // Bail if there is no current admin screen.
    12931287        if ( ! function_exists( 'get_current_screen' ) || ! get_current_screen() ) {
    12941288            return;
    12951289        }
    12961290
    1297         // Get current screen
     1291        // Get current screen.
    12981292        $current_screen = get_current_screen();
    12991293
    1300         // Bail if not on a users page
     1294        // Bail if not on a users page.
    13011295        if ( ! isset( $current_screen->id ) || $this->users_page !== $current_screen->id ) {
    13021296            return;
    13031297        }
    13041298
    1305         // Bail if already querying by an existing role
     1299        // Bail if already querying by an existing role.
    13061300        if ( ! empty( $query->query_vars['role'] ) ) {
    13071301            return;
     
    13171311     *
    13181312     * @param array $views WP List Table views.
    1319      *
    13201313     * @return array The views with the signup view added.
    13211314     */
    13221315    public function signup_filter_view( $views = array() ) {
    13231316
    1324         // Remove the 'current' class from All if we're on the signups view
     1317        // Remove the 'current' class from All if we're on the signups view.
    13251318        if ( $this->signups_page == get_current_screen()->id ) {
    13261319            $views['all'] = str_replace( 'class="current"', '', $views['all'] );
     
    13461339     * @param string $class    The name of the class to use.
    13471340     * @param string $required The parent class.
    1348      *
    1349      * @return WP_List_Table    The List table.
     1341     * @return WP_List_Table The List table.
    13501342     */
    13511343    public static function get_list_table_class( $class = '', $required = '' ) {
     
    13761368        global $bp_members_signup_list_table;
    13771369
    1378         // Build redirection URL
     1370        // Build redirection URL.
    13791371        $redirect_to = remove_query_arg( array( 'action', 'error', 'updated', 'activated', 'notactivated', 'deleted', 'notdeleted', 'resent', 'notresent', 'do_delete', 'do_resend', 'do_activate', '_wpnonce', 'signup_ids' ), $_SERVER['REQUEST_URI'] );
    13801372        $doaction    = bp_admin_list_table_current_bulk_action();
     
    13991391        $allowed_actions = apply_filters( 'bp_signups_admin_allowed_actions', array( 'do_delete', 'do_activate', 'do_resend' ) );
    14001392
    1401         // Prepare the display of the Community Profile screen
     1393        // Prepare the display of the Community Profile screen.
    14021394        if ( ! in_array( $doaction, $allowed_actions ) || ( -1 == $doaction ) ) {
    14031395
     
    14081400            }
    14091401
    1410             // per_page screen option
     1402            // The per_page screen option.
    14111403            add_screen_option( 'per_page', array( 'label' => _x( 'Pending Accounts', 'Pending Accounts per page (screen options)', 'buddypress' ) ) );
    14121404
     
    14321424            ) );
    14331425
    1434             // Help panel - sidebar links
     1426            // Help panel - sidebar links.
    14351427            get_current_screen()->set_help_sidebar(
    14361428                '<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .
     
    14421434            }
    14431435
    1444             // Handle resent activation links
     1436            // Handle resent activation links.
    14451437            if ( 'do_resend' == $doaction ) {
    14461438
    1447                 // nonce check
     1439                // Nonce check.
    14481440                check_admin_referer( 'signups_resend' );
    14491441
     
    14691461                bp_core_redirect( $redirect_to );
    14701462
    1471             // Handle activated accounts
     1463            // Handle activated accounts.
    14721464            } elseif ( 'do_activate' == $doaction ) {
    14731465
    1474                 // nonce check
     1466                // Nonce check.
    14751467                check_admin_referer( 'signups_activate' );
    14761468
     
    14961488                bp_core_redirect( $redirect_to );
    14971489
    1498             // Handle sign-ups delete
     1490            // Handle sign-ups delete.
    14991491            } elseif ( 'do_delete' == $doaction ) {
    15001492
    1501                 // nonce check
     1493                // Nonce check.
    15021494                check_admin_referer( 'signups_delete' );
    15031495
     
    15231515                bp_core_redirect( $redirect_to );
    15241516
    1525             // Plugins can update other stuff from here
     1517            // Plugins can update other stuff from here.
    15261518            } else {
    15271519                $this->redirect = $redirect_to;
     
    15501542    public function signups_display_errors() {
    15511543
    1552         // Look for sign-up errors
     1544        // Look for sign-up errors.
    15531545        $errors = get_transient( '_bp_admin_signups_errors' );
    15541546
    1555         // Bail if no activation errors
     1547        // Bail if no activation errors.
    15561548        if ( empty( $errors ) ) {
    15571549            return;
    15581550        }
    15591551
    1560         // Loop through errors and display them
     1552        // Loop through errors and display them.
    15611553        foreach ( $errors as $error ) : ?>
    15621554
     
    15651557        <?php endforeach;
    15661558
    1567         // Delete the redirect transient
     1559        // Delete the redirect transient.
    15681560        delete_transient( '_bp_admin_signups_errors' );
    15691561    }
     
    15781570    private function get_signup_notice() {
    15791571
    1580         // Setup empty notice for return value
     1572        // Setup empty notice for return value.
    15811573        $notice = array();
    15821574
    1583         // Updates
     1575        // Updates.
    15841576        if ( ! empty( $_REQUEST['updated'] ) ) {
    15851577            switch ( $_REQUEST['updated'] ) {
     
    16881680        }
    16891681
    1690         // Errors
     1682        // Errors.
    16911683        if ( ! empty( $_REQUEST['error'] ) ) {
    16921684            switch ( $_REQUEST['error'] ) {
     
    17331725        $doaction = bp_admin_list_table_current_bulk_action();
    17341726
    1735         // Prepare notices for admin
     1727        // Prepare notices for admin.
    17361728        $notice = $this->get_signup_notice();
    17371729
    1738         // Display notices
     1730        // Display notices.
    17391731        if ( ! empty( $notice ) ) :
    17401732            if ( 'updated' === $notice['class'] ) : ?>
     
    17601752        <?php endif;
    17611753
    1762         // Show the proper screen
     1754        // Show the proper screen.
    17631755        switch ( $doaction ) {
    17641756            case 'activate' :
     
    17881780        $usersearch = ! empty( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '';
    17891781
    1790         // Prepare the group items for display
     1782        // Prepare the group items for display.
    17911783        $bp_members_signup_list_table->prepare_items();
    17921784
     
    18431835            </h2>
    18441836
    1845             <?php // Display each signups on its own row ?>
     1837            <?php // Display each signups on its own row. ?>
    18461838            <?php $bp_members_signup_list_table->views(); ?>
    18471839
     
    18641856     *
    18651857     * @param string $action Delete, activate, or resend activation link.
    1866      *
    18671858     * @return string
    18681859     */
     
    18721863        }
    18731864
    1874         // Get the user IDs from the URL
     1865        // Get the user IDs from the URL.
    18751866        $ids = false;
    18761867        if ( ! empty( $_POST['allsignups'] ) ) {
     
    18851876
    18861877        // Query for signups, and filter out those IDs that don't
    1887         // correspond to an actual signup
     1878        // correspond to an actual signup.
    18881879        $signups_query = BP_Signup::get( array(
    18891880            'include' => $ids,
     
    18931884        $signup_ids = wp_list_pluck( $signups, 'signup_id' );
    18941885
    1895         // Set up strings
     1886        // Set up strings.
    18961887        switch ( $action ) {
    18971888            case 'delete' :
     
    19231914        }
    19241915
    1925         // These arguments are added to all URLs
     1916        // These arguments are added to all URLs.
    19261917        $url_args = array( 'page' => 'bp-signups' );
    19271918
    1928         // These arguments are only added when performing an action
     1919        // These arguments are only added when performing an action.
    19291920        $action_args = array(
    19301921            'action'     => 'do_' . $action,
     
    19871978    }
    19881979}
    1989 endif; // class_exists check
    1990 
    1991 // Load the BP Members admin
     1980endif; // End class_exists check.
     1981
     1982// Load the BP Members admin.
    19921983add_action( 'bp_init', array( 'BP_Members_Admin', 'register_members_admin' ) );
Note: See TracChangeset for help on using the changeset viewer.