-
-
Save scribu/84e5b1bdb7ae060dd886 to your computer and use it in GitHub Desktop.
User Switching: avoid notice when placed in mu-plugins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: trunk/user-switching.php | |
=================================================================== | |
--- trunk/user-switching.php (revision 416611) | |
+++ trunk/user-switching.php (working copy) | |
@@ -19,12 +19,10 @@ | |
*/ | |
-if ( !defined( 'OLDUSER_COOKIE' ) ) | |
- define( 'OLDUSER_COOKIE', 'wordpress_olduser_' . COOKIEHASH ); | |
- | |
class user_switching { | |
function user_switching() { | |
+ add_action( 'plugins_loaded', array( $this, 'set_old_cookie' ) ); | |
add_action( 'admin_init', array( $this, 'admin_init' ) ); | |
add_action( 'admin_notices', array( $this, 'admin_notice' ) ); | |
add_action( 'user_row_actions', array( $this, 'user_row' ), 10, 2 ); | |
@@ -34,6 +32,11 @@ | |
add_action( 'wp_login', 'wp_clear_olduser_cookie' ); | |
} | |
+ function set_old_cookie() { | |
+ if ( !defined( 'OLDUSER_COOKIE' ) ) | |
+ define( 'OLDUSER_COOKIE', 'wordpress_olduser_' . COOKIEHASH ); | |
+ } | |
+ | |
function personal_options( $user ) { | |
$current_user = wp_get_current_user(); | |
if ( !current_user_can( 'edit_user', $user->ID ) or ( $user->ID == $current_user->ID ) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment