bp_activity_get_action( string $component_id, string $key )

Retrieve the current action from a component and key.

Description

Parameters

$component_id

(Required) The unique string ID of the component.

$key

(Required) The action key.

Return

(string|bool) Action value if found, otherwise false.

Source

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

function bp_activity_get_action( $component_id, $key ) {

	// Return false if any of the above values are not set.
	if ( empty( $component_id ) || empty( $key ) ) {
		return false;
	}

	$actions = bp_activity_get_actions();
	$retval  = false;

	if ( isset( $actions->{$component_id}->{$key} ) ) {
		$retval = $actions->{$component_id}->{$key};
	}

	/**
	 * Filters the current action by component and key.
	 *
	 * @since BuddyPress 1.1.0
	 *
	 * @param string|bool $retval       The action key.
	 * @param string      $component_id The unique string ID of the component.
	 * @param string      $key          The action key.
	 */
	return apply_filters( 'bp_activity_get_action', $retval, $component_id, $key );
}

Changelog

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