bp_core_get_optouts_notice()

Get admin notice when viewing the optouts management page.


Return Return

(array)


Source Source

File: bp-core/admin/bp-core-admin-optouts.php

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;
}


Top ↑

Changelog Changelog

Changelog
Version Description
8.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.