Skip to Content Skip to Menu

Auto action - add user group to users under age 25

  • rbuelund
  • rbuelund
  • ONLINE
  • Posts: 559
  • Thanks: 38
  • Karma: 4
6 months 1 week ago - 5 months 3 weeks ago #335884 by rbuelund
I need to add users who have entered a birthday in a date field, and who's birthday makes them younger than 25, to a certain user group - how would I do that ? How can I test against a date - 25 years ? And also, could I afterwards run this as a batch every day to automatically remove the group when they become older than 25 years ?
Last edit: 5 months 3 weeks ago by rbuelund.

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

  • rbuelund
  • rbuelund
  • ONLINE
  • Posts: 559
  • Thanks: 38
  • Karma: 4
6 months 1 week ago #335889 by rbuelund
Was this possible at all ?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 68613
  • Thanks: 9109
  • Karma: 1434
6 months 1 week ago #335895 by krileon
That's specifically what the Batch feature is for. Lets you run an auto action against a set of users. You'll need to use an Advanced Filter in your batch though as you'll need to use MySQL functions to check the date of whatever field you're using for birthdate.

You'd need 2 batches and 2 auto actions. 1 batch check if they're under the age of 25 and are missing that usergroup. The other checks if they're over the age of 25 and do have that usergroup. 1 auto action adds the usergroup and the other removes it. Now you'd schedule CRON to run the batch URLs using wget on whatever interval you like.

An alternative is you do this at time of login. So when they login it checks their age and adds/removes the usergroup as needed. That's a simpler approach if this is only needed to add or remove access for the user and won't be used for some sort of filtering/searching behavior.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

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

Moderators: beatnantkrileon
Powered by Kunena Forum

Facebook Twitter LinkedIn