_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'] ) : ?>%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(); ?>