Add nonce_user_logged_out filters to wp_create_nonce() and wp_verify_nonce() for when there is no user ID. Provides plugins the ability to tie a nonce to some other characteristic of the session. props sc0ttkclark, fixes #21111.
git-svn-id: https://develop.svn.wordpress.org/trunk@21837 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
80e56f5a88
commit
b4fa70c19c
@ -1251,6 +1251,8 @@ if ( !function_exists('wp_verify_nonce') ) :
|
||||
function wp_verify_nonce($nonce, $action = -1) {
|
||||
$user = wp_get_current_user();
|
||||
$uid = (int) $user->ID;
|
||||
if ( ! $uid )
|
||||
$uid = apply_filters( 'nonce_user_logged_out', $uid, $action );
|
||||
|
||||
$i = wp_nonce_tick();
|
||||
|
||||
@ -1277,6 +1279,8 @@ if ( !function_exists('wp_create_nonce') ) :
|
||||
function wp_create_nonce($action = -1) {
|
||||
$user = wp_get_current_user();
|
||||
$uid = (int) $user->ID;
|
||||
if ( ! $uid )
|
||||
$uid = apply_filters( 'nonce_user_logged_out', $uid, $action );
|
||||
|
||||
$i = wp_nonce_tick();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user