bp_groups_get_group_manage_members_script_data( integer $group_id )

Get JavaScript data for the Manage Group Members UI.


Parameters Parameters

$group_id

(integer) (Required) Required. The Group ID whose members has to be managed.


Top ↑

Return Return

(array) The JavaScript data.


Source Source

File: bp-groups/bp-groups-cssjs.php

function bp_groups_get_group_manage_members_script_data( $group_id = 0 ) {
	if ( ! $group_id ) {
		return array();
	} else {
		$group_id = (int) $group_id;
	}

	$path = sprintf( '/%1$s/%2$s/%3$s/%4$s/members?exclude_admins=false',
		bp_rest_namespace(),
		bp_rest_version(),
		buddypress()->groups->id,
		$group_id
	);

	$preloaded_members = array();
	if ( bp_is_running_wp( '5.0.0' ) ) {
		$preloaded_members = rest_preload_api_request( '', $path );
	}

	return array(
		'path'      => remove_query_arg( 'exclude_admins', $path ),
		'preloaded' => reset( $preloaded_members ),
		'roles'     => bp_groups_get_group_roles(),
		'strings'    => array(
			'allMembers' => _x( 'All members', 'Group Manage Members dropdown default option', 'buddypress' ),
		),
	);
}


Top ↑

Changelog Changelog

Changelog
Version Description
5.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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