Support » Fixing WordPress » Can’t change the role of users

  • estoespersonal

    (@estoespersonal)


    Hi, I’m moved recently my WP application to a new server (called newS) and I want to keep my old server as a backup server (lets call it backup1S)with the same appearance as the new one (newS). I uploaded all the information from the databases from (newS) to (backup1S) except the table wp_usermeta which is giving me a lot of trouble.
    Every time I try to change the role of one of my users (which are loaded in the table wp_users) is giving me the following error on the log:

    WordPress database error Subquery returns more than 1 row for query UPDATE wp_usermeta SET meta_value = ‘a:1:{s:12:\”customrole1\”;b:1;}’ WHERE user_id = 763 AND meta_key = ‘wp_capabilities’ made by edit_user, wp_update_user, wp_insert_user, WP_User->set_role, update_user_meta, update_metadata

    My question is simple, what I’m doing wrong?

    The funny thing is that if I create a new user (from the admin dashboard) with exactly the same information it’s allowing me to create it perfectly. Makes no sense to me that my database is failing with this error because there is only one register in the table with the query :

    Select * from wp_usermeta WHERE user_id = 763 AND meta_key = ‘wp_capabilities’

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Steven Stern

    (@sterndata)

    Support Team Volunteer

    Because you moved wp_users without also moving wp_usermeta, the foreign key fields that link the two tables are messed up.

    From the old site, export (via PHPMYADMIN) wp_users and wp_usermeta and import them (again, via PHPMYADMIN) into the new site’s databae.

    estoespersonal

    (@estoespersonal)

    Hi Steven

    In fact I moved first the wp_users without any trouble and after that I’ve tried to copy also the table wp_usersmeta. The “walkaround” that I used is to drop the wp_usermeta table and create ir again with all the indexes properties, etc. But I won’t say that this is a real solution to this problem. I would be glad if someone explain me what can it be.

    Moderator Steven Stern

    (@sterndata)

    Support Team Volunteer

    Your solution will not work. The two tables are closely tied together via foreign key relationships. Did you try what I suggested?

    Hi Steven

    Yes, In fact what I’ve did is move first my wp_users table with all the registers in it without dropping the table. The second thing was to copy all the registers from wp_usermeta. But when I’ve tried to change the role of the user (ex: userProcess1) I’ve got an error in the log like the one shown above:

    WordPress database error Subquery returns more than 1 row for query UPDATE wp_usermeta SET meta_value = ‘a:1:{s:12:\”customrole1\”;b:1;}’ WHERE user_id = 763 AND meta_key = ‘wp_capabilities’ made by edit_user, wp_update_user, wp_insert_user, WP_User->set_role, update_user_meta, update_metadata

    Do you think it has something to do with the indexes?

    Moderator Steven Stern

    (@sterndata)

    Support Team Volunteer

    Restore the PAIR of tables from a backup.

    Hi Steven

    I understand that you mean dropping the existing tables in the backup server(backup1S) and creating them again with the tables of my new server (newS), is it true?

    But I’m little worried that if I do that I can lose information of my backupserver (like the admin account) and I could never login as an administrator anymore. Should I be worried about this?

    Thanks in advice.

    Moderator Steven Stern

    (@sterndata)

    Support Team Volunteer

    This article lists 7 completely different ways to reset your password. Any one of them will work and do the job. Find the one that’s right for you and use that: https://codex.wordpress.org/Resetting_Your_Password

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.