PluginProbe
WP Ultimate Post Grid / 2.8.2
WP Ultimate Post Grid v2.8.2
4.1.1 trunk 1.5 1.6 1.7 1.7.1 1.7.2 1.8 1.9 2.0 2.1 2.2 2.3 2.4.0 2.5.0 2.6.0 2.7.0 2.8.0 2.8.2 3.0.0 3.3.0 3.4.0 3.5.0 3.6.0 3.7.0 All 32 releases
wp-ultimate-post-grid / helpers / notices.php

notices.php in WP Ultimate Post Grid 2.8.2, at helpers/notices.php

41 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class WPUPG_Notices {
4
5 public function __construct()
6 {
7 add_action( 'admin_init', array( $this, 'hide_notice' ) );
8 add_action( 'admin_notices', array( $this, 'admin_notices' ) );
9 }
10
11 public function admin_notices()
12 {
13 // New to WP Ultimate Post Grid
14 if( current_user_can( 'edit_posts' ) && get_user_meta( get_current_user_id(), '_wpupg_hide_new_notice', true ) == '' ) {
15 include( WPUltimatePostGrid::get()->coreDir . '/static/getting_started_notice.php' );
16 }
17
18 if( $notices = get_option( 'wpupg_deferred_admin_notices' ) ) {
19 foreach( $notices as $notice ) {
20 echo '<div class="updated"><p>'.$notice.'</p></div>';
21 }
22
23 delete_option('wpupg_deferred_admin_notices');
24 }
25 }
26
27 public function add_admin_notice( $notice )
28 {
29 $notices = get_option( 'wpupg_deferred_admin_notices', array() );
30 $notices[] = $notice;
31 update_option( 'wpupg_deferred_admin_notices', $notices );
32 }
33
34 function hide_notice()
35 {
36 if ( isset( $_GET['wpupg_hide_new_notice'] ) ) {
37 check_admin_referer( 'wpupg_hide_new_notice', 'wpupg_hide_new_notice' );
38 update_user_meta( get_current_user_id(), '_wpupg_hide_new_notice', get_option( WPUltimatePostGrid::get()->pluginName . '_version') );
39 }
40 }
41 }