WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Warning: Missing argument 2 for wpdb::prepare()

[Resolved] Warning: Missing argument 2 for wpdb::prepare()

Viewing 7 replies - 1 through 7 (of 7 total)
  • I’ve got the same warning coming up after installing and activating.

    The plugin does actually work, however the warning shows up in my Dashboard as well as on the front-end.

    I’m working locally so cannot give you a link, but here is a SCREENSHOT of the front end and a SCREENSHOT of the back-end

    I have just upgraded my WP to 3.5 – plads9000: which version of WP do you have? – maybe it is not compatible yet?
    If this is the case, when will it be compatible? The site is about to go live in the next few days and it would be great if the Manager can actually manage the sales 🙂
    Cheers!

    Actually, just found this post on how to add this functionality into your theme’s functions.php.

    Just add this code at the bottom LIKE SO:

    //adding extra capability for Editor to access Store Sales and Sales Log//
    add_filter( 'wpsc_purchase_logs_cap', 'wpse_72095_admin_to_editor' );
    
    function wpse_72095_admin_to_editor()
    {
    return 'edit_others_posts'; //modify this according to the role you need to target
    }

    This worked for me! See SCREENSHOT

    Plads9000, let us know if this worked for you too so we can resolve this issue 🙂

    Thank you for your reply.

    After writing the post above I installed another plugin, which caused the same error. But after some search I came accross this,

    PHP Warning: Missing argument 2 for wpdb::prepare()

    I just added, @ini_set(‘display_errors’, 0);, to the ini file and the warning notice is gone.

    As you say and as mentioned in the article, the plugins do work, it’s just a new warning.

    That’s great news that you managed to solve it too whilst continuing to use the plugin!
    You should mark this thread as resolved 🙂

    Yes 🙂

    I don’t agree that this is solved. Hiding the error message does not solve the problem.

    Line 54 in purchase_history.php should be fixed by project developers:
    $sql = “SELECT COUNT(*) FROM ".WPSC_TABLE_PURCHASE_LOGS." WHERE user_ID IN (‘”.$user_id.”‘)
    $purchase_count= $wpdb->get_var($wpdb->prepare($sql)) ;

    Replace ($wpdb->prepare($sql)) with $wpdb->prepare($query, $args))

    Should work fine.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] Warning: Missing argument 2 for wpdb::prepare()’ is closed to new replies.