BBP_Admin::setup_notices()

Setup general admin area notices.


Description Description


Source Source

File: includes/admin/classes/class-bbp-admin.php

	public function setup_notices() {

		// Avoid malformed notices variable
		if ( ! is_array( $this->notices ) ) {
			$this->notices = array();
		}

		// Get page
		$page = ! empty( $_GET['page'] )
			? sanitize_key( $_GET['page'] )
			: false;

		// Pending database upgrades!
		if ( ( 'bbp-upgrade' !== $page ) && bbp_get_pending_upgrades() && current_user_can( 'bbp_tools_upgrade_page' ) ) {

			// Link to upgrade page
			$upgrade_url  = add_query_arg( array( 'page' => 'bbp-upgrade', 'status' => 'pending' ), admin_url( 'tools.php' ) );
			$dismiss_url  = wp_nonce_url( add_query_arg( array( 'bbp-hide-notice' => 'bbp-skip-upgrades' ) ), 'bbp-hide-notice' );
			$upgrade_link = '<a href="' . esc_url( $upgrade_url ) . '">' . esc_html__( 'Learn More',   'bbpress' ) . '</a>';
			$dismiss_link = '<a href="' . esc_url( $dismiss_url ) . '">' . esc_html__( 'Hide For Now', 'bbpress' ) . '</a>';
			$bbp_dashicon = '<span class="bbpress-logo-icon"></span>';
			$message      = $bbp_dashicon . sprintf(
				esc_html__( 'bbPress requires a manual database upgrade. %s or %s.', 'bbpress' ),
				$upgrade_link,
				$dismiss_link
			);

			// Add tools feedback
			$this->add_notice( $message, 'notice-bbpress', false );
		}
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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