Filter
uncanny-automator-pro
uncanny_one_click_install_plugin_installed_text
Filters the text displayed when a plugin is successfully installed via one-click installation.
add_filter( 'uncanny_one_click_install_plugin_installed_text', $callback, 10, 2 );
Description
Filters the button text displayed for an already installed plugin during one-click installation. Developers can modify this text to customize messages, for example, to change "Activate Plugin" to something more specific, offering greater control over the user interface.
Usage
add_filter( 'uncanny_one_click_install_plugin_installed_text', 'your_function_name', 10, 2 );
Parameters
-
$button_text(mixed) - This parameter contains the current text displayed on the button after a plugin has been successfully installed.
-
$plugin_info(mixed) - This parameter contains the current text displayed on the button after a plugin has been successfully installed, allowing for customization of the activation prompt.
Return Value
The filtered value.
Examples
/**
* Example of how to filter the button text for an installed plugin in Uncanny Automator's one-click installer.
*
* This example adds a suffix to the button text if the plugin is "Uncanny Automator Pro".
*
* @param string $button_text The current button text.
* @param object $plugin_info An object containing information about the plugin.
* @return string The modified button text.
*/
add_filter( 'uncanny_one_click_install_plugin_installed_text', function( $button_text, $plugin_info ) {
// Check if the plugin is specifically 'Uncanny Automator Pro'.
// We'll use a hardcoded slug for demonstration, but in a real scenario,
// you might check $plugin_info->slug or a more robust identifier.
if ( isset( $plugin_info->slug ) && 'uncanny-automator-pro' === $plugin_info->slug ) {
// Append a custom suffix to the button text.
$button_text .= ' (Manage)';
}
return $button_text;
}, 10, 2 );
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/core/admin/installer/class-plugin-installer.php:592
/* translators: Button text */
$button_text = esc_html__( 'Activate Uncanny Automator', 'uncanny-automator-pro' );
} else {
/* translators: Button text */
$button_text = sprintf( esc_html__( 'Activate %s', 'uncanny-automator-pro' ), $plugin_info->name );
}
$button_text = apply_filters( 'uncanny_one_click_install_plugin_installed_text', $button_text, $plugin_info );
}
// return button html.
ob_start();
?>