Skip to content
Browse files

Fixed issue #327 [Missing argument 3 for wpseo_upgrader_process_compl…

…ete](Yoast#327) notice for WP 3.7+
  • Loading branch information...
1 parent 4b83e05 commit 6fe5d7919349774203aac0230ce8797a9cf95789 @jrfnl committed
Showing with 19 additions and 4 deletions.
  1. +18 −4 inc/wpseo-non-ajax-functions.php
  2. +1 −0 readme.txt
View
22 inc/wpseo-non-ajax-functions.php
@@ -237,8 +237,12 @@ function wpseo_description_test() {
add_filter( 'after_switch_theme', 'wpseo_description_test', 0 );
-if ( version_compare( $GLOBALS['wp_version'], '3.5.99', '>' ) ) {
- // Use the new action hook
+if ( version_compare( $GLOBALS['wp_version'], '3.6.99', '>' ) ) {
+ // Use the new and *sigh* adjusted action hook WP 3.7+
+ add_action( 'upgrader_process_complete', 'wpseo_upgrader_process_complete', 10, 2 );
+}
+else if ( version_compare( $GLOBALS['wp_version'], '3.5.99', '>' ) ) {
+ // Use the new action hook WP 3.6+
add_action( 'upgrader_process_complete', 'wpseo_upgrader_process_complete', 10, 3 );
}
else {
@@ -256,7 +260,7 @@ function wpseo_description_test() {
*
* @return void
*/
-function wpseo_upgrader_process_complete( $upgrader_object, $context_array, $themes ) {
+function wpseo_upgrader_process_complete( $upgrader_object, $context_array, $themes = null ) {
$options = get_option( 'wpseo' );
// Break if admin_notice already in place
@@ -269,6 +273,16 @@ function wpseo_upgrader_process_complete( $upgrader_object, $context_array, $the
}
$theme = get_stylesheet();
+ if ( ! isset( $themes ) ) {
+ // WP 3.7+
+ $themes = array();
+ if ( isset( $context_array['themes'] ) && $context_array['themes'] !== array() ) {
+ $themes = $context_array['themes'];
+ }
+ else if ( isset( $context_array['theme'] ) && $context_array['theme'] !== '' ){
+ $themes = $context_array['theme'];
+ }
+ }
if ( ( isset( $context_array['bulk'] ) && $context_array['bulk'] === true ) && ( is_array( $themes ) && count( $themes ) > 0 ) ) {
@@ -276,7 +290,7 @@ function wpseo_upgrader_process_complete( $upgrader_object, $context_array, $the
wpseo_description_test();
}
}
- else if ( $themes === $theme ) {
+ else if ( is_string( $themes ) && $themes === $theme ) {
wpseo_description_test();
}
return;
View
1 readme.txt
@@ -126,6 +126,7 @@ You'll find the [FAQ on Yoast.com](http://yoast.com/wordpress/seo/faq/).
* (Temporary) fix for metabox styling for users using the MP6 plugin - props [Jrf](http://profiles.wordpress.org/jrf).
* Minor fix in localization loading - props [Jrf](http://profiles.wordpress.org/jrf).
* Yoast tracking cron job will now unschedule on disallowing of tracking and on uninstall, inspired by [Bluebird Blvd.](http://wordpress.org/support/topic/found-active-tracking-device-after-deleting-wp-seo-months-ago) - props [Jrf](http://profiles.wordpress.org/jrf).
+ * Fixed [Missing argument 3 for wpseo_upgrader_process_complete](https://github.com/Yoast/wordpress-seo/issues/327) notice for WP 3.7+, thanks [vickyindo](https://github.com/vickyindo), [Wendyhihi](https://github.com/Wendihihi) and [Theressa1](https://github.com/Theressa1) for reporting - props [Jrf](http://profiles.wordpress.org/jrf).
= 1.4.18 =

1 comment on commit 6fe5d79

@coachmaria

What is a human with no experience in php code supposed to do to fix the problem?

After upgrading from WordPress 3.6.1 to 3.7, the following message appears each time a plug-in is updated:

Warning: Missing argument 3 for wpseo_upgrader_process_complete() in /.../wp-content/plugins/wordpress-seo/inc/wpseo-non-ajax-functions.php on line 259

This is being discussed by dozens of others experiencing the same problem on the WordPress.org repository at http://wordpress.org/support/topic/does-it-work-correctly-with-wordpress-37

Please sign in to comment.
Something went wrong with that request. Please try again.