BP_Members_Admin::signups_admin_load()
Set up the signups admin page.
Description
Loaded before the page is rendered, this function does all initial setup, including: processing form requests, registering contextual help, and setting up screen options.
Source
File: bp-members/classes/class-bp-members-admin.php
public function signups_admin_load() { global $bp_members_signup_list_table; // Build redirection URL. $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'] ); $doaction = bp_admin_list_table_current_bulk_action(); /** * Fires at the start of the signups admin load. * * @since BuddyPress 2.0.0 * * @param string $doaction Current bulk action being processed. * @param array $_REQUEST Current $_REQUEST global. */ do_action( 'bp_signups_admin_load', $doaction, $_REQUEST ); /** * Filters the allowed actions for use in the user signups admin page. * * @since BuddyPress 2.0.0 * * @param array $value Array of allowed actions to use. */ $allowed_actions = apply_filters( 'bp_signups_admin_allowed_actions', array( 'do_delete', 'do_activate', 'do_resend' ) ); // Prepare the display of the Community Profile screen. if ( ! in_array( $doaction, $allowed_actions ) || ( -1 == $doaction ) ) { if ( is_network_admin() ) { $bp_members_signup_list_table = self::get_list_table_class( 'BP_Members_MS_List_Table', 'ms-users' ); } else { $bp_members_signup_list_table = self::get_list_table_class( 'BP_Members_List_Table', 'users' ); } // The per_page screen option. add_screen_option( 'per_page', array( 'label' => __( 'Pending Accounts', 'buddyboss' ) ) ); get_current_screen()->add_help_tab( array( 'id' => 'bp-signups-overview', 'title' => __( 'Overview', 'buddyboss' ), 'content' => '<p>' . __( 'This is the administration screen for pending accounts on your site.', 'buddyboss' ) . '</p>' . '<p>' . __( 'From the screen options, you can customize the displayed columns and the pagination of this screen.', 'buddyboss' ) . '</p>' . '<p>' . __( 'You can reorder the list of your pending accounts by clicking on the Username, Email or Registered column headers.', 'buddyboss' ) . '</p>' . '<p>' . __( 'Using the search form, you can find pending accounts more easily. The Username and Email fields will be included in the search.', 'buddyboss' ) . '</p>' ) ); get_current_screen()->add_help_tab( array( 'id' => 'bp-signups-actions', 'title' => __( 'Actions', 'buddyboss' ), 'content' => '<p>' . __( 'Hovering over a row in the pending accounts list will display action links that allow you to manage pending accounts. You can perform the following actions:', 'buddyboss' ) . '</p>' . '<ul><li>' . __( '"Email" takes you to the confirmation screen before being able to send the activation link to the desired pending account. You can only send the activation email once per day.', 'buddyboss' ) . '</li>' . '<li>' . __( '"Delete" allows you to delete a pending account from your site. You will be asked to confirm this deletion.', 'buddyboss' ) . '</li></ul>' . '<p>' . __( 'By clicking on a Username you will be able to activate a pending account from the confirmation screen.', 'buddyboss' ) . '</p>' . '<p>' . __( 'Bulk actions allow you to perform these 3 actions for the selected rows.', 'buddyboss' ) . '</p>' ) ); // Help panel - sidebar links. get_current_screen()->set_help_sidebar( '<p><strong>' . __( 'For more information:', 'buddyboss' ) . '</strong></p>' . '<p>' . __( '<a href="https://www.buddyboss.com/resources/">Documentation</a>', 'buddyboss' ) . '</p>' ); // Add accessible hidden headings and text for the Pending Users screen. get_current_screen()->set_screen_reader_content( array( /* translators: accessibility text */ 'heading_views' => __( 'Filter users list', 'buddyboss' ), /* translators: accessibility text */ 'heading_pagination' => __( 'Pending users list navigation', 'buddyboss' ), /* translators: accessibility text */ 'heading_list' => __( 'Pending users list', 'buddyboss' ), ) ); } else { if ( ! empty( $_REQUEST['signup_ids' ] ) ) { $signups = wp_parse_id_list( $_REQUEST['signup_ids' ] ); } // Handle resent activation links. if ( 'do_resend' == $doaction ) { // Nonce check. check_admin_referer( 'signups_resend' ); $resent = BP_Signup::resend( $signups ); if ( empty( $resent ) ) { $redirect_to = add_query_arg( 'error', $doaction, $redirect_to ); } else { $query_arg = array( 'updated' => 'resent' ); if ( ! empty( $resent['resent'] ) ) { $query_arg['resent'] = count( $resent['resent'] ); } if ( ! empty( $resent['errors'] ) ) { $query_arg['notsent'] = count( $resent['errors'] ); set_transient( '_bp_admin_signups_errors', $resent['errors'], 30 ); } $redirect_to = add_query_arg( $query_arg, $redirect_to ); } bp_core_redirect( $redirect_to ); // Handle activated accounts. } elseif ( 'do_activate' == $doaction ) { // Nonce check. check_admin_referer( 'signups_activate' ); $activated = BP_Signup::activate( $signups ); if ( empty( $activated ) ) { $redirect_to = add_query_arg( 'error', $doaction, $redirect_to ); } else { $query_arg = array( 'updated' => 'activated' ); if ( ! empty( $activated['activated'] ) ) { $query_arg['activated'] = count( $activated['activated'] ); } if ( ! empty( $activated['errors'] ) ) { $query_arg['notactivated'] = count( $activated['errors'] ); set_transient( '_bp_admin_signups_errors', $activated['errors'], 30 ); } $redirect_to = add_query_arg( $query_arg, $redirect_to ); } bp_core_redirect( $redirect_to ); // Handle sign-ups delete. } elseif ( 'do_delete' == $doaction ) { // Nonce check. check_admin_referer( 'signups_delete' ); $deleted = BP_Signup::delete( $signups ); if ( empty( $deleted ) ) { $redirect_to = add_query_arg( 'error', $doaction, $redirect_to ); } else { $query_arg = array( 'updated' => 'deleted' ); if ( ! empty( $deleted['deleted'] ) ) { $query_arg['deleted'] = count( $deleted['deleted'] ); } if ( ! empty( $deleted['errors'] ) ) { $query_arg['notdeleted'] = count( $deleted['errors'] ); set_transient( '_bp_admin_signups_errors', $deleted['errors'], 30 ); } $redirect_to = add_query_arg( $query_arg, $redirect_to ); } bp_core_redirect( $redirect_to ); // Plugins can update other stuff from here. } else { $this->redirect = $redirect_to; /** * Fires at end of signups admin load if doaction does not match any actions. * * @since BuddyPress 2.0.0 * * @param string $doaction Current bulk action being processed. * @param array $_REQUEST Current $_REQUEST global. * @param string $redirect Determined redirect url to send user to. */ do_action( 'bp_members_admin_update_signups', $doaction, $_REQUEST, $this->redirect ); bp_core_redirect( $this->redirect ); } } }
Changelog
Version | Description |
---|---|
BuddyPress 2.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.