Ticket #18693: 18693.diff
File 18693.diff, 2.2 KB (added by , 12 years ago) |
---|
-
wp-admin/admin-ajax.php
1549 1549 echo json_encode( array( 'message' => $message, 'last_edited' => $last_edited ) ); 1550 1550 die(); 1551 1551 break; 1552 case 'dismiss-wp-pointer' : 1553 $pointer = sanitize_key( $_POST['pointer'] ); 1554 // check_ajax_referer( 'dismiss-pointer_' . $pointer ); 1555 1556 $dismissed = (array) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ); 1557 if ( in_array( $pointer, $dismissed ) ) 1558 die( '0' ); 1559 1560 $dismissed[] = $pointer; 1561 $dismissed = array_values( $dismissed ); 1562 1563 // TODO Pointer registration including whether pointer should be global. 1564 update_user_meta( get_current_user_id(), 'dismissed_wp_pointers', $dismissed ); 1565 die( '1' ); 1566 break; 1552 1567 default : 1553 1568 do_action( 'wp_ajax_' . $_POST['action'] ); 1554 1569 die('0'); -
wp-admin/includes/template.php
2232 2232 function wp_pointer_enqueue( $hook_suffix ) { 2233 2233 $enqueue = false; 2234 2234 2235 $admin_bar = get_user_setting( 'p0', 0 ); 2236 if ( ! $admin_bar && apply_filters( 'show_wp_pointer_admin_bar', true ) ) { 2235 // Easy there: There will be an API here soon enough. 2236 $dismissed = (array) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ); 2237 2238 if ( ! in_array( 'wp330-admin-bar', $dismissed ) && apply_filters( 'show_wp_pointer_admin_bar', true ) ) { 2237 2239 $enqueue = true; 2238 2240 add_action( 'admin_print_footer_scripts', '_wp_pointer_print_admin_bar' ); 2239 2241 } … … 2257 2259 jQuery(document).ready( function($) { 2258 2260 $('#wpadminbar').pointer({ 2259 2261 content: '<?php echo $pointer_content; ?>', 2262 // Easy there: There will be an API here soon enough. 2260 2263 position: { 2261 2264 my: 'left top', 2262 2265 at: 'center bottom', 2263 2266 offset: '-25 0' 2264 2267 }, 2265 2268 close: function() { 2266 setUserSetting( 'p0', '1' ); 2269 $.post( ajaxurl, { 2270 pointer: 'wp330-admin-bar', 2271 // _ajax_nonce: $('#_ajax_nonce').val(), 2272 action: 'dismiss-wp-pointer' 2273 }); 2267 2274 } 2268 2275 }).pointer('open'); 2269 2276 });