WordPress.org

Ready to get started?Download WordPress

Forums

Redirection
Warning messages after update to WordPress 3.5 (27 posts)

  1. Cardoza
    Member
    Posted 1 year ago #

    Since I updated to WP 3.5, the plugin Redirection are showing "Warning messages", the plugin still working but I don't like to see that warning messages when I am using redirection plugin. This is the warning message that appears over all the page of Redirection plugin:

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/wp-content/plugins/redirection/models/group.php on line 70 and defined in /home/wp-includes/wp-db.php on line 990

    Example: http://i.imgur.com/J8C4G.jpg

    Also I got the same message when I am in a "Redirections for group" page and I try to edit any redirection, I get the same message over the field

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/wp-content/plugins/redirection/models/group.php on line 70 and defined in /home/wp-includes/wp-db.php on line 990

    Example: http://i.imgur.com/u3olv.jpg

    http://wordpress.org/extend/plugins/redirection/

  2. bkglass
    Member
    Posted 1 year ago #

    I'm getting the same warning message after WP 3.5 update.

  3. GR Web Guy
    Member
    Posted 1 year ago #

    Unfortunately I'm getting the same thing here. I did a vanilla install of WordPress 3.5 and added just that plugin to confirm there wasn't anything else possibly conflicting.

  4. GR Web Guy
    Member
    Posted 1 year ago #

    Follow up: Here's some info from Andrew Nacin posted today (12/12/12) regarding this issue in 3.5. Apparently it is simply a warning. Nothing is technically broken and the plugin will function correctly. However, this could open the plugin up for injection issues. It should be fixed.

    http://make.wordpress.org/core/2012/12/12/php-warning-missing-argument-2-for-wpdb-prepare/

  5. Braaad Roy
    Member
    Posted 1 year ago #

    How to fix? Export csv wont work anymore...

  6. John Saddington
    Member
    Posted 1 year ago #

    Sun Dec 16 12:10:34 2012] [error] [client 94.228.34.212] WordPress database error Table 'xxxxxxxxxxxxxxx.wp_redirection_logs' doesn't exist for query INSERT INTO wp_redirection_logs (url,sent_to,created,agent,redirection_id,ip,referrer,module_id,group_id) VALUES ('/forums/forumdisplay.php?f=7','',NOW(),'magpie-crawler/1.1 (U; Linux amd64; en-GB; +http://www.brandwatch.net)',0,'94.228.34.212','',3,0) made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), do_action('template_redirect'), call_user_func_array, Error404_Module->template_redirect, RE_Log->create

    broken.

  7. Rajasekharan N
    Member
    Posted 1 year ago #

    I too am getting an error something like this after WordPress upgrade to 3.5:

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/urbangiraffe/public_html/wp-content/plugins/redirection/models/group.php on line 70 and defined in /home/urbangiraffe/public_html/wp-includes/wp-db.php on line 990

  8. Sam Scholfield
    Member
    Posted 1 year ago #

    Hi All,

    This fix will get rid of the error, please be aware that it is changing the plugin files directly, so it will be overwritten the next time an update is released (which will hopefully contain the fix!)

    Go to /wp-content/plugins/redirection/group.php line 70

    Change $wpdb->prepare to $wpdb->query

    That's it. prepare is the wrong function here because there isn't a where clause, so you can't pass it through a value to sanitise with the prepare function.

    Hope that helps someone!

  9. Naziman
    Member
    Posted 1 year ago #

    Hye,

    Is it

    /wp-content/plugins/redirection/group.php

    or

    /wp-content/plugins/redirection/models/group.php

    because in plugin editor i don't see that file. And my warning also show models/group.php

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/xxxxx/public_html/wp-content/plugins/redirection/models/group.php on line 70 and defined in /home/xxxxx/public_html/wp-includes/wp-db.php on line 990

    Regards,

    blog Naziman

  10. Sam Scholfield
    Member
    Posted 1 year ago #

    Hi Naziman,

    Yes it's in models, sorry! /wp-content/plugins/redirection/models/group.php.

    The function it's in is get_for_select().

    Regards,
    Sam

  11. BjornB
    Member
    Posted 1 year ago #

    Same error for me. Changing $wpdb->prepare to $wpdb->query removed the error. Thanks Sam.

  12. bkglass
    Member
    Posted 1 year ago #

    Thanks Sam... Your solution worked.

  13. yorsh
    Member
    Posted 1 year ago #

    It worked for me too. Thank you Sam.

  14. ogenox
    Member
    Posted 1 year ago #

    Thanks Sam, this fixed my error too.

  15. nickth
    Member
    Posted 1 year ago #

    That worked, thanks Sam!

  16. kitelife
    Member
    Posted 1 year ago #

    I did this fix and the error is gone, but now my redirection GROUPS won't appear in the drop down menu, so I can't sort or search by group.

    Any other suggestions?

  17. mbrsolution
    Member
    Posted 1 year ago #

    Hello all, this is very strange. I have updated the plugin in all my sites and the error that you are all experiencing is not occurring for me. @Sam Scholfield, his fix does the trick but I am curious as to why some have reported this issue and not all.

  18. kgerber
    Member
    Posted 1 year ago #

    I am a novice when it comes to programming and am having trouble with the fix. Can someone offer some guidance on how to get to: /wp-content/plugins/redirection/models/group.php in order to make the change? When I type in my website address followed by: /wp-content/plugins/redirection/models/group.php I get an error message. Any support would be greatly appreciated!

  19. mbrsolution
    Member
    Posted 1 year ago #

    @kgerber you need to FTP into your server, navigate to the path you mention download the file group.php, edit the file by adding the information mentioned and then upload it again into the same path you downloaded the file from.

    This is the best method to use. Also make a copy of the file you download locally just in case something goes wrong.

    I hope this helps you.

    Kind regards

  20. Cardoza
    Member
    Posted 1 year ago #

    I did this fix and the error is gone, but now my redirection GROUPS won't appear in the drop down menu, so I can't sort or search by group.
    
    Any other suggestions?

    Same problem with me! Sam's fix the error message, but now I can't see the groups I created in redirection plugin!

    Someone can help with this big problem please?

  21. Cardoza
    Member
    Posted 1 year ago #


  22. mbrsolution
    Member
    Posted 1 year ago #

    I found this link php-warning-missing-argument-2-for-wpdb-prepare that might assist you further and understand why you are getting this error.

    I hope this helps

  23. peterjanes
    Member
    Posted 1 year ago #

    @Cardoza and @kitelife and others with missing groups:

    (Edited to use the solution in current SVN instead)

    Instead of changing $wpdb->prepare to $wpdb->query, just remove the $wpdb->prepare( and the closing ), i.e. change

    $rows = $wpdb->get_results( $wpdb->prepare( "SELECT {$wpdb->prefix}redirection_modules.name AS module_name,{$wpdb->prefix}redirection_groups.name AS group_name,{$wpdb->prefix}redirection_groups.id FROM {$wpdb->prefix}redirection_groups INNER JOIN {$wpdb->prefix}redirection_modules ON {$wpdb->prefix}redirection_modules.id={$wpdb->prefix}redirection_groups.module_id ORDER BY {$wpdb->prefix}redirection_modules.name,{$wpdb->prefix}redirection_groups.position" ) );

    to

    $rows = $wpdb->get_results( "SELECT {$wpdb->prefix}redirection_modules.name AS module_name,{$wpdb->prefix}redirection_groups.name AS group_name,{$wpdb->prefix}redirection_groups.id FROM {$wpdb->prefix}redirection_groups INNER JOIN {$wpdb->prefix}redirection_modules ON {$wpdb->prefix}redirection_modules.id={$wpdb->prefix}redirection_groups.module_id ORDER BY {$wpdb->prefix}redirection_modules.name,{$wpdb->prefix}redirection_groups.position" );

  24. Seth Carstens
    Member
    Posted 1 year ago #

    Warning: Missing argument 2 for wpdb::prepare(), wouldn't it be nice to here from the author... 3.5 has been out long enough now. Please update your plugin for the community!

  25. Vince
    Member
    Posted 1 year ago #

    I am hoping for an update as well...

  26. Vince
    Member
    Posted 1 year ago #

    Even with the fixes above, I still cannot add redirect. Whenever I try to do so, I get the following error message:

    Sorry, but your redirection was not created

  27. Vince
    Member
    Posted 1 year ago #

    OK, seems like I got it to work...

    /wp-content/plugins/redirection/models/group.php - Following Sam's tip to change line 70's $wpdb->prepare to $wpdb->query.

    The error I received went away after I clicked on the Delete button in the plugin's Options page and re-activated the plugin.

    Hope this helps.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic