bbp_get_current_anonymous_user_data( string $key = '' )
Get the cookies for current poster (uses WP comment cookies).
Description
Parameters
- $key
-
(Optional) Which value to get? If not given, then an array is returned.
Default value: ''
Return
(string|array) Cookie(s) for current poster
Source
File: bp-forums/users/functions.php
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | function bbp_get_current_anonymous_user_data( $key = '' ) { $cookie_names = array ( 'name' => 'comment_author' , 'email' => 'comment_author_email' , 'url' => 'comment_author_url' , // Here just for the sake of them, use the above ones 'comment_author' => 'comment_author' , 'comment_author_email' => 'comment_author_email' , 'comment_author_url' => 'comment_author_url' , ); sanitize_comment_cookies(); $bbp_current_poster = wp_get_current_commenter(); if ( ! empty ( $key ) && in_array( $key , array_keys ( $cookie_names ) ) ) return $bbp_current_poster [ $cookie_names [ $key ]]; return $bbp_current_poster ; } |
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.