TGMPA / TGM-Plugin-Activation

TGM Plugin Activation is a PHP library that allows you to easily require or recommend plugins for your WordPress themes (and plugins). It allows your users to install, update and even automatically activate plugins in singular or bulk fashion using native WordPress classes, functions and interfaces. You can reference bundled plugins, plugins from the WordPress Plugin Repository or even plugins hosted elsewhere on the internet.
http://tgmpluginactivation.com/
GNU General Public License v2.0
1.76k stars 429 forks source link

Warning: sprintf(): Too few arguments #669

Closed theemwiz closed 7 years ago

theemwiz commented 7 years ago

I am getting this warning Warning: sprintf(): Too few arguments when installing plugins through TGMPA script on WordPress 4.8. Is this a known warning with latest version of WordPress?

simrandeep commented 7 years ago

I am too facing the same issue. Can you please provide a fix for it?

GaryJones commented 7 years ago

Can you be more descriptive about the error message please?

Which plugin or theme is using TGMPA? What version of TGMPA is being used?

theemwiz commented 7 years ago

The TGMPA version which is used is 2.6.1. I am developing this theme.

tgmpa-4 8-warning

simrandeep commented 7 years ago

I have tested it in 4 WordPress themes with TGM v2.6.1 and getting the same error as shown in screenshot above.

al5dy commented 7 years ago

I have the same error. The problem appeared after the 4.8v wp.

al5dy commented 7 years ago

Bingo! Issue solved. I added some changes in class-tgm-plugin-activation.php

Change: $this->upgrader->strings['skin_update_successful'] = %HERE LONG DEFAULT CODE CALLED ERROR% to $this->upgrader->strings['skin_update_successful'] = __( '%1$s done.' );

simrandeep commented 7 years ago

@al5dy Can you attach the full code here?

al5dy commented 7 years ago

@simrandeep Fix only one function. https://gist.github.com/al5dy/965d0eefffab32df3b04badbc2274d08

simrandeep commented 7 years ago

@al5dy

Thank you! It fixed the issue :)

theemwiz commented 7 years ago

@al5dy Thanks for the fix. Look forward to TGMPA official update.

GaryJones commented 7 years ago

Thanks all for the useful feedback - we'll look into this ASAP (as we'll also need to make it work with older versions of WP.

notrealdev commented 7 years ago

I have the same error and can not install requires plugin on PHP 5.3 // WP 4.8

jrfnl commented 7 years ago

A fix for this issue (#670) has now been merged in and will be included in the upcoming 2.6.2 release.

hellor0bot commented 7 years ago

@jrfnl Any updates on the release?

masterbip commented 6 years ago

Many thanks @al5dy. Your fix worked!

MiGzY commented 6 years ago

Is this still an issue in 4.9? I just did a clean install, installed Jupiter 6.1.1 and got the error on required plugins. Warning: sprintf(): Too few arguments in \wp-admin\includes\class-bulk-upgrader-skin.php on line 150

Had to fix with: Old Code: if ( $this->result && ! is_wp_error( $this->result ) ) { if ( ! $this->error ) { echo '

' . '

' . sprintf( $this->upgrader->strings['skin_update_successful'], $title ) . ' ' . '

'; } echo ''; }

New Code: if ( $this->result && ! is_wp_error( $this->result ) ) { if ( ! $this->error ) echo '

' . sprintf($this->upgrader->strings['skin_update_successful'], $title, 'jQuery(\'#progress-' . esc_js($this->upgrader->update_current) . '\').toggle();jQuery(\'span\', this).toggle(); return false;') . '

'; echo ''; }

Alphawarz commented 6 years ago

@MiGzY Ran into this issue as well, however, a solution I found (courtesy of ahmadhassan10) was to replace:

            if ( ! $this->error ) {
                echo '<div class="updated js-update-details" data-update-details="progress-' . esc_attr( $this->upgrader->update_current ) . '">' .
                    '<p>' . sprintf( $this->upgrader->strings['skin_update_successful'], $title ) .
                    ' <button type="button" class="hide-if-no-js button-link js-update-details-toggle" aria-expanded="false">' . __( 'Show details.' ) . '</button>' .
                    '</p></div>';
            }

            echo '<script type="text/javascript">jQuery(\'.waiting-' . esc_js($this->upgrader->update_current) . '\').hide();</script>';
        }

With This:

            if ( ! $this->error )
                echo '<div class="updated"><p>' . sprintf($this->upgrader->strings['skin_update_successful'], $title, 'jQuery(\'#progress-' . esc_js($this->upgrader->update_current) . '\').toggle();jQuery(\'span\', this).toggle(); return false;') . '</p></div>';
                    echo '<script type="text/javascript">jQuery(\'.waiting-' . esc_js($this->upgrader->update_current) . '\').hide();</script>';
        }

Seems to work fine now.

MiGzY commented 6 years ago

Yes - that's a stripped down version of my code by the looks.

Remzi1993 commented 5 years ago

This is still happening! When do you release a new version? If I check on relases I see 2.6.1 is the latest.

amrinz commented 4 years ago

Still there:

Warning: sprintf(): Too few arguments in D:\xampp\htdocs\main.wp\wp-admin\includes\class-bulk-upgrader-skin.php on line 152

alexdx-ca commented 3 years ago

I have the same issue