Tribe__PUE__Notices::setup_notices()

Tests to see if there are any extant notifications and renders them if so.

This must run prior to TribeAdminNotices::hook() (which currently runs during "current_screen" priority 20).


Source

File: src/Tribe/PUE/Notices.php

	public function setup_notices() {
		// Don't allow this to run multiple times
		remove_action( 'current_screen', array( $this, 'setup_notices' ) );

		// No need to display license key notices to users without appropriate capabilities
		if ( ! current_user_can( 'install_plugins' ) ) {
			return;
		}

		foreach ( $this->notices as $notice_type => $plugin_names ) {
			if ( empty( $plugin_names ) ) {
				continue;
			}

			$callback = array( $this, 'render_' . $notice_type );

			if ( is_callable( $callback ) ) {
				tribe_notice( 'pue_key-' . $notice_type, $callback, 'dismiss=1&type=warning' );
			}
		}
	}