While trying out the module I found out that all the roles I've created were being shown in the registration page.

To fix the problem this is what I did:

I replaced the following code
if (!in_array($k, $user_roles)) {
unset($roles[$k]);
}

with

//Check to see if the configured user role is in the system
foreach ($roles as $k => $r) {
$inArray = false;

foreach($user_roles as $key) {
if($user_roles[$key]==$k) {
$inArray = true;
}

}

//if the role is not configured to be displayed then
//remove it from the roles array
if(!$inArray)
unset($roles[$k]);
}

Comments

cyberswat’s picture

Have you tried the dev version?

amitpatel049’s picture

thanks man ....
i was facing same problem....
it should be updated in next version otherwise there is no meaning of
giving admin to choose which user role to display on signups...

ShadowAngel’s picture

Nope, haven't tried the dev version yet. . . I was under the assumption that it was better to use the beta rather than the dev versions =P

Will try to use the dev versions next time I encounter problems of a module, Thanks =)

cyberswat’s picture

It's hit or miss ... we've been working on the dev version quite a bit and have a lot of bug fixes in place. There will be a new beta or release candidate coming very soon but as of now, the best version is likely the dev version.

ck9’s picture

There needs to be double, triple, quadruple checks to make sure this doesn't happen. I near about had a heart attack when I realised the users were being presented with the option to sign up as 'SuperUser' although only 'employee' and 'employer' was allowed.

cyberswat’s picture

Status: Patch (to be ported) » Needs work

@ck9 care to write the simpletests?

ck9’s picture

cyberswat, I installed the latest dev version and so far so good. Very happy with the register by path feature too and seems the bug was fixed. The earlier comment was in reference to 6.x-1.0-beta3.

cyberswat’s picture

Status: Needs work » Fixed

ok ... marking this as fixed for now ... re-open if necessary.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.