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] Hide expired events

  • Astrid
  • Astrid
  • OFFLINE
  • Posts: 183
  • Thanks: 68
  • Karma: 10
10 years 11 months ago - 10 years 10 months ago #237809 by Astrid
[SOLVED] Hide expired events was created by Astrid
Read this topic and managed to show events for groups user belongs to, but having problems with this part to hide expired events.
Code:
$include_exclude[] = array( 'date', '>=', $_CB_framework->now() );
Where does it go exactly?
Last edit: 10 years 10 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 #237833 by krileon
Replied by krileon on topic Hide expired events
It's part of the where array that's sent to the data API. Review the "cbgjEventsData::getEvents" usage within the module where it passes $include_exclude to be parsed and added to the query.


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.

  • Astrid
  • Astrid
  • OFFLINE
  • Posts: 183
  • Thanks: 68
  • Karma: 10
10 years 11 months ago #237898 by Astrid
Replied by Astrid on topic Hide expired events
I'm just not good enough in PHP to solve this. Suppose it has to go in here somewhere:
Code:
} elseif ( $mode == 12 ) { if ( class_exists( 'cbgjEventsData' ) ) { cbgjClass::getTemplate(); $rows = cbgjEventsData::getEvents( array( array( 'grp_usr_active' ), $user ), $include_exclude, null, $display );
But I can't figure out how.

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 #237917 by krileon
Replied by krileon on topic Hide expired events
Can't figure out how to do what? The code snippet you pasted is exactly what you need; see $rows variable. Notice $include_exclude is added. That's the "where" array that's parsed and added to the query. Replace with array( 'date', '>=', $_CB_framework->now() ) for example if you want to query for non-expired events.


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.

  • Astrid
  • Astrid
  • OFFLINE
  • Posts: 183
  • Thanks: 68
  • Karma: 10
10 years 10 months ago #238138 by Astrid
Replied by Astrid on topic Hide expired events
Found a solution (with some help) by adding:
Code:
$today = date("Y-m-d H:i");
And:
Code:
if ($row->getDate() >= $today) { $return .= '<div class="gjIntEvent">' . CBTxt::P( '[user] scheduled [event] in [group] of [category] for [date]', array( '[user]' => $row->getOwnerName( true ), '[event]' => $row->getTitle( 0, true ), '[group]' => $row->getGroup()->getName( 0, true ), '[category]' => $row->getCategory()->getName( 0, true ), '[date]' => $row->getDate() ) )
And:
Code:
$cnteventsdate++; } } if ($cnteventsdate == 0) { $return .= CBTxt::T( 'There are no events scheduled.' ); }
So problem solved :cheer:

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

Moderators: beatnantkrileon
Powered by Kunena Forum