Expired requests not expiring

Hi
I was previously given this code by your team, to expire events based on attribute event_date.

It doesn’t work and hoping for an update / help on what is wrong with it please.

I should add: When I say it doesn’t work, I mean that the requests can still have offers submitted and approved. It looks and behaves like a ‘normal’ request.

Thanks

add_action(‘hivepress/v1/models/request/update’,
function( $request_id, $request ) {
   if ( $request->get_event_date() ) {
       update_post_meta($request_id, ‘hp_expired_time’, strtotime($request->get_event_date()));
       }
   }, 10, 2);

Hi,

Please make sure that you add the snippet correctly: How to add custom code snippets - HivePress Help Center. Additionally, make sure that the custom attribute has event_date name, if the field name is different, please replace it with the correct one.

To test if it works, please create a request with a past date, then go to the request on the backend and verify that the expiration date in the request is set. If so, the request will change status to Draft within a few hours.

Also, please note that this snippet works for requests, not listings. If you use it for listings, please change all request entities to listing in the code.

Hope this helps.

P.S. Please note that we have to move this topic to the Requests forum category. Since it’s related to a premium extension, the forum category is restricted — please add the license key to the account settings or consider renewing support if you still need assistance related to the premium themes or extensions Renew Support | HivePress

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.