ulgm_admin_sidebar_try_automator_text
Add UncannyAutomator page. Filters the text used for the "Automation" link in the Uncanny Automator admin sidebar.
add_filter( 'ulgm_admin_sidebar_try_automator_text', $callback, 10, 1 );
Description
Filters the text displayed for the "Try Automator" link in the Uncanny LearnDash Groups admin sidebar. Developers can modify this text, for example, to include specific branding or call-to-action language, when the Uncanny Automator plugin is not yet installed.
Usage
add_filter( 'ulgm_admin_sidebar_try_automator_text', 'your_function_name', 10, 1 );
Return Value
void
Examples
// Example of how to modify the text displayed for the "Try Automator" menu item in the Uncanny Groups admin sidebar.
add_filter( 'ulgm_admin_sidebar_try_automator_text', 'my_custom_automator_sidebar_text', 10, 1 );
/**
* Changes the default text for the Automator sidebar menu item to be more descriptive.
*
* @param string $default_text The default text for the menu item.
* @return string The modified text for the menu item.
*/
function my_custom_automator_sidebar_text( $default_text ) {
// Check if the Uncanny Automator plugin is actually installed and active.
// If it is, we might want to prompt users to explore its features.
if ( defined( 'AUTOMATOR_PRO_VERSION' ) || defined( 'AUTOMATOR_VERSION' ) ) {
return __( 'Explore Uncanny Automator Features', 'uncanny-learndash-groups' );
} else {
// If Automator is not installed, we can encourage its installation.
return __( 'Try Uncanny Automator for Free!', 'uncanny-learndash-groups' );
}
}
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
src/classes/admin/install-automator/install-automator.php:124
public function menu_uncanny_automator() {
if ( defined( 'AUTOMATOR_BASE_FILE' ) ) {
return;
}
if ( ! apply_filters( 'ulgm_admin_sidebar_try_automator_add', true ) ) {
return;
}
/* translators: Trademarked term */
$menu_item_text = apply_filters( 'ulgm_admin_sidebar_try_automator_text', __( 'Automation', 'uncanny-learndash-groups' ) );
$menu_item_html = '<span class="ulgm-sidebar-featured-item">' . apply_filters( 'ulgm_admin_sidebar_try_automator_inner_html', '<span class="ulgm-sidebar-featured-item__text">' . esc_html( $menu_item_text ) . '</span>' ) . '</span>';
add_submenu_page(
'uncanny-groups-create-group',
$menu_item_text,
$menu_item_html,
'manage_options',
'groups-install-automator',
array(
$this,
'admin_page_uncanny_automator',
),
6
);
}