Make WordPress Core


Ignore:
Timestamp:
10/10/2011 11:31:36 PM (12 years ago)
Author:
nacin
Message:

Use AJAX request and usermeta rather than user settings for dismissing admin bar pointers. see #18693.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-ajax.php

    r18852 r18937  
    15741574    update_post_meta( $post_id, '_edit_lock', $new_lock, implode( ':', $active_lock ) );
    15751575    die( '1' );
    1576 
     1576case 'dismiss-wp-pointer' :
     1577    $pointer = $_POST['pointer'];
     1578    if ( $pointer != sanitize_key( $pointer ) )
     1579        die( '0' );
     1580
     1581//  check_ajax_referer( 'dismiss-pointer_' . $pointer );
     1582
     1583    $dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
     1584
     1585    if ( in_array( $pointer, $dismissed ) )
     1586        die( '0' );
     1587
     1588    $dismissed[] = $pointer;
     1589    $dismissed = implode( ',', $dismissed );
     1590
     1591    update_user_meta( get_current_user_id(), 'dismissed_wp_pointers', $dismissed );
     1592    die( '1' );
     1593    break;
    15771594default :
    15781595    do_action( 'wp_ajax_' . $_POST['action'] );
Note: See TracChangeset for help on using the changeset viewer.