Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

[SOLVED] Change usergroup on Date of birth field plus 18 years

  • jwall101
  • jwall101
  • OFFLINE
  • Posts: 29
  • Thanks: 2
  • Karma: 1
  • Add-ons
10 years 11 months ago - 10 years 11 months ago #237891 by jwall101
Hi.

My apologies if this has already been answered elsewhere. I have seen similar questions based on expiry date and Cron jobs which have got me a bit closer but it's still not working.

I have new users assigned to a junior member group on registration and am trying to use CB Auto Actions to move them to the "Registered" group on their 18th birthday.

Currently I have the triggers as: onAfterLoginForm,onAfterUserRegistration
User: automatic
Access: All registered users
Conditional: strtotime([cb_dateofbirth]) Greater than or equal to strtotime(+6570 DAYS)
Usergroup action: Mode - Remove usergroups, Groups - Junior Member
Usergroup action: Mode - Add usergroups, Groups - Registered

I have debug mode on but I see no signs of anything happening at all.

Any tips or advice as to where I'm going wrong would be greatly appreciated.

Using Joomla! 2.5.16, CB 1.9.1

Thanks in advance.

Jonathan
Last edit: 10 years 11 months ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48475
  • Thanks: 8281
  • Karma: 1443
10 years 11 months ago #237918 by krileon

Currently I have the triggers as: onAfterLoginForm,onAfterUserRegistration

Only onAfterUserRegistration is valid if you want this to actually work after a user registers. onAfterLoginForm should be changed to onAfterLogin.

Access: All registered users

This should be set to Everybody.

Conditional: strtotime([cb_dateofbirth]) Greater than or equal to strtotime(+6570 DAYS)

This will probably be easier to compare against if you set cb_dateofbirth parameter "Display on profiles as:" to "Age in years" and "Display N years text:" to "Display just 'N'". Next use the below conditional.

[cb:userfield field="cb_dateofbirth" /] >= 18

Aside from that you'll just need to debug your action to make sure its access and condition checks function. To do this ensure debug mode is enabled and maximum error reporting is set within Joomla global configuration. Next enable debug within your action and test it on the triggers it's configured to act on.


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.
The following user(s) said Thank You: jwall101

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

  • jwall101
  • jwall101
  • OFFLINE
  • Posts: 29
  • Thanks: 2
  • Karma: 1
  • Add-ons
10 years 11 months ago #237950 by jwall101
Perfect, Kyle. Thank you.
The following user(s) said Thank You: krileon

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

Moderators: beatnantkrileon
Powered by Kunena Forum