BBP_Forums_Group_Extension::map_group_forum_meta_caps( array $caps = array(), string $cap = '', int $user_id, array $args = array() )

Allow group members to have advanced priviledges in group forum topics.

Description

Parameters

$caps

(Optional)

Default value: array()

$cap

(Optional)

Default value: ''

$user_id

(Required)

$args

(Optional)

Default value: array()

Return

(array)

Source

File: bp-forums/groups.php

	public function map_group_forum_meta_caps( $caps = array(), $cap = '', $user_id = 0, $args = array() ) {

		switch ( $cap ) {

			// If user is a group mmember, allow them to create content.
			case 'read_forum'          :
			case 'publish_replies'     :
			case 'publish_topics'      :
			case 'read_hidden_forums'  :
			case 'read_private_forums' :
				if ( bbp_group_is_member() || bbp_group_is_mod() || bbp_group_is_admin() ) {
					$caps = array( 'participate' );
				}
				break;

			// If user is a group mod ar admin, map to participate cap.
			case 'moderate'     :
			case 'edit_topic'   :
			case 'edit_reply'   :
			case 'view_trash'   :
			case 'edit_others_replies' :
			case 'edit_others_topics'  :
				if ( bbp_group_is_mod() || bbp_group_is_admin() ) {
					$caps = array( 'participate' );
				}
				break;

			// If user is a group admin, allow them to delete topics and replies.
			case 'delete_topic' :
			case 'delete_reply' :
				if ( bbp_group_is_admin() ) {
					$caps = array( 'participate' );
				}
				break;
		}

		return apply_filters( 'bbp_map_group_forum_topic_meta_caps', $caps, $cap, $user_id, $args );
	}

Changelog

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