_x( 'Nonmember opt-outs', 'Nonmember opt-outs per page (screen options)', 'buddypress' ) ) ); // Current screen. $current_screen = get_current_screen(); $current_screen->add_help_tab( array( 'id' => 'bp-optouts-overview', 'title' => __( 'Overview', 'buddypress' ), 'content' => '

' . __( 'This is the administration screen for nonmember opt-outs on your site.', 'buddypress' ) . '

' . '

' . __( 'From the screen options, you can customize the displayed columns and the pagination of this screen.', 'buddypress' ) . '

' . '

' . __( 'You can reorder the list of opt-outs by clicking on the Email Sender, Email Type or Date Modified column headers.', 'buddypress' ) . '

' . '

' . __( 'Using the search form, you can search for an opt-out to a specific email address.', 'buddypress' ) . '

', ) ); $current_screen->add_help_tab( array( 'id' => 'bp-optouts-actions', 'title' => __( 'Actions', 'buddypress' ), 'content' => '

' . __( 'Hovering over a row in the opt-outs list will display action links that allow you to manage the opt-out. You can perform the following actions:', 'buddypress' ) . '

' . '' . '

' . __( 'Bulk actions allow you to perform these actions for the selected rows.', 'buddypress' ) . '

', ) ); // Help panel - sidebar links. $current_screen->set_help_sidebar( '

' . __( 'For more information:', 'buddypress' ) . '

' . '

' . __( 'Support Forums', 'buddypress' ) . '

' ); // Add accessible hidden headings and text for the Pending Users screen. $current_screen->set_screen_reader_content( array( /* translators: accessibility text */ 'heading_views' => __( 'Filter opt-outs list', 'buddypress' ), /* translators: accessibility text */ 'heading_pagination' => __( 'Opt-out list navigation', 'buddypress' ), /* translators: accessibility text */ 'heading_list' => __( 'Opt-outs list', 'buddypress' ), ) ); } else { if ( empty( $_REQUEST['optout_ids' ] ) ) { return; } $optout_ids = wp_parse_id_list( $_REQUEST['optout_ids' ] ); // Handle optout deletion. if ( 'do_delete' == $doaction ) { // Nonce check. check_admin_referer( 'optouts_delete' ); $success = 0; foreach ( $optout_ids as $optout_id ) { if ( bp_delete_optout_by_id( $optout_id ) ) { $success++; } } $query_arg = array( 'updated' => 'deleted' ); if ( ! empty( $success ) ) { $query_arg['deleted'] = $success; } $notdeleted = count( $optout_ids ) - $success; if ( $notdeleted > 0 ) { $query_arg['notdeleted'] = $notdeleted; } $redirect_to = add_query_arg( $query_arg, $redirect_to ); bp_core_redirect( $redirect_to ); // Plugins can update other stuff from here. } else { /** * Fires at end of opt-outs admin load * if doaction does not match any actions. * * @since 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_core_admin_update_optouts', $doaction, $_REQUEST, $redirect_to ); bp_core_redirect( $redirect_to ); } } } add_action( "load-tools_page_bp-optouts", 'bp_core_optouts_admin_load' ); /** * Get admin notice when viewing the optouts management page. * * @since 8.0.0 * * @return array */ function bp_core_get_optouts_notice() { // Setup empty notice for return value. $notice = array(); // Updates. if ( ! empty( $_REQUEST['updated'] ) && 'deleted' === $_REQUEST['updated'] ) { $notice = array( 'class' => 'updated', 'message' => '' ); if ( ! empty( $_REQUEST['deleted'] ) ) { $deleted = absint( $_REQUEST['deleted'] ); $notice['message'] .= sprintf( _nx( /* translators: %s: number of deleted optouts */ '%s opt-out successfully deleted!', '%s opt-outs successfully deleted!', $deleted, 'nonmembers opt-out deleted', 'buddypress' ), number_format_i18n( absint( $_REQUEST['deleted'] ) ) ); } if ( ! empty( $_REQUEST['notdeleted'] ) ) { $notdeleted = absint( $_REQUEST['notdeleted'] ); $notice['message'] .= sprintf( _nx( /* translators: %s: number of optouts that failed to be deleted */ '%s opt-out was not deleted.', '%s opt-outs were not deleted.', $notdeleted, 'nonmembers opt-out not deleted', 'buddypress' ), number_format_i18n( $notdeleted ) ); if ( empty( $_REQUEST['deleted'] ) ) { $notice['class'] = 'error'; } } } // Errors. if ( ! empty( $_REQUEST['error'] ) && 'do_delete' === $_REQUEST['error'] ) { $notice = array( 'class' => 'error', 'message' => esc_html__( 'There was a problem deleting opt-outs. Please try again.', 'buddypress' ), ); } return $notice; } /** * Opt-outs admin page router. * * Depending on the context, display * - the list of optouts, * - or the delete confirmation screen, * * Also prepare the admin notices. * * @since 8.0.0 */ function bp_core_optouts_admin() { $doaction = bp_admin_list_table_current_bulk_action(); // Prepare notices for admin. $notice = bp_core_get_optouts_notice(); // Display notices. if ( ! empty( $notice ) ) : if ( 'updated' === $notice['class'] ) : ?>

prepare_items(); if ( is_network_admin() ) { $form_url = network_admin_url( 'admin.php' ); } else { $form_url = bp_get_admin_url( 'tools.php' ); } $form_url = add_query_arg( array( 'page' => 'bp-optouts', ), $form_url ); $search_form_url = remove_query_arg( array( 'action', 'deleted', 'notdeleted', 'error', 'updated', 'delete', 'activate', 'activated', 'notactivated', 'resend', 'resent', 'notresent', 'do_delete', 'do_activate', 'do_resend', 'action2', '_wpnonce', 'optout_ids' ), $_SERVER['REQUEST_URI'] ); bp_core_admin_tabbed_screen_header( __( 'BuddyPress tools', 'buddypress' ), __( 'Manage Opt-outs', 'buddypress' ), 'tools' ); ?>
total_items; printf( '

%s

', sprintf( esc_html( /* translators: %s: the searched email. */ _n( 'Opt-out with an email address matching “%s”', 'Opt-outs with an email address matching “%s”', $num_results, 'buddypress' ) ), esc_html( $usersearch ) ) ); } ?>

views(); ?>
search_box( esc_html__( 'Search for a specific email address', 'buddypress' ), 'bp-optouts' ); ?>
display(); ?>
$ids, ); $optouts = bp_get_optouts( $args ); $optout_ids = wp_list_pluck( $optouts, 'id' ); // Check optout IDs and set up strings. switch ( $action ) { case 'delete' : if ( 0 === count( $optouts ) ) { $helper_text = __( 'No opt-out requests were found.', 'buddypress' ); } else { $helper_text = _n( 'You are about to delete the following opt-out request:', 'You are about to delete the following opt-out requests:', count( $optouts ), 'buddypress' ); } break; } // These arguments are added to all URLs. $url_args = array( 'page' => 'bp-optouts' ); // These arguments are only added when performing an action. $action_args = array( 'action' => 'do_' . $action, 'optout_ids' => implode( ',', $optout_ids ) ); if ( is_network_admin() ) { $base_url = network_admin_url( 'admin.php' ); } else { $base_url = bp_get_admin_url( 'tools.php' ); } $cancel_url = add_query_arg( $url_args, $base_url ); $action_url = wp_nonce_url( add_query_arg( array_merge( $url_args, $action_args ), $base_url ), 'optouts_' . $action ); bp_core_admin_tabbed_screen_header( __( 'BuddyPress tools', 'buddypress' ), __( 'Manage Opt-outs', 'buddypress' ), 'tools' ); ?>

  1. email_address ) ?>

    date_modified ); /* translators: %s: modification date */ printf( esc_html__( 'Date modified: %s', 'buddypress'), $last_modified ); ?>