Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

[Solved] UserID=1 accidentally deleted. How screwed am I?

edited April 2013 in Vanilla 2.0 - 2.8

I'm running Vanilla from a phpBB import. In doing the import, I realize now that it created an "Anonymous" account for me to log into and set things up before I set roles & permissions.

After I got everything running, I went through the users to clean things up a little, deleting inactive users, old users, blatant spambots, etc. In doing so, I think that UserID=1 account got deleted, thinking it was a nobody.

In reading the documentation for upgrading vanilla, it says I have to log in as my UserID=1 account to run the upgrade utility...which I no longer have.

When I look at my GDN_User table in phpMyAdmin, I see the row for UserID=1 (I'm UserID=2). The name is [deleted user] and the email is [email protected]. The attributes column also has some stuff in it too.

Is it possible to just edit this row in phpMyAdmin to reactivate UserID=1? And if so, is there anything specific I need to enter? Thanks.


  • hgtonighthgtonight ∞ · New Moderator

    That is indeed a pickle.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • x00x00 MVP
    edited April 2013

    You can set the Admin column of any user. note this is different from Administrator role, it is a global admin.

    First do a db dump to backup.

    it would be a good idea to store the field values of user2, delete that user, and copy them to user 1 ensuring you set Admin to 1.

    grep is your friend.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    When I look at my GDN_User table in phpMyAdmin, I see the row for UserID=1 (I'm UserID=2). The name is [deleted user] and the email is [email protected].

    I would try to re enter that info in the table. See if User1 comes back.
    or What you could do is check your config.php to see what is left. Is the email still there? You could possibly change permissions configuration from the config.php to give user 2 admin privileges then log in as user 2 give yourself permissions input the original email .
    Change the permissions scheme to move one number up maybe.

    $Configuration['Garden']['Registration']['AdminRole'] = '2';
    $Configuration['Garden']['Registration']['MemberRole'] = '3';
    $Configuration['Garden']['Registration']['ConfirmEmailRole'] = '4';

    So User 2 has permissions for User 1 and make the rest User 3 and User 4.

    make sure these are correct

    $Configuration['Database']['Name']                             = 'dbname';
    $Configuration['Database']['User']                             = 'dbuser';
    $Configuration['Database']['Password']                         = '';
  • Those seem like 2 pretty different solutions. @vrijvlinder I don't see those lines in my config.php. I see...

    $Configuration['Garden']['Registration']['ConfirmEmail'] = '1';
    $Configuration['Garden']['Registration']['DefaultRoles'] = 'a:1:{i:0;s:4:"4661";}';
    $Configuration['Garden']['Registration']['ApplicantRoleID'] = '4667';
    $Configuration['Garden']['Registration']['Method'] = 'Approval';
    $Configuration['Garden']['Registration']['ConfirmEmailRole'] = '4667';

    I guess I will try to edit that row in phpMyAdmin and see if User1 comes back? I'm worried/wondering what to put in the "Attributes" column. Right now it's "a:1:{s:5:"State";s:7:"Deleted";}". Also, the "Admin" column has a 0 value while the "Deleted" column, has a 1. I'm guessing switch those around...?

  • 422422 Developer MVP

    be handy if someone screenpic user 1 and user 2 rows for you

    There was an error rendering this rich post.

  • Sorry, I can't tell if that's a tip for me or if you're asking to see a screencap, haha.

    I don't mind staying as User2, and having an "Admin" account as User1 that only gets used when it comes to updating, so I guess I'm just wondering if it's possible to "undelete" User1 by editing that row in phpMyAdmin.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited April 2013

    0 value would make a super admin I believe. It has more permissions than 1 , you see Role 1 is always admin the higher the number the less permissions they have. You set that up in the configuration

    $Configuration['Garden']['Registration']['ConfirmEmail'] = '1';

    this means you have confirm email on

    $Configuration['Garden']['Registration']['DefaultRoles'] = 'a:1:{i:0;s:4:"4661";}';

    those are the roles you set up

    this is what is the default try changing it to this

    $Configuration['Garden']['Registration']['DefaultRoles'] = array('8'); // The default role(s) to assign new users (4 is "Member")

    This is my configuration

    $Configuration['Garden']['Registration']['AdminRole'] = '1';
    $Configuration['Garden']['Registration']['MemberRole'] = '2';
    $Configuration['Garden']['Registration']['ConfirmEmailRole'] = '3';
  • please follow my instructions.

    grep is your friend.

  • Sorry, @x00 but I didn't really understand what you were saying, and I wasn't comfortable deleting user2 (me) when I have 8,000+ comments on my forum, but please let me know if I have this right:

    1. Backup my db just in case.
    2. Copy all the fields from the user2 (me) row.
    3. Delete the user2 row.
    4. Take all those copied fields from user2, and edit the user1 row to paste them in field for field, setting the "Admin" column to "1"

    If this is what you're saying, I think I'd be a lot more comfortable just editing User1 to create a generic "Admin" account to be used as a backup Admin/to be used for when it comes time to upgrade Vanilla.

    So I guess my questions is still, before I try, do you think it's ok to simply edit my User1 row in phpMyAdmin to "undelete" that account?

  • changing default role has no impact on this.

    grep is your friend.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    So I guess my questions is still, before I try, do you think it's ok to simply edit my User1 row in phpMyAdmin to "undelete" that account?

    It may not be enough, that is not the only place the data has impact. I suggest you do as x00 directs because he has more experience and really knows his stuff.

  • You should be able to just edit the admin user, emails are supposed to unique, you can leave Attributes blank.

    grep is your friend.

  • Thanks all. I was able to edit the first row in gdn_user for UserID=1, and can now log in as that user. I didn't know the password, so had to reset it using another admin account, and in doing so I had to assign a role to user1 for the password reset to go through. I gave user1 the admin role...don't know if that matters or not. Sounds like when it's time to upgrade the important thing is that I'm logged in as UserID=1 and that's about it.

    Still, there's an "Admin" column in gdn_user and for user1 right now it's 0. Is that ok? Other than the name, e-mail, and attribute columns, the only other column I changed was "Deleted" from 1 to 0.

Sign In or Register to comment.