‘nonce_life’ hook
-
Hello,
I’ve been having issues with my nonce lifespans, and I discovered there was the following hook being applied from the better messages plugin in inside ‘/bp-better-messages/inc/hooks.php’
add_filter( 'nonce_life', array( $this, 'nonce_lifespan' ), 5 ); public function nonce_lifespan( $duration ){ $min_duration = 7 * DAY_IN_SECONDS; if( $min_duration > $duration ){ $duration = $min_duration; } return $duration; }
Instead it would be preferable, both for me and in terms of good practice, to specify which the nonces bp-better-messages wants to increase lifespan of like so:
add_filter( 'nonce_life', array( $this, 'nonce_lifespan' ), 5 , 2); public function nonce_lifespan( $duration , $action){ if($action == 'bp-nonce'){ $min_duration = 7 * DAY_IN_SECONDS; if( $min_duration > $duration ){ $duration = $min_duration; } } return $duration; }
Thank you.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘‘nonce_life’ hook’ is closed to new replies.