bbp_set_current_anonymous_user_data( array $anonymous_data = array() )

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

Description

Parameters

$anonymous_data

(array) (Optional) With keys 'bbp_anonymous_name', 'bbp_anonymous_email', 'bbp_anonymous_website'. Should be sanitized (see bbp_filter_anonymous_post_data() for sanitization)

Default value: array()

Source

File: bp-forums/users/functions.php

function bbp_set_current_anonymous_user_data( $anonymous_data = array() ) {
	if ( empty( $anonymous_data ) || !is_array( $anonymous_data ) )
		return;

	$comment_cookie_lifetime = apply_filters( 'comment_cookie_lifetime', 30000000 );

	setcookie( 'comment_author_'       . COOKIEHASH, $anonymous_data['bbp_anonymous_name'],    time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN );
	setcookie( 'comment_author_email_' . COOKIEHASH, $anonymous_data['bbp_anonymous_email'],   time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN );
	setcookie( 'comment_author_url_'   . COOKIEHASH, $anonymous_data['bbp_anonymous_website'], time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN );
}

Changelog

Changelog
Version Description
bbPress (r2734) Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.