Skip to Content Skip to Menu

Using CB conditional on CB last online field

  • startup
  • startup
  • OFFLINE
  • Posts: 113
  • Thanks: 7
  • Karma: 1
  • Add-ons
9 years 7 months ago #261604 by startup
Hello,

I'm trying to show the CB Last Online field (lastvisitdate) to viewers of a profile page only if the user of the pofile they're looking at has been online within the last one month.

I thought the CB Conditional in the Integrations tab of the field would be a good idea. But I am failing at getting the configuration to achieve the desired effect right.

I watched the CB Conditional videos (a few years old) and searched for 'conditional' in the great CB 2.0 Primer book, but don't find the info.

I'd be very grateful if someone can give me a tip on how to hide this field if lastvisitdate is 30 days ago from 'today'.

Thank you very much!

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8282
  • Karma: 1443
9 years 7 months ago #261658 by krileon
Replied by krileon on topic Using CB conditional on CB last online field
That field is stored as SQL formatted datetime (0000-00-00 00:00:00). CB Conditional can't condition it for a timeframe as it's treated like any other string. To have what you're wanting you need to use a CB Query Field and query for the field using SQL then use SQL date format functions to handle the comparison and return 1 or 0 if it's within the last month or not. Then you'd do a Custom > Value condition and substitute in the query field and check if it's equal to 1 or 0 as needed.


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