Skip to Content Skip to Menu

Assign to user group by two different date values?

11 years 11 months ago #215707 by tobiasknabe
Hi all,
I am using CB quite a long time now and the very first time I am about to drive crazy. I am working on some kind of service app for a client who likes to send a birthday card designed mail to each of his employes based on a zodiac value.
Since each zodiac is "assigned" to 2 date values (starting at -> ending at), I tried using Auto Actions for this, using a date value for e.g. virgin start and virgin end. my birthday field was configured like

Type = Usergroup
Triggers = onAfterUserRegistration,onAfterUserUpdate
User = Automatic
Access = Everybody
Conditional = cb_birthday -> Greater Than or Equal To -> virgin_start
Less Than or Equal To -> virgin_end
Usergroup Action = Add Usergroup -> Virgin

All fields were set as date, start and end default value was set with this dates (2012-08-24 and 2012-09-23)
It was working well, as long I only had this one group - adding a second one, some users were assigned to the one, other ones to both groups, depending on the birthday field value.
I am thinking about it could be because of the year value (2012) - but maybe also because of birthday don't read the month value right.

How would you suggest to handle this issue? Is there some way to set up a date range to be used as single field value?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
11 years 11 months ago #215761 by krileon
You can't compare string date fields, it doesn't translate well to PHP compares. Please try the below conditional to convert them to timestamps. As I understand it's the conditional failing and user isn't getting the usergroup you want them to have, correct?

strtotime([cb_birthday]) Greater Than or Equal To strtotime([virgin_start])


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.

11 years 11 months ago #215796 by tobiasknabe
Krileon, that was working pretty fine (okay, okay, let's say until now - I'll start to setup the whole missing date fields now). So I'd like to thank you for the support.

Anyway there is a second issue, somehow attending the one you've answered:

Since every zodiac is coming with a start and an end value (mostly fitting in a month), I am setting the "default at registration only" field - let's stay with the virgin example: 2012-08-24 (the start) and 2012-09-23 (ending up with virginity :)) - after entering all this values, I am going to set the field "readonly" in the PHP and further I am going to hide all those "div#cbfr_XX" with a short custom CSS to make the list disappear during the registration process, because these values won't be changed anyway.

But back to the issue coming up with 2013 - since a date value is a date a date value like YYYY-MM-DD: do I have ANY chance to strip and remove it from the fields where I don't need it? Actually all of them: virgins, lions, scorpions.... they all are coming back year by year (... as long we expect the Maya Indians failed interpreting the calendar ...)

Would be nice, if you have some easy to go solution for this - like before. Thanks, Tobi

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
11 years 11 months ago #215826 by krileon
You basically want only Month and Day if I understand correctly. In which case no the date field can't do this and you'd need to develop a custom date field to handle only month and day.

If you mean can CB Auto Actions strip it from the comparison, no, but you don't really need to as you're not comparing against the current date and only comparing against 2 static date fields.

I've added a feature ticket to add another conditional format function that'll let you do date formatting to conditionals though.

forge.joomlapolis.com/issues/3797


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.

11 years 11 months ago #215998 by tobiasknabe
How exactly do I use this?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
11 years 11 months ago #216011 by krileon
Use what? There is no month-day comparison feature available. Year is always included.


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