bbp_is_topic_anonymous( int $topic_id )

Is the posted by an anonymous user?

Description

Parameters

$topic_id

(Optional) Topic id

Return

(bool) True if the post is by an anonymous user, false if not.

Source

File: bp-forums/topics/template.php

function bbp_is_topic_anonymous( $topic_id = 0 ) {
	$topic_id = bbp_get_topic_id( $topic_id );
	$retval   = false;

	if ( !bbp_get_topic_author_id( $topic_id ) )
		$retval = true;

	elseif ( get_post_meta( $topic_id, '_bbp_anonymous_name',  true ) )
		$retval = true;

	elseif ( get_post_meta( $topic_id, '_bbp_anonymous_email', true ) )
		$retval = true;

	// The topic is by an anonymous user
	return (bool) apply_filters( 'bbp_is_topic_anonymous', $retval, $topic_id );
}

Changelog

Changelog
Version Description
bbPress (r2753) 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.