Support » Plugin: BuddyPress Registration Options » Some problems after updating WP to 3.5 and BP to 1.6.2

  • Resolved roedeltje


    I just updated WP to 3.5 and BP to 1.6.2 and i get the following warning message:

    Warning: Missing argument 2 for wpdb::prepare(), called in …/ on line 19 and defined in …/ on line 990

    From what i understand, the problem is in not in wp-db.php but it is in the plugin.

    Does anyone have the same problem?

Viewing 15 replies - 1 through 15 (of 17 total)
  • Hi Roedeltje The above problem was solved when the Full Throttle Calendar update appeared.

    I am having the same problem.

    According the this post, no sites are broken but the developer needs to fix the error:

    me too having the same error.

    A buddy of mine had this issue and hit me up to help him out, I am not very familiar with this plugin but a quick edit in:


    I changed line 19
    $rs = $wpdb->get_results( $wpdb->prepare( "Select ID from ".$wpdb->base_prefix."users where user_status in (2,69)" ) );


    $rs = $wpdb->get_results( "Select ID from ".$wpdb->base_prefix."users where user_status in (2,69)" );

    Not a fix I know but seems to have removed the error temporarily until a fix can be provided? Not sure if that helps 🙂

    thanxx man it worked 🙂

    but it genrated new problem

    Missing argument 2 for wpdb::prepare(), called in C:\xampp\htdocs\wordpress\wp-content\plugins\bp-registration-options\includes\core.php on line 188 and defined in C:\xampp\htdocs\wordpress\wp-includes\wp-db.php on line 990

    Unfortunately, there are a ton of lines where the plugin developer is not using the prepare function correctly.

    Wherever you see the error, if the line is like this:

    $rs = $wpdb->get_results( $wpdb->prepare( “Select ID from “.$wpdb->base_prefix.”users where user_status in (2,69)” ));

    Then amend it so that it is now like this:

    $rs = $wpdb->get_results( $wpdb->prepare( “Select ID from “.$wpdb->base_prefix.”users where user_status in (2,69)”, “” ));



    @kwerri you seem to have good suggestions here regarding this plugin.

    I don’t see visible errors as others do (other than couple of notification quirks), but the plugin throws a lot of these errors in the background which appear in my error_log.

    May I suggest, that you modify this plugin and provide a link here for testing, or if you are confident enough, upload it as a plugin.

    Obviously the developer has lapsed into a coma or something, but it would be nice to keep this brilliant plugin going…

    Hi G,

    I don’t think I have the time to rewrite the plugin, but I’m more than happy to provide help to anyone who is having a problem using it.

    As far as I can tell, this is the full list of required changes:

    LINE 19

    $rs = $wpdb->get_results( $wpdb->prepare( 'Select ID from %s where user_status in (2,69)', $wpdb->base_prefix.'users' ) );

    LINE 82 to 85

    $sql='update %s set user_status=0 where ID=%d';
    $wpdb->query($wpdb->prepare($sql, $wpdb->base_prefix.'users', $user_id));
    $sql='update %s set hide_sitewide=0 where user_id=%d';
    $wpdb->query($wpdb->prepare($sql, $wpdb->base_prefix.'bp_activity', $user_id));

    LINE 98

    $rs = $wpdb->get_results( $wpdb->prepare( 'Select ID from %s where user_status in (2,69)', $wpdb->base_prefix.'users' ) );

    LINE 251 to 253

    $sql = 'select ID from %s where user_status in (2,69) order by user_registered LIMIT $start_from, 20';
    			$total_pages = ceil($wds_bp_member_requests / 20);
    			$rs = $wpdb->get_results( $wpdb->prepare( $sql , $wpdb->base_prefix.'users') );?>

    LINE 187 to 188

    $sql = 'update %s set hide_sitewide=1 where user_id=%d';
    $wpdb->query( $wpdb->prepare( $sql , $wpdb->base_prefix.'bp_activity', $user_ID) );

    LINE 228 to 233

    //Hide user created by new user on activation.
    	$sql = 'update %s set user_status=69 where ID=%d';
    	$wpdb->query( $wpdb->prepare( $sql , $wpdb->base_prefix.'users', $user_id) );
    //Hide activity created by new user
    	$sql = 'update %s set hide_sitewide=1 where user_id=%d';
    	$wpdb->query( $wpdb->prepare ($sql , $wpdb->base_prefix.'bp_activity', $user_id) );

    Hmm… another issue.

    Fixed by adding this to the bottom of core.php:

    function wds_bp_registration_options_bp_before_member_header(){

    There’s some syntax issues in my earlier post.
    For anyone trying to fix, refer Kwerri’s suggestion:

    // convert this
    $rs = $wpdb->get_results( $wpdb->prepare( "Select ID from ".$wpdb->base_prefix."users where user_status in (2,69)" ));
    //into this
    $rs = $wpdb->get_results( $wpdb->prepare( "Select ID from ".$wpdb->base_prefix."users where user_status in (2,69)", "" ));

    … and apply this technique to all locations I’ve identified.

    @jibbius Thanks very much for your fix. It’s got rid of th error messages but now I can’t see the list of new users to apprve or ban. I can see that there are 9 waiting for action, but their info doesn’t show up on the page

    Any ideas what might be causing this?

    What I did:
    , ""
    to lines 19 and 98 in admin.php

    Replaced the other lines you identified with the code you suggested.

    Thanks for your help with this.

    not 100% sure.

    I think passing “$wpdb->base_prefix” as a parameter to the prepare() function, is not working as expected.

    I haven’t 100% tested… but I’d try using this syntax instead:

    $sql = 'update '.$wpdb->base_prefix.'bp_activity set hide_sitewide=1 where user_id=%d';
    $wpdb->query( $wpdb->prepare( $sql , $user_ID) );

    Essentially, everywhere I instructed you to use %s , you should instead:

    – use ‘.$wpdb->base_prefix.’tablename in the sql line.
    – remove the relevant parameter from the prepare line.

    I hope that helps.
    Your error_log file may help if you still have problems

    You can also simply use ,”” everywhere.
    The prepare function is used to clean user input, so that they cant insert malicious code.
    Its unlikely that either userid or tablenames will contain malicious code, so it’s perfectly fine to use ,””.


Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Some problems after updating WP to 3.5 and BP to 1.6.2’ is closed to new replies.