bbp_get_moderator_list( int $object_id, array $args = array() )

Return the moderators for an object


Description Description


Parameters Parameters

$object_id

(Optional) Object id

$args

(Optional) This function supports these arguments: - before: Before the tag list - sep: Tag separator - after: After the tag list

Default value: array()


Top ↑

Return Return

(string) Moderator list of the object


Top ↑

Source Source

File: includes/users/template.php

	function bbp_get_moderator_list( $object_id = 0, $args = array() ) {

		// Parse arguments against default values
		$r = bbp_parse_args( $args, array(
			'before' => '<div class="bbp-moderators"><p>' . esc_html__( 'Moderators:', 'bbpress' ) . '&nbsp;',
			'sep'    => ', ',
			'after'  => '</p></div>',
			'none'   => ''
		), 'get_moderator_list' );

		// Get forum moderators
		$user_ids = bbp_get_moderator_ids( $object_id );
		if ( ! empty( $user_ids ) ) {

			// In admin, use nicenames
			if ( is_admin() ) {
				$users = bbp_get_user_nicenames_from_ids( $user_ids );

			// In theme, use display names & profile links
			} else {
				foreach ( $user_ids as $user_id ) {
					$users[] = bbp_get_user_profile_link( $user_id );
				}
			}

			$retval = $r['before'] . implode( $r['sep'], $users ) . $r['after'];

		// No forum moderators
		} else {
			$retval = $r['none'];
		}

		// Filter & return
		return apply_filters( 'bbp_get_moderator_list', $retval );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.