• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Filter for future dates in directory

Filter for future dates in directory 10 years 2 months ago #30438

  • peter52
  • peter52's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 65
  • Thank you received: 3
Hi !

I created a form where users may register for events on a date they selected in a calendar field.
There is a menu option to display submissions using the directory feature of RS Form pro, but past dates should not be displayed as it makes no sense.
How can I filter directory listing to todays and future dates?

As I am not a coder I would be very grateful if somebody could provide a complete PHP script to do that.

THANK YOU !
The administrator has disabled public write access.

Filter for future dates in directory 10 years 1 month ago #30669

  • peter52
  • peter52's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 65
  • Thank you received: 3
No one?
Last Edit: 10 years 1 month ago by peter52.
The administrator has disabled public write access.

Filter for future dates in directory 10 years 1 month ago #30705

  • peter52
  • peter52's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 65
  • Thank you received: 3
Here is a solution from RSJoomla

- enable the 'Show only confirmed submissions' option from your Submission Directory menu item.

- navigate to backend > Components > RSForm!Pro > Manage Directories > your form > PHP Scripts > Scripts called on listing layout. Here, you can use a similar as the following script:

$today = date('d.m.Y');
$range = strtotime($today);
$flag = 0;
$db = JFactory::getDBO();
$db->setQuery("SELECT `SubmissionId`,`FieldValue` FROM #__rsform_submission_values WHERE `FormId`=81 AND `FieldName`='myCalendarName'");
$info = $db->loadObjectList();

foreach($info as $inf){
if(strtotime($inf->FieldValue) < $range){
$db->setQuery("UPDATE #__rsform_submissions SET `confirmed`=0 WHERE `confirmed`=1 AND `SubmissionId`='".$inf->SubmissionId."'");
$db->execute();
if($db->getAffectedRows() > 0)
$flag = 1;
}
}
if($flag == 1){
header("Refresh:0");
}

You'll have to replace the followings:

1. The number:

`FormId`=81

With your form ID.

2. The following string:

myCalendarName

With your calendar exact name.
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!