Tribe__PUE__Notices::render_invalid_key()
Generate a notice listing any plugins for which license keys have been entered but are invalid (in the sense of not matching PUE server records or having been revoked rather than having expired which is handled separately).
In the context of the plugin admin screen, will not render if the key-has-expired notice is also scheduled to display.
Source
File: src/Tribe/PUE/Notices.php
public function render_invalid_key() {
global $pagenow;
$empty_keys = $this->select_empty_keys();
if ( empty( $empty_keys ) ) {
return;
}
// Remove the invalid_key notice for products with an empty license key
foreach ( $empty_keys as $empty_key ) {
if ( array_key_exists( $empty_key, $this->notices['invalid_key'] ) ) {
unset( $this->notices['invalid_key'][ $empty_key ] );
}
}
if ( 'plugins.php' === $pagenow && ! empty( $this->notices[ self::EXPIRED_KEY ] ) ) {
return;
}
$plugin_names = $this->get_formatted_plugin_names( self::INVALID_KEY );
if ( empty( $plugin_names ) ) {
return;
}
$prompt = sprintf(
_n(
"It looks like you're using %1\$s, but the license key is invalid. Please download the latest version %2\$sfrom your account%3\$s.",
"It looks like you're using %1\$s, but the license keys are invalid. Please download the latest versions %2\$sfrom your account%3\$s.",
count( $this->notices[ self::INVALID_KEY ] ),
'tribe-common'
),
$plugin_names,
'<a href="http://m.tri.be/19n4" target="_blank">',
'</a>'
);
/**
* Filters the actions that can be taken if an invalid key is present
*
* @param string $actions Actions
* @param array $plugin_names Plugin names the message applies to
*/
$action_steps = apply_filters( 'tribe_notice_invalid_key_actions', $this->find_your_key_text(), $plugin_names );
if ( $action_steps ) {
$action_steps = "<p>{$action_steps}</p>";
}
$this->render_notice( 'pue_key-' . self::INVALID_KEY, "<p>{$prompt}</p> {$action_steps}" );
}