Selecting a group during user registration is not working

I am experiencing an issue with user registration forms where a user is able to select a group during the registration process.

I have the “Group Memberships for Form Submissions” enabled and the dropdown in the form selected. There is a user registration feed and user activation is disabled. All the dropdown values exactly match group names. Can you help?


Comments

7 responses to “Selecting a group during user registration is not working”

  1. George Avatar

    Hey Jenny,

    The plugin update has been released and in the new version, 2.1.0, the issue has been addressed.
    Please check your Dashboard under Plugins and make sure to update to the new version.

    Cheers,
    George

  2. George Avatar

    Hi Jenny,

    FYI, the issue with the new user not being assigned to the selected group has been identified and the necessary update that fixes it, will be released soon.

    Kind regards,
    George

  3. George Avatar

    Thanks for sharing your log with me. I’m already checking the situation on a test setup, trying to figure out what might be wrong.
    Also, in case there are other entries on your log, related to errors or even warnings, you may share them here.

    Cheers

  4. George Avatar

    Hey Jenny,

    Actually this was my mistake, you are absolutely right about it. Even with the first option, the new user registered should be added to the selected group.

    Since the new user is added to your site successfully but not in the expected group, is there anything logged after enabling WP debugging?
    In order to allow logging, you need to have the following entries in your wp-config.php

    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_LOG', true );
    define( 'WP_DEBUG_DISPLAY', false );

    and also enable the respective option for Groups Gravity Forms found under Forms > Groups.

    Kind regards,
    George

    1. Jenny Rae Avatar
      Jenny Rae

      There are some entries in the log. Immediately after form submission I see the Groups_Gravity_Forms_Handler::gform_after_submission:
      [02-May-2024 13:18:05 UTC] Groups_Gravity_Forms_Handler::gform_after_submission
      [02-May-2024 13:18:05 UTC] Groups_Gravity_Forms_Handler::gform_after_submission ----- entry array (
      'id' => '87896',
      'status' => 'active',
      'form_id' => '27',
      'ip' => 'ip removed',
      'source_url' => 'url removed',
      'currency' => 'USD',
      'post_id' => NULL,
      'date_created' => '2024-05-02 13:18:05',
      'date_updated' => '2024-05-02 13:18:05',
      'is_starred' => 0,
      'is_read' => 0,
      'user_agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36',
      'payment_status' => NULL,
      'payment_date' => NULL,
      'payment_amount' => NULL,
      'payment_method' => '',
      'transaction_id' => NULL,
      'is_fulfilled' => NULL,
      'created_by' => '',
      'transaction_type' => NULL,
      '2.2' => '',
      '2.3' => 'Cory',
      '2.4' => '',
      '2.6' => 'Test',
      '2.8' => '',
      1 => 'email removed',
      4 => 'group removed',
      )....

      The registration then gets queued up, appears the user registration now uses the async functionality: GFFeedAddOn::maybe_process_feed(): Checking for feeds to process for entry #87896 for gravityformsuserregistration.

      When the cron task finally runs, the feed is processed:

      DEBUG --> GF_User_Registration::process_feed(): form #27 - starting process_feed().
      2024-05-02 6:45:09.181747 - DEBUG --> GF_User_Registration::process_feed(): Calling create_user().
      2024-05-02 6:45:09.181818 - DEBUG --> GF_User_Registration::create_user(): Start with form id: 27;

      And then the following:

      [02-May-2024 13:45:13 UTC] Groups_Gravity_Forms_Handler::gform_user_registered
      [02-May-2024 13:45:13 UTC] Groups_Gravity_Forms_Handler::gform_user_registered ----- user_id 178099
      [02-May-2024 13:45:13 UTC] Groups_Gravity_Forms_Handler::gform_user_registered ----- config array (
      'id' => '48',
      'form_id' => '27',
      'is_active' => '1',
      'feed_order' => '0',
      'meta' =>
      array (
      'feedName' => 'feed name removed',
      'feedType' => 'create',
      'username' => '1',
      'first_name' => '2.3',
      'last_name' => '2.6',
      'nickname' => '',
      'displayname' => 'firstlast',
      'email' => '1',
      'password' => 'email_link',
      'role' => 'subscriber',
      'userMeta' =>
      array (
      0 =>
      array (
      'key' => '',
      'value' => '',
      'custom_key' => '',
      ),
      ),
      'sendEmailEnable' => '1',
      'sendEmailValue' => 'default',
      'userActivationEnable' => '0',
      'feed_condition_conditional_logic_object' =>
      array (
      'conditionalLogic' =>
      array (
      'actionType' => 'show',
      'logicType' => 'any',
      'rules' =>
      array (
      0 =>
      array (
      'fieldId' => '1',
      'operator' => 'ends_with',
      'value' => 'email removed',
      ),
      ),
      ),
      ),
      'feed_condition_conditional_logic' => '1',
      'autoLogin' => '0',
      'sendEmail' => '',
      'userActivation' => '',
      'registrationCondition' => '',
      ),
      'addon_slug' => 'gravityformsuserregistration',
      'event_type' => NULL,
      )
      [02-May-2024 13:45:13 UTC] Groups_Gravity_Forms_Handler::gform_user_registered ----- lead array (
      'id' => '87896',
      'form_id' => '27',
      'post_id' => NULL,
      'date_created' => '2024-05-02 13:18:05',
      'date_updated' => '2024-05-02 13:18:05',
      'is_starred' => '0',
      'is_read' => '0',
      'ip' => 'ip removed',
      'source_url' => 'url removed',
      'user_agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36',
      'currency' => 'USD',
      'payment_status' => NULL,
      'payment_date' => NULL,
      'payment_amount' => NULL,
      'payment_method' => NULL,
      'transaction_id' => NULL,
      'is_fulfilled' => NULL,
      'created_by' => 178099,
      'transaction_type' => NULL,
      'status' => 'active',
      '2.3' => 'Cory',
      '2.6' => 'Test',
      1 => 'email removed',
      4 => 'group removed',
      '2.2' => '',
      '2.4' => '',
      '2.8' => '',
      3 => '',
      )

      So I never see the user activation run, we are sending the user a password via email so the user should be activated automatically, and from the code base it doesn’t seem gform_user_registered takes into consideration the $on_submission_field like gform_after_submission or gform_activate_user functions

  5. Jenny Rae Avatar
    Jenny Rae

    Thanks George,

    I’m a bit confused though as based on the description for the first field, it notes: If new users are allowed to register through this form, the new user is also added to the groups that are chosen here. Otherwise, this has no effect for visitors who are not logged in and submit the form.

    Which would lead me to believe a new user should be able to pick a group, am I reading this wrong?

  6. George Avatar

    Hi Jenny,

    Welcome to our support forum and many thanks for using our restriction tool on your shop.

    As for user-registration forms and groups assignments, you need to enable the second option named Group Memberships for User Registrations where the group to assign new users to, is pre-defined and cannot be selected by the new user about to register.

    On the other hand, the first option that you used, refers to already registered and logged-in users who can choose the group to be assigned when submitting a form.

    This is probably the reason why your users weren’t assigned to a group after registration.

    Kind regards,
    George

Share