Communication preferences: A record already exists with the same information
Created by: chriscant
I'm trying out the GDPR extension on a new WordPress site particularly for mailing lists. I think that this issue only started after I upgraded CiviCRM to 5.9.1 but I can't be certain.
If a user has a {CommunicationPreferences.comm_pref_supporter_link} link then the Comms Preferences are displayed fine (not logged in). However on submit, an error "A record already exists with the same information" is displayed. This is coming from CRM_Profile_Form->formRule(). The problem seems to be that the $exceptions array does not have the userID of the user being update, as $form->_session->get('userID') is not set. I can fix it (unsatisfactorily) in CRM_Gdpr_Form_UpdatePreference->buildQuickForm() using:
if( !$userID && !empty($this->_cid)){
$this->_session->set('userID',$this->_cid);
}
Does anyone else see this? Is there a better fix?
I also want to use the form with cid or checksum to sign up new people. This does work, but the same error shows for an existing duplicate, which isn't very friendly.
(And I'd also like "activated mails" sent when a user subscribes to a group through this form.)
Can I help improve these items?