ID; $nag_allowed_html = array( 'a' => array( 'href' => array(), 'target' => array(), ), 'strong' => array(), ); /* Check if the user has already clicked to ignore the nag */ if ( current_user_can( 'edit_theme_options' ) && ! get_user_meta( $user_id, 'maker_update_0_3_0_ignore' ) ) { echo '

'; printf( wp_kses( __( 'Upgrading from version prior to Maker 0.3.0? Read the release notes, this update requires a bit of action on your side. Got it, don\'t show again.', 'maker' ), $nag_allowed_html ), esc_url( 'https://docs.themepatio.com/maker-upgrade-0-3-0/' ), '?maker_update_0_3_0_ignore=0" target="_blank"' ); echo '

'; } } add_action( 'admin_notices', 'maker_update_notice' ); /** * Checks if the user has clicked to ignore the notice. */ function maker_update_notice_ignore() { global $current_user; $user_id = $current_user->ID; /* If user clicks to ignore the notice, add that to their user meta */ if ( isset( $_GET['maker_update_0_3_0_ignore'] ) && 0 == $_GET['maker_update_0_3_0_ignore'] ) { add_user_meta( $user_id, 'maker_update_0_3_0_ignore', 1, true ); } } add_action( 'admin_init', 'maker_update_notice_ignore' ); /** * Updates the names of the incorrectly-set theme mods. */ function maker_update_theme_mods() { // Return if mods are updated already. if ( get_theme_mod( 'mods_updated', false ) ) { return; } // List oа mods to update. $mods = array( 'maker_display_portfolio_text' => 'portfolio_display_page_content', 'maker_portfolio_columns' => 'portfolio_column_number', 'maker_display_project_excerpt' => 'project_display_excerpt', 'maker_display_project_meta' => 'project_display_meta', 'maker_all_projects_link' => 'project_all_projects_link', 'maker_site_color' => 'color_site', 'maker_text_color' => 'color_text', 'maker_accent_color' => 'color_accent', 'maker_footer_text' => 'footer_message', ); // Loop through all mods and update them. foreach ( $mods as $old => $new ) { $mod_val = get_theme_mod( $old, false ); if ( $mod_val ) { set_theme_mod( $new, $mod_val ); } remove_theme_mod( $old ); } set_theme_mod( 'mods_updated', true ); } add_action( 'after_setup_theme', 'maker_update_theme_mods' );