WordPress.org

Ready to get started?Download WordPress

Forums

BuddyPress Registration Options
[resolved] Some problems after updating WP to 3.5 and BP to 1.6.2 (18 posts)

  1. roedeltje
    Member
    Posted 1 year ago #

    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 .../mydomain.nl/public_html/wp-content/plugins/bp-registration-options/includes/admin.php on line 19 and defined in .../mydomain.nl/public_html/wp-includes/wp-db.php 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?

    http://wordpress.org/extend/plugins/bp-registration-options/

  2. Lynn Hill
    Member
    Posted 1 year ago #

    Hi Roedeltje The above problem was solved when the Full Throttle Calendar update appeared.

  3. kboehlert
    Member
    Posted 1 year ago #

    I am having the same problem.

    According the this post, no sites are broken but the developer needs to fix the error:
    http://make.wordpress.org/core/2012/12/12/php-warning-missing-argument-2-for-wpdb-prepare/

  4. hindicell
    Member
    Posted 1 year ago #

    me too having the same error.

  5. vintagedaddyo
    Member
    Posted 1 year ago #

    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:

    wp-content/plugins/bp-registration-options/includes/admin.php

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

    to:

    $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 :)

  6. hindicell
    Member
    Posted 1 year ago #

    thanxx man it worked :)

  7. hindicell
    Member
    Posted 1 year ago #

    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

  8. kwerri
    Member
    Posted 1 year ago #

    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)", "" ));

  9. G
    Member
    Posted 1 year ago #

    @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...

  10. kwerri
    Member
    Posted 1 year ago #

    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.

  11. jibbius
    Member
    Plugin Contributor

    Posted 1 year ago #

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

    admin.php
    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') );?>

    core.php
    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) );
  12. jibbius
    Member
    Plugin Contributor

    Posted 1 year ago #

    Hmm... another issue.

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

    function wds_bp_registration_options_bp_before_member_header(){
    }
    ?>
  13. jibbius
    Member
    Plugin Contributor

    Posted 1 year ago #

    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.

  14. Brimfulof
    Member
    Posted 1 year ago #

    @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 mysite.com/wp-admin/admin.php?page=bp_registration_options_member_requests page

    Any ideas what might be causing this?

    What I did:
    Added
    , ""
    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.

  15. jibbius
    Member
    Plugin Contributor

    Posted 1 year ago #

    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

  16. jibbius
    Member
    Plugin Contributor

    Posted 1 year ago #

    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 ,"".

    Goodluck.

  17. jibbius
    Member
    Plugin Contributor

    Posted 1 year ago #

    Posted a new version of the plugin on GitHub:
    https://github.com/jibbius/bp-registration-options-wp3.5

    Hopefully when Brian comes online again, he'll use it to formally update the plugin.

  18. Brimfulof
    Member
    Posted 1 year ago #

    Thanks very much @jibbius I've applied your version from Github and all seems to be working well.

    Liked your fix to only show notifications to admins too, I was looking for that.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.