I understand there was a lot of discussion about if the email address should be a required field.

For our use cases we always want to collect an email address. While it is great to "not" have the field required is it possible to "make" the field required?

This is only issue when say an Administrative Assistant is selecting "other person". That email field is not marked as required. I assumed I could just change his in the field settings of the registration type. But it is not the case.

Comments

chipway’s picture

+1

jpontani’s picture

The field is already currently required, it just doesn't show up with an asterisk to make it look required.

If you're registering a logged in user as "Myself", then it just associates the registration with the user's account, which has an email. Same for registering "another account", it associates it to another user's Drupal account. For anonymous registrants, however, the email field becomes a necessity as there is no way to distinguish registrations between anonymous users.

levelos’s picture

Status: Active » Closed (works as designed)

Thanks for chiming and clarifying @jpontani.

kclarkson’s picture

Status: Closed (works as designed) » Active

@jpontani

So is it possible to give the email filed an asterisk for selecting "other person" ? It nice to have things uniform.

jpontani’s picture

You could do a hook_form_alter on the form to set the anon_email field as being required. Just know that by doing so the email is required in all cases. So if the user tries to register as "Myself", the email field won't show but will be required for the form to validate.

kclarkson’s picture

Let me try to clarify what I am saying.

Currently when an authenticated user registers "other person" (people who do not have a user account) the email field is "not" required.

So in this case we cannot communicate with the actual person who is going to attend the conference if the email field for the participant is not entered.

For most large scale conferences (including drupalcon's and drupalcamps) an administrative assistant is registering/paying for multiple people and is not the individual who needs to receive important communications about the conference.

With this said it would be very helpful if there was an option that allowed us to check a box that says "require email address". If a registered user registers "myself" or "other account" the form should validate because the user profile requires an email address.

This feature would then satisfy both circumstances where maybe a parent is registering a child with no email address, or an administrative assistant who is going to register multiple people with email addresses.

Unfortunately I am not a programmer but am looking at this from a person who organizes various educational conferences.

jpontani’s picture

When registering other email addresses (non user accounts), the email address actually IS required, it just simply doesn't look like it is because there is no asterisk next to it. But in reality, if you try to continue without entering an email or entering an invalid email, it will throw an error saying the email is invalid.

The following code forces a valid email address for an anonymous (no user account) registrant.

    case REGISTRATION_REGISTRANT_TYPE_ANON:
      if (!valid_email_address($form_state['values']['anon_mail'])) {
        form_set_error('anon_mail', t('The email address is invalid.'));
      }
      if (registration_is_registered($registration, $form_state['values']['anon_mail'])) {
        form_set_error('anon_mail', t('%mail is already registered for this event.',
          array('%mail' => $form_state['values']['anon_mail'])));
      }
      break;

In regards to registering non-emailed people (ie: children), there is still discussion being had on how to best handle that.

lsolesen’s picture

I cannot find the ongoing discussion on how to handle children, though #1473008: Adding user uid and making email optional started out as a discussion regarding that.

choicelildice’s picture

Category: bug » feature
StatusFileSize
new1.88 KB

I wasn't sure where to put this patch, I can create a new issue if this is the wrong one...

I created a patch for commerce_registration which checks the '#required' state before validating the email fields. This allows a developer to simply set the fields to not be required, and you end up with registrations that do not have an email. This obviously creates problems for entity registrations when mass emailing or sending out reminder emails for an event. So, I have created another patch here that simply checks for a blank email field before firing off the emails. This way, it only emails the registrants who have entered an email. I am hoping these patches are a start on an answer for whether emails should be required or not. This way it can be left up to the developer/client.

Let me know if there are issues with this patch, and thanks for the great module.

tmsimont’s picture

Title: How to make email address required ? » Make the email address requirement optional
tmsimont’s picture

Status: Active » Needs review
tmsimont’s picture

related is choicelildice's other issue: #1826518: Check whether the email field is required before running it through the validation checks.

I think choicelildice's patches are a good foundation for this feature request, but it only provides a backdoor for a developer to manage. In order to address kclarkson's use case, there would have to be a UI to control a setting for the #required attribute on the email field.

choicelildice’s picture

Component: Registration Core » Registration Entity Access
StatusFileSize
new6.96 KB

Found another couple of areas where not having the email address on the registration entity causes issues. The one that I am most concerned about changing is an access check on line 301 in registration.entity.inc. The current module code (before this patch) checks if the anonymous email field has been filled before deeming the registration as anonymous and allowing access. I removed the check for the email address, as I don't see any immediate security implications. The module still goes through all the normal access checks. Please let me know if anyone else sees an issue here.

tstermitz’s picture

I guess this hasn't been fixed for the big, 7.1.0 release of Jan 2013? I have to type in a fake email when I select "Register for Other Person".

(Speaking of which, please shorten the 'who_is_registering' phrase to "Registration For", or make it configurable. It is way to long for a pretty form.)

The Entity Registrations module presently fails for my use case because I often have one person signing up for two people, where the second person sometimes doesn't have an email (no matter how much I might wish they did!). As pointed out repeatedly, sometimes a parent signs up a kid without an email. I can see the case for requiring the master email to be required, but the email must be optional for secondary registrants.

Despite all this discussion, I can't tell if the problem is about data structure, unique id, or some other interaction.

rerooting’s picture

Patch in #13 fails against current 1.1 am I missing something? The files seem to have been reorganized...

levelos’s picture

Status: Needs review » Closed (works as designed)

This thread, and the patch in #13, are deviating and address multiple issues. Email address is required, that has not changed nor has the patch addressed that systematically in the module. The original issue, the asterik not appearing, is due the business logic behind determining when an email is required. It works as designed.

alan d.’s picture

Mm... Commerce Registration Integration is disabling the #required field :(

alejcerro’s picture

@jpontani is incorrect. The module does not make the email field be required as evidenced by the simple fact that one is able to get past the registration screen without inputting the email field.

The issue that @Alan D references has a patch that actually makes the field required and should be incorporated into the module itself.