bp_activity_get_actions_for_context( string $context = '' )

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


Parameters Parameters

$context

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

Default value: ''


Top ↑

Return Return

(array)


Source 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;
}


Top ↑

Changelog Changelog

Changelog
Version Description
2.8.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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