bbp_set_current_anonymous_user_data

Set the cookies for current poster (uses WP comment cookies).

Description

bbp_set_current_anonymous_user_data( (array) $anonymous_data = array() ); 

Parameters (1)

0. $anonymous_data — Optional. (array) => array()
The anonymous data.

Usage

  1. if ( !function_exists( 'bbp_set_current_anonymous_user_data' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/users/functions.php'; 
  3.  
  4. // The anonymous data. 
  5. $anonymous_data = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbp_set_current_anonymous_user_data($anonymous_data); 
  9.  

Defined (1)

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

/includes/users/functions.php  
  1. function bbp_set_current_anonymous_user_data( $anonymous_data = array() ) { 
  2. if ( empty( $anonymous_data ) || !is_array( $anonymous_data ) ) 
  3. return; 
  4.  
  5. $comment_cookie_lifetime = apply_filters( 'comment_cookie_lifetime', 30000000 ); 
  6.  
  7. setcookie( 'comment_author_' . COOKIEHASH, $anonymous_data['bbp_anonymous_name'], time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN ); 
  8. setcookie( 'comment_author_email_' . COOKIEHASH, $anonymous_data['bbp_anonymous_email'], time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN ); 
  9. setcookie( 'comment_author_url_' . COOKIEHASH, $anonymous_data['bbp_anonymous_website'], time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN );