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.
Options

Is it possible to change/switch user IDs?

Is it possible to change user IDs?
I'm the admin, and I have ID number 2: can I switch it with the user that have ID number 1?
How can I obtain this?

Comments

  • Options
    lifeisfoolifeisfoo Zombie plugins finder ✭✭✭

    Start searching in the db who has the ID = 1. Why not rename that user to admin and give to it admin permissions? Actual admin user will be renamed as user2... A swap!

    There was an error rendering this rich post.

  • Options
    hgtonighthgtonight ∞ · New MVP

    One interesting thing to understand is that UserID 1 (that is the user with UserID equal to 1) will always have all permissions regardless of role or permissions set on that user.

    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.

  • Options
    ToddTodd Chief Product Officer Vanilla Staff

    That's not exactly true @hgtonight. There is a column in GDN_User called Admin which determines this. So if you want to give super admin rights to a different user then just update the value of this column for that user.

  • Options
    hgtonighthgtonight ∞ · New MVP

    Thanks for the clarification @Todd. I got this information from the user model function SaveAdminUser($FormPostValues) which forces the user id to 1.

    My mistake :D

    It is my understanding that there is no "user friendly" way to add super admins, is that correct?

    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.

  • Options

    Thanks for the reply but my problem is different.
    Many years ago I installed phpBB2 withe the default admin ads user 1.
    Then I created the user candyman (with admin permissions) and deleted the user admin.
    All the post, pm, and so on... by candyman are pointing to user ID 2.
    My question is this: is it possible to assign to the user candyman the iD 1 with all threads and posts referring to the number 1 (instead of 2, the original one)?

  • Options
    peregrineperegrine MVP
    edited June 2013

    My question is this: is it possible to assign to the user candyman the iD 1 with all threads and posts referring to the number 1 (instead of 2, the original one)?

    Yes, but is it worth it.

    Make sure you have a user candyman2 with an id of 1.
    set this as Todd says:
    
    
    @Todd said:
    

    That's not exactly true hgtonight. There is a column in GDN_User called Admin which determines this. So if you want to give super admin rights to a different user then just update the value of this column for that user.

    set the userrole table  userid 1 to the admin role.
    
    then Go through <b>every</b> table and <b>every</b> column (that has a "userid").
    
        e.g.  in comment  table
    
        InsertUserID    UpdateUserID    DeleteUserID
    
    
    
        UPDATE "the table SET `InsertUserID` = '1' WHERE `InsertUserID` = '2'
        UPDATE "the table SET `UpdateUserID` = '1' WHERE `UpdateUserID` = '2'
        UPDATE "the table SET `DeleteUserID` = '1' WHERE `DeleteUserID` = '2'
    
    
        e.g. in conversation table
        InsertUserID        UpdateUserID
    
        UPDATE "the table SET `InsertUserID` = '1' WHERE `InsertUserID` = '2'
        UPDATE "the table SET `UpdateUserID` = '1' WHERE `UpdateUserID` = '2'
    
        e.g. in activity table
        ActivityUserID  RegardingUserID InsertUserID
    
        and so on...
    
        You need to get all columns in all tables (or you will be in a bit of trouble.)
    
        then after you are done.  
        rename userid ??  for candyman to oldcandyman.
        rename user id 1 from candyman2 to candyman
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    candymancandyman ✭✭
    edited June 2013

    Wow, thank you very much!

    @peregrine said:
    You need to get all columns in all tables (or you will be in a bit of trouble.)

    I guess I need a backup, first...

Sign In or Register to comment.