Content Builder Menu Filter

  • kenryanjr
  • Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 144
  • Thank you received: 0

kenryanjr created the topic: Content Builder Menu Filter

I have records that I need to expire after 60 days. I am using Breezing Forms to create the records with a hidden date field, and I write the current date and then I add 60 days for an expired date field which is also hidden. Is there any way I can do this? Can I add a query to the content builder list view somehow so that the expired records aren't included?

I have tried to use the menu filter but it strips or ignores the greater than (>) or less than (<) symbols from the code if I try to add this to the filter
$value >= date('m-d-Y'); or $value <= date('m-d-Y');
. It will only work with (=).

Someone please give me an idea how to accomplish what I am looking to do. I am open to suggestions. Any suggestions.
#237919
  • Posts: 2652
  • Karma: 92
  • Thank you received: 354

mihaela replied the topic: Content Builder Menu Filter

Hello,

You can retrieve today's date in format "mm-dd-yyyy" BreezingForms in hidden field by setting the following as value in Properties of that element:
<?php return date('m-d-Y'); ?>

The code that will add 60 days to today's date is the following:
<?php $today = date('d-m-Y'); return date('m-d-Y',strtotime('+60 days',strtotime( $today ))) ; ?>
Therefore, put that as value of the second hidden field.

As for sorting the view to show only records that aren't expired, you might use the Advanced list filter, but in that case, all records will be shown when the view is entered and the filter will have to be applied to get only wanted records.
You can read more about it here crosstec.org/en/support/online-documenta...r-joomla-%C2%AE.html .

I hope that this will help. Let me know whether you have managed to set this for your form.

Regards,

Mihaela
#237923
  • kenryanjr
  • Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 144
  • Thank you received: 0

kenryanjr replied the topic: Content Builder Menu Filter

Mihaela,

Yes I have that code and it works. I need a way to filter the list so that expired ads don’t show up in the list.

Is there a way to add a query in the custom list view that would filter them out? Or PHP code that could do it? Is that possible?
#237931
  • Posts: 2652
  • Karma: 92
  • Thank you received: 354

mihaela replied the topic: Content Builder Menu Filter

Hello again,

I have been looking into this but didn't manage to make it work as you wanted.

Unfortunately, in the filter form menu item, only equality can be checked, so there isn't an option to check whether the date is in the past.

What you could do is you could add the following code in the "Item wrap code" area for the field that holds expirey date:
<?php $pieces = explode("-", $value);   $expformated = $pieces[2] ."-" . $pieces[0] ."-". $pieces[1]; $value = $expformated ; $date = new DateTime($expformated); $now = new DateTime(); if($date < $now) { $value = "EXPIRED"; }  ?>
That way, value EXPIRED would be shown in each record for which the expirey date is in the past.

Regards,

Mihaela
#237949
The following user(s) said Thank You: kenryanjr
  • kenryanjr
  • Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 144
  • Thank you received: 0

kenryanjr replied the topic: Content Builder Menu Filter

Mihaela,

I will try this tonight. Thank you.
#237953
  • kenryanjr
  • Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 144
  • Thank you received: 0

kenryanjr replied the topic: Content Builder Menu Filter

That works to write "ExXPIRED". However I can't use it for the menu filter. I need to be able to filter the expired ads out of the list view. I have another way to accomplish this. However I can't figure out how to make it work with the BF database. In a regular SQL database I can run an SQL update every night with a cron and look at the expireDate field and if it is >= todays date then write Yes in another column called expired. But because BF is more of a flat database I don't know how to write that SQL for the cron.
#237957
Moderators: ForumSupporttomeperica
Time to create page: 0.039 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans, templates and icon packs!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here