Last active
January 8, 2020 15:20
-
-
Save robertstaddon/a3c8184fe73dc829b899c71a38929530 to your computer and use it in GitHub Desktop.
Register User Switching plugin switch back URL nonce as a Third Party integration with LiteSpeed Cache
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
<?php | |
/** | |
* The Third Party integration with User Switching plugin. | |
* | |
* @since 2.9.9.2 | |
* @package LiteSpeed_Cache | |
* @subpackage LiteSpeed_Cache/thirdparty | |
* @author LiteSpeed Technologies <info@litespeedtech.com> | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
die() ; | |
} | |
LiteSpeed_Cache_API::register( 'LiteSpeed_Cache_ThirdParty_User_Switching' ) ; | |
class LiteSpeed_Cache_ThirdParty_User_Switching | |
{ | |
/** | |
* Detects if User Switching is installed | |
* | |
* @since 2.9.9.2 | |
* @access public | |
*/ | |
public static function detect() | |
{ | |
if ( ! class_exists('user_switching') ) { | |
return ; | |
} | |
/** | |
* Register switch back URL nonce | |
* @since 2.9.9.2 | |
*/ | |
if ( function_exists('current_user_switched') && $old_user = current_user_switched() ) { | |
LiteSpeed_Cache_API::nonce_action( 'switch_to_olduser_' . $old_user->ID ) ; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This will be added into v3.0