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.

Users with no roles after import

Hi all.

I've upgraded my old forum to the latest version and it all seems to be working OK except I have lots of uses that have been left with no user role. I obviously changed something on/after the import and now they don't appear in the GDN_UserRole table.

No GDN_UserRole, no access :neutral_face:

I can't think of a way to get the users in there as the role isn't referenced from the user GDN_User table? The only way I can think of doing it is to delete all users from the table and re-add them as role 3 (member). Doing this loses my banned members though...

Cheers!
Rob

PS: I've searched for this as I'm sure it must have happened before so apologies if this is a dupe.

Comments

  • hgtonighthgtonight ∞ · New Moderator

    How did you upgrade?

    What version to what version?

    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.

  • peregrineperegrine MVP
    edited May 2014

    in case it helps anyone else reading this discussion.

    As you may or may not realize

    latest version could mean anything. version 2.0.18.11 or 2.1 or something else.

    http://vanillaforums.org/discussion/26710/why-adding-your-version-is-more-important-than-ever#latest

    how to locate your version number info here:

    http://vanillaforums.org/discussion/comment/184012/#Comment_184012


    edited:

    P.S. you should not use the porter plugin for upgrading vanilla version 2.0.x to vanilla version 2.1
    (the only exception when upgrading form vanilla 1.x)

    you should use phpmyadin or mysql.

    backup or export database via phpmyadin or mysql.

    import sql file via via phpmyadin or mysql.

    since porter "may" mung up roles and permissions when porting one vanilla version to another.


    see instructions here for vanilla 2.1 and retry

    http://vanillaforums.org/discussion/26685/vanilla-2-1-stable-released/p1

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

  • Sorry, lame question answering .

    I used the Porter plugin to get from V1 to V2.2.3.4

    The answer is there though ^. I thought that was the whole point of the Porter plugin? - I must have misread.

    Drop this script on your existing site and go to it to export your existing forum data to the Vanilla 2 import format.

    Everything else seems fine just the roles - is it a case of doing it manually at this stage? if I go to admin and edit the user and make them a member it works fine so I just need to automate that process for everyone without a userRole, easy eh? :wink:

    Cheers
    Rob

  • hgtonighthgtonight ∞ · New Moderator

    Ah...

    Vanilla 1 to Vanilla 2.x does require using the porter. Hopefully you have a db backup of your old forum so you can do some testing.

    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.

  • peregrineperegrine MVP
    edited May 2014

    V2.2.3.4??

    where did you find 2.2.3.4? (it is most likely insecure for a live site)

    why did you choose this version?

    use 2.1

    see releases:
    http://vanillaforums.org/discussion/comment/207321/#Comment_207321

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

  • hgtonighthgtonight ∞ · New Moderator

    You can find all the users without a role by running some SQL:

    SELECT `gdn_user`.`UserID` , `gdn_user`.`Banned` , `gdn_user`.`Deleted`
    FROM `gdn_user`
    LEFT JOIN `gdn_userrole` ON `gdn_user`.`UserID` = `gdn_userrole`.`UserID`
    WHERE `gdn_userrole`.`RoleID` IS NULL
    

    Then insert a row into gdn_userrole for each UserID with your member role ID number

    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.

  • LincLinc Detroit Admin
    edited May 2014

    @Rob_Che‌ Are the banned users properly marked with a 1 in the Banned column on the User table?

    If so, you could run this SQL query to populate the GDN_UserRole table with every non-banned member as a 'Member' (assuming the member role has ID 3 as you said above):

     insert into GDN_UserRole (UserID, RoleID) 
          select (u.UserID, 3) from GDN_User u 
               left join GDN_UserRole ur on ur.UserID = u.UserID
               where u.Banned < 1 and ur.RoleID is null
    

    It's been a while since we saw a Vanilla 1 export or an issue with it. If you wanna send me the dump I'll try to pinpoint the issue and correct it. Email is in my profile.

    //edit: cross-posted with @hgtonight, whose query reminded me to join UserRole to make sure they don't already have a role, so I've updated mine :)

  • @peregrine said:
    V2.2.3.4??
    where did you find 2.2.3.4? (it is most likely insecure for a live site)

    I went with 2.2.3.x so I could use the Bootstrap themes... Works well though, no issues so far. I run a pretty basic forum.

    @Linc said:
    It's been a while since we saw a Vanilla 1 export or an issue with it. If you wanna send me the dump I'll try to pinpoint the issue and correct it. Email is in my profile.

    I might just do that is that's OK? 850 entries in the User table but only 180 in the userRole table says I've broked something...

    Cheers for your sql too hgtonight :)

    Cheers all....
    Rob

  • peregrineperegrine MVP
    edited May 2014

    bootstrap works in 2.1.

    you had your warning. (as in Best Practices), but do as you please. and you might be going down a road you may not be able to recover from easily.

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

  • @peregrine said:
    bootstrap works in 2.1.

    you had your warning. (as in Best Practices), but do as you please. and you might be going down a road you may not be able to recover from easily.

    It was a Bootstrap 3 theme I wanted - requires 2.2.x . . . I might look at the latest release to 'downgrade' to. I'm not scared of getting stuck in but I'm not sure I can dedicate the time needed to maintain a bleeding edge version.

    Maybe I stop being so lazy and just build a theme! :)

    Cheers @peregrine‌.

Sign In or Register to comment.