Filter
uncanny-automator-pro
uap_option_get_bp_activity_actions_list
Filters the list of BuddyPress activity actions available to the User Activities Pro plugin.
add_filter( 'uap_option_get_bp_activity_actions_list', $callback, 10, 1 );
Description
Fires when Uncanny Automator Pro retrieves the list of BuddyPress activity actions for a select input. Developers can use this filter to modify the available activity actions, adding custom options or removing existing ones. The `$option` parameter contains the array of action options.
Usage
add_filter( 'uap_option_get_bp_activity_actions_list', 'your_function_name', 10, 1 );
Parameters
-
$option(mixed) - This parameter holds the code for the specific Uncanny Automator option related to BuddyPress activity actions.
Return Value
The filtered value.
Examples
add_filter(
'uap_option_get_bp_activity_actions_list',
'my_custom_bp_activity_actions',
10,
1
);
/**
* Example custom function to modify the list of BuddyPress activity actions.
* This function adds a new custom activity action to the list.
*
* @param array $option The original array of BuddyPress activity action options.
* @return array The modified array of BuddyPress activity action options.
*/
function my_custom_bp_activity_actions( $option ) {
// Add a new custom activity action to the options array.
// In a real-world scenario, you might fetch this dynamically or have a predefined list.
$option['options']['new_custom_activity'] = __( 'New Custom Activity', 'your-text-domain' );
// Optionally, you could change the default value if your new action should be the default.
// $option['default_value'] = 'new_custom_activity';
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/buddypress/helpers/buddypress-pro-helpers.php:386
public function get_bp_activity_actions_list( $option_code = 'BUDDYPRESS_ACTIVITY_ACTION', $label = null ) {
if ( ! $label ) {
$label = esc_attr_x( 'Activity action', 'Buddypress', '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_get_bp_activity_actions_list', $option );
}