bb_create_nonce

Creates a random, one time use token.

Description

(string) bb_create_nonce( (int) $action = -1 ); 

Returns (string)

The one use form token

Parameters (1)

0. $action — Optional. (int) => -1
Scalar value to add context to the nonce.

Usage

  1. if ( !function_exists( 'bb_create_nonce' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-pluggable.php'; 
  3.  
  4. // Scalar value to add context to the nonce. 
  5. $action = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bb_create_nonce($action); 
  9.  

Defined (1)

The function is defined in the following location(s).

/bp-forums/bbpress/bb-includes/functions.bb-pluggable.php  
  1. function bb_create_nonce($action = -1) { 
  2. $user = bb_get_current_user(); 
  3. $uid = (int) $user->ID; 
  4.  
  5. $i = bb_nonce_tick(); 
  6.  
  7. return substr(bb_hash($i . $action . $uid, 'nonce'), -12, 10);