WordPress.org

Make WordPress Core

Ticket #18693: reset-pointer.php

File reset-pointer.php, 577 bytes (added by koopersmith, 2 years ago)

A handy plugin for resetting pointers.

Line 
1<?php
2/*
3 * Plugin Name: Reset Pointer
4 * Description: Reset a WordPress 3.3 pointer by appending ?reset-pointer=POINTER_ID to an admin URL.
5 */
6
7add_action( 'admin_init', 'reset_pointer' );
8
9function reset_pointer() {
10        if ( ! isset( $_REQUEST['reset-pointer'] ) )
11                return;
12
13        $meta = (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true );
14        $meta = str_replace( $_REQUEST['reset-pointer'], '', $meta );
15        $meta = str_replace( ',,', ',', $meta );
16        $meta = trim( $meta, ',' );
17
18        update_user_meta( get_current_user_id(), 'dismissed_wp_pointers', $meta );
19}