Filter uncanny-automator-pro

uap_option_all_buddyboss_actions

Filters all BuddyBoss actions available for UAP integration, allowing modification of the action list.

add_filter( 'uap_option_all_buddyboss_actions', $callback, 10, 1 );

Description

Filters the available BuddyBoss action options within Uncanny Automator. Developers can use this to add, remove, or modify the list of BuddyBoss actions that can be triggered by recipes, for example, to include custom BuddyBoss actions or exclude existing ones.


Usage

add_filter( 'uap_option_all_buddyboss_actions', 'your_function_name', 10, 1 );

Parameters

$option (mixed)
This parameter is the label displayed for the BuddyBoss activity action selection in Uncanny Automator.

Return Value

The filtered value.


Examples

add_filter( 'uap_option_all_buddyboss_actions', 'my_custom_buddyboss_actions', 10, 1 );

/**
 * Adds a custom BuddyBoss action to the Uncanny Automator list of available actions.
 *
 * This function demonstrates how to extend the list of BuddyBoss actions that can be
 * triggered by Uncanny Automator. In this example, we'll add a hypothetical
 * "invite_to_group" action.
 *
 * @param array $option The original array of BuddyBoss action options.
 * @return array The modified array of BuddyBoss action options, including the custom action.
 */
function my_custom_buddyboss_actions( $option ) {

	// Assuming $option is an array containing BuddyBoss actions with keys like 'activity_update'.
	// We want to add our new action to this array.

	// Define the new custom BuddyBoss action.
	$custom_action_key = 'invite_to_group';
	$custom_action_label = 'Invite User to Group'; // This would be displayed in the Uncanny Automator UI.

	// Add the custom action to the 'options' array within the provided $option structure.
	// We assume the $option array structure is consistent with what Uncanny Automator expects.
	if ( isset( $option['options'] ) && is_array( $option['options'] ) ) {
		$option['options'][ $custom_action_key ] = $custom_action_label;
	} else {
		// If the 'options' key is not present or not an array, we might need to create it
		// or handle it differently depending on the exact structure of $option.
		// For this example, we'll assume it's present and is an array.
		// A more robust solution would check for the structure carefully.
	}

	// You might also want to update the default_value if your custom action is intended
	// to be the new default, though that's usually handled in the plugin's core logic.
	// For demonstration, we won't change the default_value here.

	return $option;
}

Placement

This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.


Source Code

uncanny-automator-pro/src/integrations/buddyboss/helpers/buddyboss-pro-helpers.php:665

public function all_buddyboss_actions( $label = null, $option_code = 'BDBACTIONS', $args = array() ) {

		if ( ! $label ) {
			$label = esc_attr_x( 'Activity action', 'Buddyboss', 'uncanny-automator-pro' );
		}

		$options = array();

		// Get the actions.
		$activity_actions = bp_activity_get_actions();
		foreach ( $activity_actions as $component => $actions ) {
			foreach ( $actions as $action_key => $action_value ) {
				$options[ $action_key ] = sprintf( '%s — %s', ucfirst( $component ), ucfirst( $action_value['value'] ) );
			}
		}

		$option = array(
			'option_code'           => $option_code,
			'label'                 => $label,
			'input_type'            => 'select',
			'required'              => true,
			'options'               => $options,
			'default_value'         => 'activity_update',
			'supports_custom_value' => false,
		);

		return apply_filters( 'uap_option_all_buddyboss_actions', $option );
	}

Scroll to Top