/** * Return avatar of current user * * @since 2.0.0 bbPress (r2574) * * @param int $size Size of the avatar. Defaults to 40 * @uses bbp_get_current_user_id() To get the current user id * @uses bbp_get_current_anonymous_user_data() To get the current * anonymous user's email * @uses get_avatar() To get the avatar * @uses apply_filters() Calls 'bbp_get_current_user_avatar' with the * avatar and size * @return string Current user avatar */ function bbp_get_current_user_avatar($size = 40) { $user = bbp_get_current_user_id(); if (empty($user)) { $user = bbp_get_current_anonymous_user_data('email'); } $avatar = get_avatar($user, $size); return apply_filters('bbp_get_current_user_avatar', $avatar, $size); }
/** * Echoes the values for current poster (uses WP comment cookies) * * @since bbPress (r2734) * * @param string $key Which value to echo? * @uses bbp_get_current_anonymous_user_data() To get the current anonymous user * data */ function bbp_current_anonymous_user_data($key = '') { echo bbp_get_current_anonymous_user_data($key); }
<input type="text" id="bbp_anonymous_author" value="<?php bbp_is_topic_edit() ? bbp_topic_author() : bbp_is_reply_edit() ? bbp_reply_author() : bbp_current_anonymous_user_data('name'); ?> " tabindex="<?php bbp_tab_index(); ?> " size="40" name="bbp_anonymous_name" /> </p> <p> <label for="bbp_anonymous_email"><?php _e('Mail (will not be published) (required):', 'bbpress'); ?> </label><br /> <input type="text" id="bbp_anonymous_email" value="<?php echo bbp_is_topic_edit() || bbp_is_reply_edit() ? get_post_meta($post->ID, '_bbp_anonymous_email', true) : bbp_get_current_anonymous_user_data('email'); ?> " tabindex="<?php bbp_tab_index(); ?> " size="40" name="bbp_anonymous_email" /> </p> <p> <label for="bbp_anonymous_website"><?php _e('Website:', 'bbpress'); ?> </label><br /> <input type="text" id="bbp_anonymous_website" value="<?php bbp_is_topic_edit() ? bbp_topic_author_url() : bbp_is_reply_edit() ? bbp_reply_author_url() : bbp_current_anonymous_user_data('website'); ?>