users won't be notified again until the next update. **********************************************************************************/ /** * hook : admin_notices */ function hu_may_be_display_update_notice() { if ( !defined('HU_SHOW_UPDATE_NOTIFICATION') || !HU_SHOW_UPDATE_NOTIFICATION ) return; $screen = get_current_screen(); if ( is_object($screen) && 'appearance_page_welcome' === $screen-> id ) return; $opt_name = 'last_update_notice'; $last_update_notice_values = hu_get_option($opt_name); $show_new_notice = false; $display_ct = 10; if ( !$last_update_notice_values || !is_array($last_update_notice_values) ) { //first time user of the theme, the option does not exist // 1) initialize it => set it to the current Hueman version, displayed 0 times. // 2) update in db $last_update_notice_values = array( "version" => HUEMAN_VER, "display_count" => 0 ); HU_utils::$inst->hu_set_option( $opt_name, $last_update_notice_values ); //already user of the theme ? if ( hu_user_started_before_version( HUEMAN_VER ) ) $show_new_notice = true; } $_db_version = $last_update_notice_values["version"]; $_db_displayed_count = $last_update_notice_values["display_count"]; //user who just upgraded the theme will be notified until he/she clicks on the dismiss link //or until the notice has been displayed n times. if ( version_compare( HUEMAN_VER, $_db_version , '>' ) ) { //CASE 1 : displayed less than n times if ( $_db_displayed_count < $display_ct ) { $show_new_notice = true; //increments the counter (int) $_db_displayed_count++; $last_update_notice_values["display_count"] = $_db_displayed_count; //updates the option val with the new count HU_utils::$inst->hu_set_option( $opt_name, $last_update_notice_values ); } //CASE 2 : displayed n times => automatic dismiss else { //reset option value with new version and counter to 0 $new_val = array( "version" => HUEMAN_VER, "display_count" => 0 ); HU_utils::$inst->hu_set_option( $opt_name, $new_val ); }//end else }//end if //always display in dev mode $show_new_notice = ( defined('CZR_DEV') && CZR_DEV ) || $show_new_notice; if ( !$show_new_notice ) return; //prefixed HU_Plugin_Activation because of the possible issue : https://github.com/presscustomizr/customizr/issues/1603 if ( !hu_is_plugin_active('nimble-builder/nimble-builder.php') && class_exists('HU_Plugin_Activation') && !HU_Plugin_Activation::get_instance()->hu_is_notice_dismissed() ) return; ob_start(); ?>
( %1$s X ) ', __('close' , 'hueman') ); ?>