Skip to content

Instantly share code, notes, and snippets.

@al5dy
Last active September 29, 2023 12:08
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save al5dy/965d0eefffab32df3b04badbc2274d08 to your computer and use it in GitHub Desktop.
Save al5dy/965d0eefffab32df3b04badbc2274d08 to your computer and use it in GitHub Desktop.
TGM 'Warning: sprintf(): Too few arguments...' bugfix
/**
* Sets install skin strings for each individual plugin.
*
* Checks to see if the automatic activation flag is set and uses the
* the proper strings accordingly.
*
* @since 2.2.0
*/
public function add_strings() {
if ( 'update' === $this->options['install_type'] ) {
parent::add_strings();
/* translators: 1: plugin name, 2: action number 3: total number of actions. */
$this->upgrader->strings['skin_before_update_header'] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' );
} else {
/* translators: 1: plugin name, 2: error message. */
$this->upgrader->strings['skin_update_failed_error'] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' );
/* translators: 1: plugin name. */
$this->upgrader->strings['skin_update_failed'] = __( 'The installation of %1$s failed.', 'tgmpa' );
if ( $this->tgmpa->is_automatic ) {
// Automatic activation strings.
$this->upgrader->strings['skin_upgrade_start'] = __( 'The installation and activation process is starting. This process may take a while on some hosts, so please be patient.', 'tgmpa' );
/* translators: 1: plugin name. */
$this->upgrader->strings['skin_update_successful'] = __( '%1$s done.' );
$this->upgrader->strings['skin_upgrade_end'] = __( 'All installations and activations have been completed.', 'tgmpa' );
/* translators: 1: plugin name, 2: action number 3: total number of actions. */
$this->upgrader->strings['skin_before_update_header'] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' );
} else {
// Default installation strings.
$this->upgrader->strings['skin_upgrade_start'] = __( 'The installation process is starting. This process may take a while on some hosts, so please be patient.', 'tgmpa' );
/* translators: 1: plugin name. */
$this->upgrader->strings['skin_update_successful'] = __( '%1$s done.' );
$this->upgrader->strings['skin_upgrade_end'] = __( 'All installations have been completed.', 'tgmpa' );
/* translators: 1: plugin name, 2: action number 3: total number of actions. */
$this->upgrader->strings['skin_before_update_header'] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' );
}
}
}
@Khaled56
Copy link

hello, i changed that text, but still facing that warning, can you help me?please,

@dharmeshtops
Copy link

now working.

@ishaadX
Copy link

ishaadX commented Sep 26, 2017

sorry... I can't make it work in 2.6.1

@claash
Copy link

claash commented Apr 22, 2018

Wordpress 4.9.5, TGM 2.6.1. It's work, thanks.

@Christianzimpel
Copy link

Thank you it works fine for me. Version 2.6.1 WP 4.9.8

@Sharifur
Copy link

works for me. thanks

Version 2.6.1 WP 5.1

@pulaknondi
Copy link

Bingoo Its works fine.thank you .

@dmzname
Copy link

dmzname commented Mar 27, 2021

Thank's, it's work for my theme 👍

@idesignzone
Copy link

I am facing this issue on 5.7.2 and this gist didn't fix it.

@eroffa
Copy link

eroffa commented Sep 30, 2021

Solution:
In the add_strings() method, change the value of the $this->upgrader->strings['skin_update_successful'] property by removing the onclick="%2$s".

@jimpatrick
Copy link

Solution: In the add_strings() method, change the value of the $this->upgrader->strings['skin_update_successful'] property by removing the onclick="%2$s".

It's worked for me, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment