Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,

    Same error for me.
    Below the php error tab is the actual search result.
    What’s wrong?

    Thanks

    The exact php error I read:

    SCREAM: Error suppression ignored for
    Warning: Missing argument 2 for wpdb::prepare(), called in D:\wamp\www\selfshelfswap\wp-content\plugins\multisite-global-search\inc\shortcodes.php on line 223 and defined in D:\wamp\www\selfshelfswap\wp-includes\wp-db.php on line 992

    Call Stack
    # Time Memory Function Location
    1 0.0004 252832 {main}( ) ..\index.php:0
    2 0.0008 256368 require( ‘D:\wamp\www\selfshelfswap\wp-blog-header.php’ ) ..\index.php:17
    3 1.2243 18997032 require_once( ‘D:\wamp\www\selfshelfswap\wp-includes\template-loader.php’ ) ..\wp-blog-header.php:16
    4 1.2315 19469728 include( ‘D:\wamp\www\selfshelfswap\wp-content\themes\twentythirteen\page.php’ ) ..\template-loader.php:47
    5 1.2511 19564944 the_content( ) ..\page.php:34
    6 1.2511 19565544 apply_filters( ) ..\post-template.php:166
    7 1.2516 19567816 call_user_func_array ( ) ..\plugin.php:173
    8 1.2516 19567848 do_shortcode( ) ..\plugin.php:173
    9 1.2516 19568536 preg_replace_callback ( ) ..\shortcodes.php:188
    10 1.2516 19570288 do_shortcode_tag( ) ..\shortcodes.php:188
    11 1.2516 19570576 call_user_func ( ) ..\shortcodes.php:273
    12 1.2516 19570616 ms_global_search_page( ) ..\shortcodes.php:273
    13 1.2517 19575008 wpdb->prepare( ) ..\shortcodes.php:223

    hilltop28

    (@hilltop28)

    I’m also getting this exact same error.

    I’m worried that it is a result of a WordPress upgrade (I’m using 3.7.1).

    Does anyone know how to resolve this issue??

    I got the same error in 3.8. But it can be fixed. (Please note, I am just a programmer, not the author of the plugin, and no warranties are expressed or implied.)

    The problem seems to be that WordPress, somewhere along the line, changed the function prepare() to take two arguments instead of only one.

    Open the file shortcodes.php, located in the wp-content\plugins\multisite-global-search\inc directory, in a text editor.

    Go to line 223. (If you don’t have a text editor with this functionality just search for “$request = $wpdb->prepare”.) Replace this:

    $request = $wpdb->prepare( "SELECT ".$wpdb->base_prefix."v_posts.* from ".$wpdb->base_prefix."v_posts left join ".$wpdb->users." on ".$wpdb->users.".ID=".$wpdb->base_prefix."v_posts.post_author ".
        			"where ".$wheresearch." ".$termsearch.
        		    "AND ( post_status = 'publish' OR post_status = 'private' ) AND ".$post_type." ORDER BY ".$wpdb->base_prefix."v_posts.blog_id ASC, ".$wpdb->base_prefix."v_posts.post_date DESC, ".$wpdb->base_prefix."v_posts.comment_count DESC" );

    with this:

    $request = $wpdb->prepare( "SELECT ".$wpdb->base_prefix."v_posts.* from ".$wpdb->base_prefix."v_posts left join ".$wpdb->users." on ".$wpdb->users.".ID=".$wpdb->base_prefix."v_posts.post_author ".
        			"where ".$wheresearch." ".$termsearch.
        		    "AND ( post_status = 'publish' OR post_status = 'private' ) AND ".$post_type." ORDER BY ".$wpdb->base_prefix."v_posts.blog_id ASC, ".$wpdb->base_prefix."v_posts.post_date DESC, ".$wpdb->base_prefix."v_posts.comment_count DESC", "" );

    Now go to line 225. Replace this:

    $request = $wpdb->prepare( "SELECT ".$wpdb->base_prefix."v_posts.* from ".$wpdb->base_prefix."v_posts left join ".$wpdb->users." on ".$wpdb->users.".ID=".$wpdb->base_prefix."v_posts.post_author ".
                    "where ".$wheresearch." ".$termsearch.
                    "AND post_status = 'publish' AND ".$post_type." ORDER BY ".$wpdb->base_prefix."v_posts.blog_id ASC, ".$wpdb->base_prefix."v_posts.post_date DESC, ".$wpdb->base_prefix."v_posts.comment_count DESC" );

    with this:

    $request = $wpdb->prepare( "SELECT ".$wpdb->base_prefix."v_posts.* from ".$wpdb->base_prefix."v_posts left join ".$wpdb->users." on ".$wpdb->users.".ID=".$wpdb->base_prefix."v_posts.post_author ".
                    "where ".$wheresearch." ".$termsearch.
                    "AND post_status = 'publish' AND ".$post_type." ORDER BY ".$wpdb->base_prefix."v_posts.blog_id ASC, ".$wpdb->base_prefix."v_posts.post_date DESC, ".$wpdb->base_prefix."v_posts.comment_count DESC", "" );

    This all looks worse than it is. You’re just adding a second empty argument to the wpdb->prepare call so it can be recognized.

    If you do this correctly your error will go away.

    Thanks Aaron, it works perfectly now. Simple solution but something I would never have figured out.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘PHP Warning error’ is closed to new replies.