From 00823b1deba56504ff9f2bcc416aaa14cf1c9d0a Mon Sep 17 00:00:00 2001 From: nacin Date: Mon, 21 Nov 2011 23:04:35 +0000 Subject: [PATCH] Remove old dismissed pointers as the IDs have changed. Switch to underscores that way we don't need to translate them for method names. Avoid an empty pointer in the array. see #18693. git-svn-id: http://svn.automattic.com/wordpress/trunk@19389 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin-ajax.php | 2 +- wp-admin/includes/template.php | 17 +++++++++-------- wp-admin/includes/upgrade.php | 8 +++++++- wp-includes/version.php | 2 +- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index 1cf8c6698..ce2ba887c 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -1575,7 +1575,7 @@ case 'dismiss-wp-pointer' : // check_ajax_referer( 'dismiss-pointer_' . $pointer ); - $dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ); + $dismissed = array_filter( explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ) ); if ( in_array( $pointer, $dismissed ) ) die( '0' ); diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index ef9851926..1dfa809e6 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -1673,7 +1673,7 @@ final class WP_Internal_Pointers { * All pointers can be disabled using the following: * remove_action( 'admin_enqueue_scripts', array( 'WP_Internal_Pointers', 'enqueue_scripts' ) ); * - * Individual pointers (e.g. wp330-toolbar) can be disabled using the following: + * Individual pointers (e.g. wp330_toolbar) can be disabled using the following: * remove_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_wp330_toolbar' ) ); */ public static function enqueue_scripts( $hook_suffix ) { @@ -1682,9 +1682,10 @@ final class WP_Internal_Pointers { * Format: array( hook_suffix => pointer_id ) */ $registered_pointers = array( - 'index.php' => 'wp330-toolbar', - 'post-new.php' => 'wp330-media-uploader', - 'themes.php' => 'wp330-saving-widgets', + 'index.php' => 'wp330_toolbar', + 'post-new.php' => 'wp330_media_uploader', + 'post.php' => 'wp330_media_uploader', + 'themes.php' => 'wp330_saving_widgets', ); // Check if screen related pointer is registered @@ -1701,7 +1702,7 @@ final class WP_Internal_Pointers { return; // Bind pointer print function - add_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_' . str_replace( '-', '_', $pointer ) ) ); + add_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_' . $pointer ) ); // Add pointers script and style to queue wp_enqueue_style( 'wp-pointer' ); @@ -1753,7 +1754,7 @@ final class WP_Internal_Pointers { if ( is_multisite() && is_super_admin() ) $content .= '

' .esc_js( __( 'Network Admin is now located in the My Sites menu.' ) ) . '

'; - WP_Internal_Pointers::print_js( 'wp330-toolbar', '#wpadminbar', array( + WP_Internal_Pointers::print_js( 'wp330_toolbar', '#wpadminbar', array( 'content' => $content, 'position' => array( 'edge' => 'top', 'align' => 'center' ), ) ); @@ -1768,7 +1769,7 @@ final class WP_Internal_Pointers { $content = '

' . esc_js( __( 'Updated Media Uploader' ) ) . '

'; $content .= '

' . esc_js( __( 'The single media icon now launches the uploader for all file types, and the new drag and drop interface makes uploading a breeze.' ) ) . '

'; - WP_Internal_Pointers::print_js( 'wp330-media-uploader', '#content-add_media', array( + WP_Internal_Pointers::print_js( 'wp330_media_uploader', '#content-add_media', array( 'content' => $content, 'position' => array( 'edge' => 'left', 'align' => 'center' ), ) ); @@ -1783,7 +1784,7 @@ final class WP_Internal_Pointers { $content = '

' . esc_js( __( 'New Feature: Saving Widgets' ) ) . '

'; $content .= '

' . esc_js( __( 'If you change your mind and revert to your previous theme, we’ll put the widgets back the way you had them.' ) ) . '

'; - WP_Internal_Pointers::print_js( 'wp330-saving-widgets', '#message2', array( + WP_Internal_Pointers::print_js( 'wp330_saving_widgets', '#message2', array( 'content' => $content, 'position' => array( 'edge' => 'top', 'align' => 'left' ), ) ); diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index 47deb1f80..8b763782e 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -451,7 +451,7 @@ function upgrade_all() { if ( $wp_current_db_version < 15260 ) upgrade_300(); - if ( $wp_current_db_version < 19061 ) + if ( $wp_current_db_version < 19389 ) upgrade_330(); maybe_disable_automattic_widgets(); @@ -1146,6 +1146,12 @@ function upgrade_330() { $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key IN ('show_admin_bar_admin', 'plugins_last_view')" ); } + // 3.3-beta. Can remove before release. + if ( $wp_current_db_version > 18715 && $wp_current_db_version < 19389 + && is_main_site() && ! defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) + delete_metadata( 'user', 0, 'dismissed_wp_pointers', '', true ); + + if ( $wp_current_db_version >= 11548 ) return; diff --git a/wp-includes/version.php b/wp-includes/version.php index 2bb889b3d..398694aec 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -11,7 +11,7 @@ $wp_version = '3.3-beta3-19254'; * * @global int $wp_db_version */ -$wp_db_version = 19364; +$wp_db_version = 19389; /** * Holds the TinyMCE version