× Here you can get community support related to Auto Group.

Auto assign user to group by email extension

  • mattie44
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 5 months ago #3268 by mattie44
Hi there, I want to auto assign all "@gmail.com" users to a specific group called email. I can auto assign a user based on their full email entered in the email field but I cant seem to auto assign a user based specifically on their email extension i.e. "@gmail.com" to a group. Is this possible?

Please Log in or Create an account to join the conversation.

More
9 years 5 months ago - 9 years 5 months ago #3273 by admin
Hi,
at the moment the plugin compares the field value with the list of specified values, the partial match is not supported. You should modify a little the php code to get this.

In the function checkFieldValues change the lines:
$key = array_search($current_value, $required_list);
if ($key !== false)

With:
$key = array_filter($required_list, function($el) use ($current_value) {
    return ( strpos($current_value, $el) !== false );
});
if (count($key) > 0)

Not tested but should work...

Kind regards,
Luigi
Last edit: 9 years 5 months ago by admin.
The following user(s) said Thank You: mattie44

Please Log in or Create an account to join the conversation.

  • mattie44
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 5 months ago #3275 by mattie44
Replied by mattie44 on topic Auto assign user to group by email extension
Okay I replaced the code. Still no luck , not sure how to set my parameters in the auto group plug for the email field? This is what they look like " email;@gmail.com;email;true " using the full email address works but i just want the email domain to be captured and autogrouped!

Please Log in or Create an account to join the conversation.

  • mattie44
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 5 months ago #3276 by mattie44
Replied by mattie44 on topic Auto assign user to group by email extension
Okay sorry my apologies its working perfectly, thank you so much =)

Please Log in or Create an account to join the conversation.

More
9 years 5 months ago #3280 by admin
Great!!!

U're welcome.

Please Log in or Create an account to join the conversation.

Time to create page: 0.109 seconds