-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathadmin.php
39 lines (28 loc) · 1.05 KB
/
admin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
add_action( 'admin_notices', 'pptwj_plugin_notice' );
add_action('admin_init', 'pptwj_plugin_notice_hide' );
function pptwj_plugin_notice(){
global $current_user;
$user_id = $current_user->ID;
$nag_notice = '_pptwj_nag_notice';
if( !current_user_can( 'manage_options' ) )
return;
if( !get_user_meta( $user_id, $nag_notice ) ){
echo '<div class="updated"><p>';
printf( __('Installation of Popular Posts Tabbed Widget for Jetpack plugin successful! Go to the <a href="%1$s">Widgets page</a> to use your new Popular Posts Tabbed Widget. <a href="%2$s">Hide notice</a>', 'pptwj' ), admin_url('widgets.php'), add_query_arg( array('pptwj-action' => 'hide-install-notice' ) ) );
echo '</p></div>';
}
}
function pptwj_plugin_notice_hide(){
global $current_user;
$user_id = $current_user->ID;
$nag_notice = '_pptwj_nag_notice';
if( !isset( $_GET['pptwj-action'] ) )
return;
$action = $_GET['pptwj-action'];
/** Hide nag notice **/
if( 'hide-install-notice' == $action ){
$val = 1;
add_user_meta( $user_id, $nag_notice, $val, true );
}
}