ID; if ( ! get_user_meta( $userid, 'ignore_' . $notice['id'] ) ) { // Check if we are on admin.php. If we are, we have // to get the current page slug and tab, so we can // feed it back to Wordpress. Why> admin.php cannot // be accessed without the page parameter. We add the // tab to return the user to the last panel they were // on. $pageName = ''; $curTab = ''; if ( $pagenow == 'admin.php' || $pagenow == 'themes.php' ) { // Get the current page. To avoid errors, we'll set // the redux page slug if the GET is empty. $pageName = empty( $_GET['page'] ) ? '&page=' . self::$_parent->args['page_slug'] : '&page=' . $_GET['page']; // Ditto for the current tab. $curTab = empty( $_GET['tab'] ) ? '&tab=0' : '&tab=' . $_GET['tab']; } global $wp_version; // Print the notice with the dismiss link if ( version_compare( $wp_version, '4.2', '>' ) ) { $output = ""; $css_id = $notice['id'] . $pageName . $curTab; $css_class = $notice['type'] . 'redux-notice notice is-dismissible redux-notice'; $output .= "
\n"; $nonce = wp_create_nonce( $notice['id'] . $pageName . $curTab . 'nonce' ); $output .= " \n"; $output .= "

{$notice['msg']}

"; $output .= "
\n"; echo $output; } else { echo '

' . $notice['msg'] . '  ' . __( 'Dismiss', 'redux-framework' ) . '.

'; } } } else { // Standard notice echo '

' . $notice['msg'] . '.

'; } ?> admin_notices = array(); } } /** * dismissAdminNotice - Updates user meta to store dismiss notice preference * * @since 3.2.0 * @access public * @return void */ public static function dismissAdminNotice() { global $current_user; // Verify the dismiss and id parameters are present. if ( isset( $_GET['dismiss'] ) && isset( $_GET['id'] ) ) { if ( 'true' == $_GET['dismiss'] || 'false' == $_GET['dismiss'] ) { // Get the user id $userid = $current_user->ID; // Get the notice id $id = $_GET['id']; $val = $_GET['dismiss']; // Add the dismiss request to the user meta. update_user_meta( $userid, 'ignore_' . $id, $val ); } } } /** * dismissAdminNotice - Updates user meta to store dismiss notice preference * * @since 3.2.0 * @access public * @return void */ public static function dismissAdminNoticeAJAX() { global $current_user; if ( ! wp_verify_nonce( $_POST['nonce'], $_POST['id'] . 'nonce' ) ) { die(0); } else { // Get the user id $userid = $current_user->ID; // Get the notice id $id = $_POST['id']; // Add the dismiss request to the user meta. update_user_meta( $userid, 'ignore_' . $id, true ); } } } Redux_Admin_Notices::load(); }