bp_get_current_blog_roles()

Return an array of roles from the currently loaded blog.


Description Description

WordPress roles are dynamically flipped when calls to switch_to_blog() and restore_current_blog() are made, so we use and trust WordPress core to have loaded the correct results for us here. As enhancements are made to WordPress’s RBAC, so should our capability functions here.


Return Return

(object)


Top ↑

Source Source

File: bp-core/bp-core-caps.php

function bp_get_current_blog_roles() {
	global $wp_roles;

	// Sanity check on roles global variable.
	$roles = isset( $wp_roles->roles )
		? $wp_roles->roles
		: array();

	/**
	 * Filters the list of editable roles.
	 *
	 * @since 2.1.0
	 *
	 * @param array $roles List of roles.
	 */
	$roles = apply_filters( 'editable_roles', $roles );

	/**
	 * Filters the array of roles from the currently loaded blog.
	 *
	 * @since 2.1.0
	 *
	 * @param array    $roles    Available roles.
	 * @param WP_Roles $wp_roles Object of WordPress roles.
	 */
	return apply_filters( 'bp_get_current_blog_roles', $roles, $wp_roles );
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.1.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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