bp_activity_get_actions_for_context( string $context = '' )

Gets a flat list of activity actions compatible with a given context.

Description

Parameters

$context

(string) (Optional) Name of the context. Defaults to the current context.

Default value: ''

Return

(array)

Source

File: bp-activity/bp-activity-functions.php

function bp_activity_get_actions_for_context( $context = '' ) {
	if ( ! $context ) {
		$context = bp_activity_get_current_context();
	}

	$actions = array();
	foreach ( bp_activity_get_actions() as $component_actions ) {
		foreach ( $component_actions as $component_action ) {
			if ( in_array( $context, (array) $component_action['context'], true ) ) {
				$actions[] = $component_action;
			}
		}
	}

	return $actions;
}

Changelog

Changelog
Version Description
BuddyPress 2.8.0 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.