uncanny_one_click_install_plugin_active_text
Filters the text displayed for an active plugin in the one-click install interface before it's rendered.
add_filter( 'uncanny_one_click_install_plugin_active_text', $callback, 10, 2 );
Description
Allows developers to customize the text displayed for an already active plugin in the one-click installer. Developers can alter the default "Plugin Name is active" message using the provided plugin information.
Usage
add_filter( 'uncanny_one_click_install_plugin_active_text', 'your_function_name', 10, 2 );
Parameters
-
$button_text(mixed) - This parameter represents the current text of the button that will be displayed.
-
$plugin_info(mixed) - This parameter contains the text that will be displayed on the button when a plugin is active.
Return Value
The filtered value.
Examples
<?php
/**
* Example: Change the text displayed for an active plugin in the Uncanny One-Click Installer.
*
* This filter allows you to customize the text that appears on the button
* when a plugin is already active.
*
* @param string $button_text The current text for the button.
* @param object $plugin_info An object containing information about the plugin.
* Expected properties include:
* - name (string): The display name of the plugin.
* - slug (string): The plugin slug.
* - is_active (bool): Whether the plugin is currently active.
* @return string The modified button text.
*/
add_filter( 'uncanny_one_click_install_plugin_active_text', function( $button_text, $plugin_info ) {
// Check if the plugin is specifically Uncanny Automator and modify the text.
if ( isset( $plugin_info->slug ) && 'uncanny-automator' === $plugin_info->slug ) {
// Add a slightly more specific message for Uncanny Automator.
return sprintf( esc_html__( 'Uncanny Automator is already active', 'your-text-domain' ), $plugin_info->name );
}
// For all other active plugins, simply append "(Installed & Active)" to the default text.
return $button_text . ' (Installed & Active)';
}, 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
src/install-automator/vendor/uncanny-one-click-installer/class-auto-plugin-install.php:566
$button_text = apply_filters( 'uncanny_one_click_install_plugin_initial_text', $button_text, $plugin_info );
if ( $plugin_info->is_active ) {
$action = esc_attr( '' );
$disabled = esc_attr( 'disabled="disabled"' );
$button_text = sprintf( esc_html__( '%s is active', 'uncanny-ceu' ), $plugin_info->name );
$button_text = apply_filters( 'uncanny_one_click_install_plugin_active_text', $button_text, $plugin_info );
} elseif ( $plugin_info->is_installed ) {
$action = esc_attr( 'activate' );
if ( 'uncanny-automator' === (string) $plugin_slug ) {
$button_text = esc_html__( 'Activate Uncanny Automator', 'uncanny-ceu' );
} else {
$button_text = sprintf( esc_html__( 'Activate %s', 'uncanny-ceu' ), $plugin_info->name );
}