• Resolved beefi1123

    (@beefi1123)


    Hi, I just enabled the plugin and now I’m getting minor error messages right away around the site. They could mean bigger things are broken, but this is just an initial impression. The warning to not enable the plugin on an established site with other plugins didn’t come until AFTER the plugin is activated, so what does that help? I really hope this is easily fixable.

    I don’t even necessarily want to delete the plugin because I still need its functionality, but am not an advanced user and don’t want to break everything now. Please tell me whichever way is the easiest path to un-break things.

    No, there’s no backup. Didn’t expect something this weird to happen.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi!

    When activated, the plugin randomizes the ID for the first admin user, that has ID=1.

    If you are finding errors, you should check the new ID for the first admin user and replace it in all tables with a user_id column. The plugin only does that in the users, usermeta and posts tables. You can check the new ID for the user either in the users table, or in the “dfx_randomuserid_first_user_moved_to” option.

    You can either replace the remaining appearances of user_id=1 in all the other tables, or bring back the original ID for the first admin user by replacing its ID with 1 in tables users, usermeta and posts.

    Thread Starter beefi1123

    (@beefi1123)

    Ok, could you tell me how I can safely do that? For example, is there a way to alter the plugin so that I can reactivate it, changing the admin user id back to 1?

    Things were broken. Even things that did not show errors. It’s not a complete mess right now, but it can easily become one. I highly recommend changing the plugin so that it does not make any major changes upon activation.

    Will this work?:
    https://wordpress.stackexchange.com/questions/181580/how-to-change-wordpress-user-id

    I am just trying to decide which is the least risky way to return things to normal. I wish I didn’t have to do it, but I can’t even see most of the errors.

    Plugin Author David Marín Carre?o

    (@davefx)

    To undo the actions taken by the plugin:

    1. Determine the new ID for the first admin user:

    SELECT option_value FROM wp_options 
    WHERE option_name='dfx_randomuserid_first_user_moved_to';
    

    2. Then, use the following queries to undo the changes, replacing <NEW_ID> with the value obtained in the previous step:

    UPDATE wp_posts SET post_author=1 WHERE post_author=<NEW_ID>;
    UPDATE wp_users SET ID = 1 WHERE ID = <NEW_ID>;
    UPDATE wp_usermeta SET user_id = 1 WHERE user_id = <NEW_ID>;
    

    After this, you’ll be able to keep the plugin installed. The ID for new users will still be randomized.

    Thread Starter beefi1123

    (@beefi1123)

    Ah, thank you very much David.

    For those who see this in the future, I also needed to clone some posts/automations where the author ID had been changed. For example, when the plugin was activated, everything worked, but I saw errors on the posts. So, I changed the author userID to the new ID. Then, things stopped working. When I changed the userID back to 1, I had to clone those posts and automations in order for them to work again, even though they didn’t show any visible errors. Anyway, all is back to normal now.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to Undo What This Plugin Just Changed’ is closed to new replies.