• Resolved michael walker

    (@michael-walker)


    I’m using the current versions of your plug-in with WP 4.1.1. Since installing ver 3.0, I have an error when editing/updating user profiles in the Admin area. The error is:

    Warning: mysql_real_escape_string() expects parameter 1 to be string, object given in /wp-includes/wp-db.php on line 1036

    Warning: Cannot modify header information – headers already sent by (output started at /wp-includes/wp-db.php:1036) in /wp-includes/pluggable.php on line 1178

    If I deactivate the plug-in, all is fine. Any ideas/help much appreciated.

    https://wordpress.org/plugins/allow-multiple-accounts/

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    @michael-walker : Hmm, I’m not able to reproduce the error myself. When editing/updating a user profile, were you changing the email address, or does the error occur regardless of what fields you change?

    Are you able to test the plugin with all other plugins disabled? If not, could you list the plugins you have installed? It’s possible there’s an issue between the interaction of this plugin with another.

    And were you using the plugin before v3.0, or are you coming to it new? (Just want to check if things had worked for you before the v3.0 update if you were an existing user.)

    Thread Starter michael walker

    (@michael-walker)

    Thanks so much for the quick response. To take your points in order:

    This happens even if I change nothing – that is, just open up a user’s profile and then click ‘Save Changes’.

    I suspect there is a clash with another plug-in, if only because this particular site is pretty plug-in heavy. I haven’t yet been able to isolate all of them individually (there are 45 in total), but those I suspected (as they act with the user profile fields) are wp-members, groups, expire users, email users and amr-users. However, de-activating each of these in turn (which is as far as I’ve got ) has not fixed things.

    Your plug-in has been installed for well over a year and has not (as far as I know) caused any upsets. As a test, I rolled back to the previous version (2.6.2) and this removed the problem. However, I would like to run the most current version if possible.

    I’m listing below all the currently active plug-ins on my site (with apologies for the length of this list!)

    Allow Multiple Accounts
    amr users
    amr users plus itthinxgroups
    bbp Private Forums Visibility
    bbPress
    Broken Link Checker
    Calendar
    Capability Manager Enhanced
    Clean Options
    Contact Form 7
    Cookie Law Info
    Custom Facebook Feed
    Display Last Post(s)
    Email Users
    Embed Iframe
    Expire Users
    GD bbPress Attachments
    Google Docs Shortcode
    Groups
    Hide User Profile Fields
    If Menu
    Import Users from CSV
    Improved User Search in Backend
    Links in Captions
    MaxButtons
    MD5 Password Hashes
    Officers Directory
    Onclick Popup
    Social Media Widget
    TablePress
    User Role Editor
    User Switching
    W4 Post List
    Widget Logic
    Widgets on Pages
    Wordfence Security
    WordPress Access Control
    WordPress Database Backup
    WP-DownloadManager
    WP-Members
    WP-Optimize
    WP-Print
    WPDBSpringClean
    WP Mobile Edition

    If I may add my voice to this thread, I’m getting the same first warning, but not the second.

    Warning: mysql_real_escape_string() expects parameter 1
    to be string, object given in /wp-includes/wp-db.php on
    line 1036

    However, I’m seeing this on the front end and not in the admin. I’m using Gravity Forms and their User Registration Add-on. When the registration form is submitted, the warning is displayed but the user is still registered.

    Something to note though, I think AMA’s count_multiple_accounts function is being called twice during this process, once without the user ID, and the second time with the new user ID.

    I came to that conclusion two ways:

    1. I’m receiving two New User Registration emails from WordPress with the same info in each email, for each registration.

    2. I modified the code in that function to echo the $sql variable, and it prints out the SQL string without the ” AND ID != %d”, and then with it, all in one line.

    When I comment out the line in that function that includes $wpdb->prepare, the warning doesn’t appear.

    Don’t know if that will help. I worked on the AMA code for a while last night trying to solve this, but I need to move ahead with some other aspects of this project now.

    And Scott, thanks for the helpful plugin!

    In my previous comment I wrote:

    When I comment out the line in that function that includes $wpdb->prepare, the warning doesn’t appear.

    I should have added that if I comment that line and add another with the count hard-coded, such as

    $count = 10;

    then the warning is not displayed, but I still receive two emails.

    Additionally, when I deactivate AMA (and register with a unique email address), there is no warning and I only receive one email.

    Plugin Author Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    @michael-walker : Thanks for the feedback! I’ve just released v3.0.1 which should eliminate the first error (the display of which likely being the cause for the second error). Let me know if you’re still experiencing any problems.

    v3.0.1 fixed the warning for me. Still getting two New User Registration emails but I can live with that.

    Thanks for the update!

    Plugin Author Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    @bhwebworks : Thanks for chiming in and providing helpful debugging info! You definitely pinpointed the problem area. Turns out I omitted some code at the start of count_multiple_accounts() to normalize the $user_id arg to an integer in situations where a user object is passed in.

    The fix was pushed out in v3.0.1 and should eliminate the warning you and michael were experiencing.

    I’m not sure yet what could be triggering two emails on registration. It’s possible it’s related to the issue I fixed (in conjunction with another plugin). Let me know if you still experience the double emails with this new version and I’lll investigate further.

    Thanks again!

    Plugin Author Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    Just beat my reply, John 🙂

    It’s seems very possible it’s an interaction between AMA and the Gravity Forms User Registration Addon you mentioned using. I assume it’s a commercial addon so I can’t see what it does.

    Something to test, if you can: Using the built-in WP user registration form, do 2 emails get sent? If so, if you deactivate the Gravity Forms addon and use WP’s user registration, do 2 emails get sent still?

    Scott,

    I didn’t even think about $user_id being the object that was causing the warning. I figured it was somehow $email since the warning stated that parameter 1 needed to be a string.

    No, only one email gets sent when using the WP Add New User form in the admin. That’s the form you were referring to, correct?

    Okay, I just deactivated AMA and then registered with Gravity Forms User Registration Add-on. Still received two emails, so I’m going to assume that issue has nothing to do with your plugin.

    I think we’re good then!

    Plugin Author Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    John,

    Thanks for checking into things and verifying that all looks fine with the plugin now.

    The form I was referring to was the front-end user registration form, e.g. /wp-login.php?action=register. I assume the Gravity Forms User Reg add-on is a front-end replacement of that.

    Is it possible you are intentionally getting two emails from the add-on (maybe 1 as the user, 1 as admin, or 1 to every admin (and you happen to have multiple admin accounts with same email))?

    Or maybe the add-on is emailing everyone with that email address. You said earlier if you registered with a unique email address (w/ AMA deactivated) you got one email, and this time (also w/ AMA deactivated) you got two. Could you be getting a registration email for each number of times that email address is being used?

    Forgot about that default form!

    No, this site is a unique set-up where the client wanted to allow users to register who (supposedly) don’t have email addresses, so I did some custom coding that assigns a default email address to anyone who checks that option on the registration form. So there’s only one email address that’s allowed to be used for multiple users. And it’s an email address that doesn’t actually exist.

    But your questions reminded me that I’m also running Theme My Login, and there’s a setting in that plugin to disable the admin notification email for new users. I selected that option, thinking that TML and GF User Registration were BOTH sending the email, and that solved the problem.

    Thanks for the nudge in the right direction!

    Thread Starter michael walker

    (@michael-walker)

    Folks,

    Many thanks to both of you for your work on this. The upgrade has fixed my problem.

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Error with ver 3.0 and WP 4.1.1’ is closed to new replies.