1
0
Fork 0

added new handling for admin notice

Dieser Commit ist enthalten in:
oldperl 2011-12-19 17:48:13 +00:00
Ursprung 571dde9aa8
Commit 0919cf3ab8
2 geänderte Dateien mit 48 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -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 '<div class="updated">
printf('<div class="updated">
<p>You are using a beta-version of semmelstatzReloaded.
We will notify you for any newer version or a final release.</p>
<a href="%1$s">Hide Notice</a>
</div>', '?page='.$_GET['page'].'&amp;semr_ignore_notice=0');
} else if(strstr(SEMMELSTATZR_VERSION, "RC") !== false) {
echo '<div class="updated">
<p>You are using a rc-version of semmelstatzReloaded.
We will notify you for any newer version or a final release.</p>
</div>';
}
}
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

Datei anzeigen

@ -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