I want my plugin to show a dismissable notice. There are 2 links that do not redirect the user anywhere, just dismiss the notice and make sure that it will never show up again. This is only a minimal example from my settings class and this part works flawlessly:
I have the following in construct:
add_action('admin_notices', array($this, 'acau_notice' ) );
add_action('admin_init', array( $this, 'acau_ignore_notice') );
The following is a part of acau_notice
function:
global $current_user ;
$user_id = $current_user->ID;
if ( ! get_user_meta( $user_id, 'acau_ignore_notice' )) {
echo '<p><a href="?acau_ignore_notice=0">Dismiss permanently 1</a></p>';
echo '<p><a href="?acau_ignore_notice=0">Dismiss permanently 2</a></p>';
}
}
And here is a function to store the information whether the notice should be displayed:
public function acau_ignore_notice() {
global $current_user;
$user_id = $current_user->ID;
if ( isset($_GET['acau_ignore_notice']) && '0' == $_GET['acau_ignore_notice'] ) {
add_user_meta($user_id, 'acau_ignore_notice', 'true', true);
}
}
I would like to echo
a third link that redirects the user to an external page, but also make it dismiss the notice and make it never show up again. Can it be done with PHP?