Processing profiles during user registration ignores e-mail address
When using a profile on the user registration form for mailing list subscription, the newly registered user/contact should then be going through the usual double-opt-in process. This is not happening.
The following code in CRM_Profile_Form::buildQuickForm()
(line 747) causes this side effect:
// since the CMS manages the email field, suppress the email display if in
// register mode which occur within the CMS form
if ($this->_mode == self::MODE_REGISTER && substr($name, 0, 5) == 'email') {
unset($this->_fields[$name]);
continue;
}
This removes any e-mail field from a profile when used on the user registration form (as the CMS already collects an e-mail address). That's fine. However, nothing takes care of passing the submitted e-mail address back into the profile processing cycle, which causes group memberships being registered as "Added (by admin)", which (as far as we recognized) does not trigger the double-opt-in process for this contact.
Within CRM_Profile_Form::postProcess()
(lines starting 1156 and 1202), the profile submission is being excluded from double opt-in functionality because of the missing e-mail address.