I recently installed the Apply for Role module on a client's website and setup two different roles for Users to apply for. However, when navigating to the register form, there are three options. The two that I chose are shown on the bottom, preceded by a blank one. From what I can tell, the blank option is for "authenticated user.' However, when a user applies for the empty role, "Invalid Role" is displayed in the approval section. Is there something I am missing to get rid of this option, or is there a bug somewhere in the module.

Thanks,
BassistJimmyJam

Comments

Soren Jones’s picture

Category: support » bug

It's a bug. Thanks! It looks like I applied the wrong patch a while back. If you want, you can give the dev a try. New release soon.

Soren Jones’s picture

Would you verify that you're using 6.x-1.4. I mean, is this happening with the 1.4 release or in the dev release? Thanks!

Best,
Soren

Soren Jones’s picture

Version: 6.x-1.4 »
Component: User interface » Code
Assigned: Unassigned » Soren Jones
StatusFileSize
new1000 bytes

Patch attached for dev.

BassistJimmyJam’s picture

I am using 6.x-1.4, I just downloaded and installed it yesterday. I will try the development release.

BassistJimmyJam’s picture

I installed the development release and applied the above patch and I am still getting the empty option. It looks like line 203 is putting the blank option in.

$filter_roles[0] = t('');

I commented this line out and it worked perfectly.

Soren Jones’s picture

You were running -dev before because 1.4 doesn't have the text "Invalid role" in it. Only -dev does.

Anyway, commenting out the line removes "blank" -> "apply for no role option" which is actually a feature. ;)

I'll make it an option in the next release. Or if you'd like to submit a patch to make it an option that would be cool, too.

Soren Jones’s picture

Status: Active » Needs review
StatusFileSize
new652 bytes

Anyway, back to the patch. Smaller patch attached.

BassistJimmyJam’s picture

I would love to submit a patch to make this feature an option. I will work on it over the weekend.

Soren Jones’s picture

All right! Thanks! And thanks again for reporting the bug -- that the blank field was being submitted.

BassistJimmyJam’s picture

StatusFileSize
new1.47 KB
new806 bytes

Well, I hope I did the patch right. I'm new to CVS and this is my first patch. I'm also not sure what the correct naming scheme is. I have attached a patch from apply_for_role.admin.inc to add the actual option, and apply_for_role.module to read the option. If any corrections are needed, I would be happy to make them.

Soren Jones’s picture

Status: Needs review » Needs work

Thanks much. First, just to let you know, you can create a single patch for the directory/folder; you don't need to create two separate patches. Are you in a Windows, Linux, or Mac environment? Second, I think there'd be a bigger return in making a role application explicitly mandatory for both single and multiple application options than just removing the apply for none option from the single apply option. And my mistake to add the bit that had the ksort() in it. That was copied and pasted from the old wrong way of adding the blank. Anyway, really -- thanks for the start! If you want to revise it to make role applications optional or mandatory, that'd be sweet, too.

BassistJimmyJam’s picture

StatusFileSize
new2.58 KB

Okay, so I made the changes that you suggested. When I took the ksort out, it put the blank option at the bottom of the select list. I'm not sure how much that matters, but I think it should be at the top so I added the ksort back in. I am in a mixed development environment. I prefer Linux, but I do get stuck on Windows at times. I use Eclipse on both operating systems. I hope this is closer to what you are looking for.

I must say, this has been a great learning experience. I love working with Drupal, both front-end and back, and I have been looking to give back to the community for some time.

BassistJimmyJam’s picture

Status: Needs work » Needs review
Soren Jones’s picture

Status: Needs review » Fixed

BassistJimmyJam,

Fixed in dev. Thanks for getting the ball rolling.

I'm not sure you'll like my solution, but I hope it will work for you.
Rather than add a new field, I added a third option to the register field. So it's now: no, optional, required. Optional and required still show the "blank" (though it's now a "--") as the first option because I don't want users to accidentaly click through without making a conscious selection of the role their applying for.

The next -dev will be out sometime in the next 12 hours.

BassistJimmyJam’s picture

Awesome, thanks a lot. I think that the biggest issue was the fact that it was empty, so this should work out great.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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