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.

The default role has not been configured. Error on new user registration.

Hi all, I've found a few of these errors while searching but a lot of the threads are 8~ years old. I am not sure what I am doing wrong here. I setup recapatcha v2. It's working. I had to recently change my .htaccess file (self hosted on Apache. I am getting the following error when new users are trying to register.



Any idea what the fix it? I've tried making changes to /roles/defaultroles/ and it doesnt seem to do anything.


The default role has not been configured.
## /home/idhell/public_html/applications/dashboard/models/class.usermodel.php(3066)
#0 /home/idhell/public_html/applications/dashboard/models/class.usermodel.php(1996): UserModel->insertForBasic(Array, true, Array)
#1 /home/idhell/public_html/applications/dashboard/controllers/class.entrycontroller.php(1567): UserModel->register(Array)
#2 /home/idhell/public_html/applications/dashboard/controllers/class.entrycontroller.php(1431): EntryController->registerBasic('')
#3 /home/idhell/public_html/library/core/class.dispatcher.php(862): EntryController->register('')
#4 /home/idhell/public_html/library/core/class.dispatcher.php(279): Gdn_Dispatcher->dispatchController(Object(Gdn_Request), Array)
#5 /home/idhell/public_html/index.php(29): Gdn_Dispatcher->dispatch()
#6 {main}


Comments

  • charrondevcharrondev Developer Lead (PHP, JS) Montreal Vanilla Staff
    edited May 2019

    Maybe this comes from a bad DB update from an older version, or just misconfiguration, but you should makes sure that you have all of the default roles configured.

    Eg. You should have at least member and applicant assigned to a role. This is because these are the roles that Vanilla will try to assign to a user when they register/attempt to register. You should have one role for each of the defaults (and it comes that way be default in the latest version of Vanilla).

  • Thank you for the reply.


    I added

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


    To the config and it works? I'm confused as to why this wasn't in the config already?

  • charrondevcharrondev Developer Lead (PHP, JS) Montreal Vanilla Staff

    @Lofty I don't have that in any of my configurations, and I see it any of our production configurations.

    It looks like this is actually due to some legacy role mapping that I am unfamiliar with.

    // Fix old default roles that were stored in the config and user-role table.
    if ($RoleTableExists && $UserRoleExists && $RoleTypeExists) {
        $types = $RoleModel->getAllDefaultRoles();
    
        // Mapping of legacy config keys to new role types.
        $legacyRoleConfig = [
            'Garden.Registration.ApplicantRoleID' => RoleModel::TYPE_APPLICANT,
            'Garden.Registration.ConfirmEmailRole' => RoleModel::TYPE_UNCONFIRMED,
            'Garden.Registration.DefaultRoles' => RoleModel::TYPE_MEMBER
        ];
     could you should any additional context here?
    

    @R_J It looks like you've got a couple commits around there. Did you run into a similar issue in the past? (Looks to about 3 years ago, the environment seems to say the release version was 2.2.112.3).

  • Weird, I may just try upgrading to the latest version... this is the only way I could get it to work.

  • R_JR_J Ex-Fanboy Munich Admin

    Could it be that you are on PHP 7.0? That was a very common symptom for which I never searched for a cause...

  • charrondevcharrondev Developer Lead (PHP, JS) Montreal Vanilla Staff

    I was assuming you were on the latest released version (2.8). This is the 2.8 help category. If you are not on 2.8.3 you should upgrade ASAP as there are various important security patches from in each of version 2.5, 2.6, and 2.8.

  • can you tell me how to update it

Sign In or Register to comment.