Change WordPress user roles and capabilities Forums How to or FAQ How to restore user between environments

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #4866
    techsupport
    Participant

    HI All,
    We have to matching environments of Stage and production.
    One of the users were added with custom permissions on the prod server, and now she need the same permissions on the Stage server.

    All the extra permissions were added on her own user and not as a role.

    Can I export all the settings of her user from prod and import it on Stage?
    If so can you advise me how to achieve it?

    Tnx

    #4870
    Vladimir
    Keymaster

    Hi,

    Permissions assigned directly to users are not exported/imported by User Role Editor.
    If it’s a single user it’s much simpler just grant capabilities shown at a production site page to at this user permissions page opened at the stage server.

    If you wish to make it semi-automatically, you will need some SQL tool. Look at this command:

    
    SELECT * FROM wp_usermeta where user_id=NNN and meta_key='wp_capability';
    

    It shows user permissions stored by WordPress for this user at the database.
    NNN – is your user ID.
    ‘wp_’ is database prefix here. So you have to change it at ‘wp_usermeta’ table name and at ‘wp_capability’ value if you have another DB prefix defined at config.php.

    Then you can to copy/paste meta_value field value from the result to the previous command to a new command at the stage database connection:

    
    update wp_usermeta set meta_value='copy/pasted value here' where user_id=NNN;
    
    
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.