WordPress.org

Ready to get started?Download WordPress

Forums

Multisite User Registration Manager
wpdb-prepare error and problem when user registers (7 posts)

  1. Dzynit
    Member
    Posted 1 year ago #

    This is Heather. Rather than email you, I wanted to post here so other people can get the help as well.

    After upgrading WP to 3.5 - they've made a change in the wpdb-prepare function. So this error is shown on the murm-blog-moderation page:
    Warning: Missing argument 2 for wpdb::prepare(), called in /nas/wp/www/staging/exuma/wp-content/plugins/multisite-user-registration-manager/includes/database.php on line 114 and defined in /nas/wp/www/staging/exuma/wp-includes/wp-db.php on line 990

    And these two errors occur when a user tries to register on the frontend:
    Warning: Missing argument 2 for wpdb::prepare(), called in /nas/wp/www/staging/exuma/wp-content/plugins/multisite-user-registration-manager/includes/database.php on line 159 and defined in /nas/wp/www/staging/exuma/wp-includes/wp-db.php on line 990

    Warning: Missing argument 2 for wpdb::prepare(), called in /nas/wp/www/staging/exuma/wp-content/plugins/multisite-user-registration-manager/includes/database.php on line 170 and defined in /nas/wp/www/staging/exuma/wp-includes/wp-db.php on line 990

    WP's function change now requires a second argument to be passed. So using the first error as an example, when I change from this:
    return $wpdb->get_results( $wpdb->prepare( $query ) ); to this:
    return $wpdb->get_results( $wpdb->prepare( $query, '' ) ); the errors stop.

    After fixing the errors, when a user registers, the message:
    "Error! Another request with this username or e-mail address has already been submitted."
    displays no matter what. When the error isn't true, they do show in the murm-blog-registration page in wp-admin, but the user keeps trying different usernames because of that message. I couldn't track down what was causing that.

    When you look into this, could you please remember to send me the changes to make manually like during our email conversations so I can keep the customizations in the murm.php file. (That was to choose a different email address instead of sending to the wp admin.)

    Thanks much.

    http://wordpress.org/extend/plugins/multisite-user-registration-manager/

  2. zaantar
    Member
    Plugin Author

    Posted 1 year ago #

    Hello Heather,

    I hope current version (3.1) fixes the $wpdb->prepare problem. The other issue might be related... please upgrade and try if it persists.

    You can see what exactly have I changed since last version here:

    http://plugins.trac.wordpress.org/changeset?reponame=&new=641188%40multisite-user-registration-manager%2Ftrunk&old=619921%40multisite-user-registration-manager%2Ftrunk

    Zaantar

  3. Dzynit
    Member
    Posted 1 year ago #

    Yes, the upgrade fixed the $wpdb->prepare problem. But the other issue is still there. The new registration is still going into the moderation area just fine, but on the registration page on the frontend is still showing the error message to the user.
    I'll poke around some more too and see if I can find where that's happening.

    I saw the recaptcha on registration is added to the wishlist, too. Did you have one in mind to integrate? If it's going to be a while till you can get that added in, I'll give that try. The site the plugin is being used on is getting spammed pretty bad.

    Thanks, Heather

  4. Dzynit
    Member
    Posted 1 year ago #

    It's definitely line 159 of the database.php:

    $blog_duplicates = $wpdb->get_var( $wpdb->prepare( $blog_query, $username, $email ) );

    It returns 1 no matter what, so the error message displays. Aside from that, it's working correctly. The user is inserted if there really isn't duplicate and is not if there actually is. I can't figure out why it's always returning 1 unless somehow the user is getting inserted before the duplicates check, but I don't see that happening in the code.

    update: I tested that theory by changing the COUNT(*) to id on the $blog_query, then returning it. I then echoed it in the murm.php duplicate check code and the new id is being added before the actual insert code.

    So I'm wondering if the change to the $wpdb->prepare or even maybe a change to the $wpdb_var could actually be inserting if it doesn't exist. So when the duplicate check function runs, and that were happening, that would cause the results I'm getting. I don't know, I'm stumped here!

  5. Hendison Scott
    Member
    Posted 1 year ago #

    Heather is working for me trying to get a clients site working. Besides posting here, she's emailed you too, and have got no response.

    As she says, currently, the registration page on the front end is still showing the error message to the user. - Do you intend to have this resolved soon, or should we look for another solution that doesn't use your plugin?

  6. jdembinski
    Member
    Posted 1 year ago #

    I had the exact same problem - and I tried a few things to fix it. I couldn't figure it out, either. I changed a few things that ended up causing other problems like duplicate requests, etc. But, I took a step back and approached it from a different angle.

    Regardless of the 'error message' displayed when a user submits their information, the request is sent to the site only once. If the same user repeats their information, a new request is not sent. So - the intent of the code is working. The site admin only receives one request per email address / username.

    Therefore, the easiest way to 'fix' the problem was to change the message from an "error" message to a "Thank you" message.

    In the murm.php file, I changed the following code

    FROM

    if( $this->d->is_duplicate_request( $username, $email ) ) {
    			$this->log( 'rr denied - duplicate request', 3 );
    			return $this->shortcode_error( __( 'Error! Another request with this username or e-mail address has already been submitted.' , self::txd ) );
    		}

    TO

    if( $this->d->is_duplicate_request( $username, $email ) ) {
    			$this->log( 'rr denied - duplicate request', 3 );
    			return $this->shortcode_error( __( 'Your request has been sent to the site administrator. Thank you!' , self::txd ) );
    		}

    Yep, I just changed it to a thank you message. Had I never known this was originally an error message, I wouldn't be any the wiser.

    Is this an acceptable long-term solution - of course not.

    Will it work until the developer can post a fix - sure will!

    Jeff

  7. Dzynit
    Member
    Posted 1 year ago #

    Jeff,
    It was taking too long to get this resolved in our situation so we moved on to using: http://wordpress.org/extend/plugins/wp-members/

    It has everything we needed built-in without having to customize the plugin itself. The thank you page, captcha, full control over notices, etc. The only thing to remember is when you install it on a WPMU site, you need to activate it individually on each network site you want to use it on rather than use the network activate. When first activated, it adds all the initial information for the plugin to the correct network site - so network activate doesn't add that info correctly.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.