CRM-5905 Adding contact to group via Profile: if CiviMail disabled, contact should be Added without double-optin. If CiviMail enabled, double-optin is used unless disabled in settings file

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.1.3
    • Fix Version/s: 3.2.4
    • Component/s: CiviCRM Profile
    • Labels:
      None

      Description

      1. Current behavior for non-embedded profiles when CiviMail is NOT enabled is incorrect:
      – Contact is added to group w/ Pending status
      – Email is sent with link to confirm (see below)
      – Clicking confirm link gives 'Access Denied'.

      Correct behavior: If CiviMail is NOT enabled, contact should be directly 'Added' to group - no double-optin used regardless of double-optin setting in civicrm.settings.php.

      2. When a profile is embedded in a contribution page (and likely in event registration) with 'Groups" field, AND CiviMail is enabled - we should be doing double-optin (unless it is explicitly disabled in civicrm.settings.php with CIVICRM_PROFILE_DOUBLE_OPTIN = 0). Currently this is not happening:

      http://forum.civicrm.org/index.php/topic,12485.msg53756.html#msg53756

      NOTE: Please test all 4 conditions for profiles embedded in contribution page / event registration page: CiviMail disabled, CiviMail enabled with double-optin setting = 0, Civmail enabled with double-optin setting = 1, Civmail enabled with double-optin setting not present (this should be the same is double-optin = 1 since default behavior is to use double-optin). Please make sure that this also works for each of the additional participants that have been configured w/ such a profile as well.

      =========================
      Detailed commend from Kurund on this:
      defined( 'CIVICRM_PROFILE_DOUBLE_OPTIN' ) is missing in civicrm.settings.php.

      Code in Defaults.php

      //profile double opt-in
      $this->profileDoubleOptIn = defined( 'CIVICRM_PROFILE_DOUBLE_OPTIN' ) ? false : true;

      if it is not defined then profile double opt in enabled, which is incorrect IF CiviMail is not enabled.

      Also in Form.php

      if ( $config->profileDoubleOptIn &&
      CRM_Utils_Array::value( 'group', $this->_fields ) ) {

      Here also CiviMail condition is not handled. So I think we CiviMail is disabled then double opt in disabled and we directly add Contacts to groups.

        Attachments

          Activity

          [CRM-5905] Adding contact to group via Profile: if CiviMail disabled, contact should be Added without double-optin. If CiviMail enabled, double-optin is used unless disabled in settings file
          Rahul Bile added a comment -

          checked in r -26476.

          David Greenberg added a comment -

          Found one other bug in this area.... to recreate

          1. Set Profile -> Advanced Setting -> Add new contacts to a group = a mailing list group
          2. Include a 'required' Email address field in the profile
          3. CiviMail is enabled and define( 'CIVICRM_PROFILE_DOUBLE_OPTIN' , 1 ); in settings

          When new contact submits profile/create form, they get the message about 'confirmation email will be sent' - and indeed a confirmation email is sent (this is correct behavior). HOWEVER, the contact is added to the Group in 'Added' status. This should be 'Pending' status.

          Dave Jenkins added a comment -

          Just upgraded a site from 3.1.3 to 3.1.5 and found that when a user registers for an event where signup page uses a profile that adds user to a group, they now get added with status Pending. CiviMail is enabled. The group is not a mailing group. Is this an unintended consequence of CRM-5905?

          I tried adding this to civicrm.settings.php:
          define( 'CIVICRM_PROFILE_DOUBLE_OPTIN' , 0 );
          as per comment in CRM-4153. This made things worse: the user is now added to the group with status NULL in civicrm_group_contact.

          Dave J

          David Greenberg added a comment -

          Sounds like two issues here based on Dave J's comment...
          1. With CIVICRM_PROFILE_DOUBLE_OPTIN false, the group_contact status should be Added, not NULL.

          2. I don't think we should invoke the double-optin rules for groups where group_type != Mailing. Let me know if you disagree with this.

          Dave Jenkins added a comment -

          In the scenario I described, the user does not get an email inviting them to opt into the group, they just become silently stuck in status Pending.This seems clearly inconsistent: if double opt-in applies to group X then group_contact status -> Pending + email invitation; if not then straight to Added + no email invitation. And I agree with DG above that the double-optin process should only affect mailing groups.

          Kurund Jalmi added a comment -

          Since "Add new contacts to a group" is kind of admin level feature, i think we should directly add contacts to particular group irrespective of mailing type. Thoughts?

          David Greenberg added a comment -

          Kurund - We have two use cases here:
          1. Profile setting = Add new contacts to group
          For this use case, I agree that contact should be added directly irrespective of group type / other configuration settings

          2. Group(s) checkbox field in a profile
          For this use case, behavior s/b dependent on

          • is CiviMail enabled
          • is group type = Mailing or not
          • is CIVICRM_PROFILE_DOUBLE_OPTIN true or false
          Dave Jenkins added a comment -

          Tested on 3.1.6 with following config:

          Event E's registration form uses profile P.
          Profile P has "Add new contacts to a Group?" = group G.
          Group G is not a Mailing List group.
          CiviMail is enabled.

          Results are the same as in 3.1.5:

          (a) CIVICRM_PROFILE_DOUBLE_OPTIN not defined:
          Actual behaviour:
          When participant registers, they are added to group G with status Pending
          Expected behaviour:
          When participant registers, they are added to group G with status Added.

          (b) CIVICRM_PROFILE_DOUBLE_OPTIN = 0
          Actual behaviour:
          When participant registers, they are added to group G with status NULL
          Expected behaviour:
          When participant registers, they are added to group G with status Added.

          Expected behaviour is as described by DG in the previous comment:
          "1. Profile setting = Add new contacts to group
          For this use case, I agree that contact should be added directly irrespective of group type / other configuration settings"

          Dave J

          Dave Jenkins added a comment -

          Replicated the issue described in my last comment on demo, running rev. 29361: created group, profile & event all called "Test CRM-5905". On registering for the event, the demo user's contact was added to group Test CRM-5905 with status Pending.

          This issue is blocking the upgrade of two of our sites from 3.1.3, as we use CiviGroup Role Sync to assign a Drupal role based on the group assigned via profile during event registration.

          Kurund Jalmi added a comment -

          Dave J,

          Can you test with this fix: https://fisheye2.atlassian.com/changelog/CiviCRM/?cs=29498

          Kurund

          Dave Jenkins added a comment -

          Hi Kurund,

          I applied patch 29498 to 3.1.6 & tested as on 26 Aug above. Results:

          (a) CIVICRM_PROFILE_DOUBLE_OPTIN not defined:
          Actual behaviour = Expected behaviour:
          When participant registers, they are added to group G with status Added.

          (b) CIVICRM_PROFILE_DOUBLE_OPTIN = 0
          Actual behaviour = Expected behaviour:
          When participant registers, they are added to group G with status Added.

          Also tested using the profile edit form civicrm/profile/edit?reset=1&id=C&gid=G:
          Actual behaviour = Expected behaviour:
          When profile edit form is submitted, contact is added to group G with status Added.

          Good work, thanks!

          Dave J

          Dave Jenkins added a comment -

          In 3.2.3, testing as above:

          (a) CIVICRM_PROFILE_DOUBLE_OPTIN not defined:
          Actual behaviour:
          When participant registers, they are added to group G with status Removed !?
          Expected behaviour:
          When participant registers, they are added to group G with status Added.

          This is a new version of the problem, haven't had Removed before! Maybe the full fix isn't in 3.2.3 though - it's rev 29586 which therefore I guess includes the merge from 7 Sep above but not the merge on 8 Sep?

          Dave J

          David Greenberg added a comment -

          This needs to be re-verified based on Dave J's latest test results.

          Kurund Jalmi added a comment -

          Dave J,

          I am not able to replicate this issue. Can you provide more details.

          Kurund Jalmi added a comment -

          Dave J,

          Any progress on this ???

          Dave Jenkins added a comment -

          Hi Kurund,

          Sorry for the delay, have been away. This time, I haven't been able to replicate the problem on either demo or a clean 3.2.3 install, but it still occurs on one of our sites on 3.2.3 . I'll do more investigation ASAP.

          Dave J

          Kurund Jalmi added a comment -

          Closing this issue since I am not able to replicate.

            People

            • Assignee:
              Kurund Jalmi
              Reporter:
              David Greenberg

              Dates

              • Created:
                Updated:
                Resolved: