diff --git a/includes/help/start.php b/includes/help/start.php index 44ca263..29b3a58 100644 --- a/includes/help/start.php +++ b/includes/help/start.php @@ -37,15 +37,49 @@ * @uses wp add_filter() */ function semr_admin_notice(){ + if(!strstr($_GET['page'], "semmelstatzR")) return; + global $current_user ; + $user_id = $current_user->ID; + if(get_user_meta($user_id, 'semr_ignore_notice')) return; if(strstr(SEMMELSTATZR_VERSION, "Beta") !== false) { - echo '
+ printf('

You are using a beta-version of semmelstatzReloaded. We will notify you for any newer version or a final release.

+ Hide Notice +
', '?page='.$_GET['page'].'&semr_ignore_notice=0'); + } else if(strstr(SEMMELSTATZR_VERSION, "RC") !== false) { + echo '
+

You are using a rc-version of semmelstatzReloaded. + We will notify you for any newer version or a final release.

'; } } + add_filter('admin_notices', 'semr_admin_notice'); + +function semr_ignore_notice() { + global $current_user; + /* If user clicks to ignore the notice, add that to their user meta */ + if ( isset($_GET['semr_ignore_notice']) && '0' == $_GET['semr_ignore_notice'] ) { + add_user_meta($current_user->ID, 'semr_ignore_notice', 'true', true); + } +} + +add_action('admin_init', 'semr_ignore_notice'); + +function semr_show_notice() { + global $current_user; + /* If user clicks to ignore the notice, add that to their user meta */ + if ( isset($_GET['semr_ignore_notice']) && '1' == $_GET['semr_ignore_notice'] ) { + //add_user_meta($current_user->ID, 'semr_ignore_notice', 'false', true); + delete_user_meta($current_user->ID, 'semr_ignore_notice'); + } +} + +add_action('admin_init', 'semr_show_notice'); + + /* // just for debugging on local machines function check_current_screen() { @@ -62,7 +96,7 @@ add_filter('admin_notices', 'check_current_screen'); * bind the help files with contextual help area of wp * * @author Ortwin Pinke - * @since 1.0.1 Beta + * @since 1.0.0 * @uses wp add_filter() * * @global array $semr_hook diff --git a/semmelstatzR.php b/semmelstatzR.php index 2b52131..e6b7230 100644 --- a/semmelstatzR.php +++ b/semmelstatzR.php @@ -59,6 +59,18 @@ require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'semmelstatzR_startup.php'; if(is_admin() == true) { + + /* + add_filter('screen_settings', 'screen_options_demo', 10, 2); + function screen_options_demo($current, $screen){ + $desired_screen = convert_to_screen('plugins.php'); + if ( $screen->id == $desired_screen->id ){ + $current .= "Hello WordPress!"; + } + return $current; + } + * + */ /** * add CSS