In registration.entity.inc in the public function registrant_type($account) it is documented that the function would return on of three states:

* Determine registrant type relative to a given account
*
* @param $account
* A Drupal user
*
* @return string
* Can be me, user, or anon.

If $account however is empty nothing is returned. Imho it should return return REGISTRATION_REGISTRANT_TYPE_ANON because that is what registration_form in registration.forms.inc expects (line#29 elseif (count($who_options) == 1)) and what commerce_registration tries to bypass in #1879108: Capture attendee's username and email in the registration

Comments

drumm’s picture

Agreed that registrant_type() should always return something valid.

I don't know enough about the structure to say if REGISTRATION_REGISTRANT_TYPE_ANON is the correct thing to return. For us, the user won't have access to do that, but that might be mitigated by fixing up commerce_registration to make sure the registration entity is properly populated.

If the behavior is indeed intended for some reason, the documentation should be updated so we know when to expect NULL.

levelos’s picture

Status: Active » Fixed

I don't believe we should return REGISTRATION_REGISTRANT_TYPE_ANON as a default. I can't think of a use case where account is empty AND there's no anon_email set. Default return set to NULL and header updated.

Status: Fixed » Closed (fixed)

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

  • levelos committed 9e5cbe9 on 7.x-1.x, panels, any-entity, slots, integrations, hold_state
    #1892512: registrant_type does not return value.