• Resolved royaltask

    (@royaltask)


    Hello, I am using the Pro version and setting up the event manager:
    I was wondering why past events still show up on the website listing. When I add an new event the “event expiry date” is not set on same date as “end date” automatically. Therefore my events never expire. How can I change this?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi @royaltask,

    We are working on automation part, however, for time being the event expiry date needs to be manually set the same as the event end date.
    We will update you as soon as the development team has worked upon the same.

    Also, make sure that in Event manager >> Settings >> Event listing,
    The option hide expired listing is enabled.

    Also in Event manager >> Settings >> Event Submission,
    select option, events expire on the event end date.

    We will update you whenever the automation feature has been enabled.

    Thanks for your cooperation.

    Regards
    Priya

    Thread Starter royaltask

    (@royaltask)

    I checked “events expire on the event end date”, events in the past are still showing in my listing. This is a common feature, how come past events are still showing?

    Thread Starter royaltask

    (@royaltask)

    How can I achive this:
    if I have set up an expiry date in admin then it will set that date. (works fine!)

    If I have published the end date without changing the expiry date field then it will create event end date as the event expiry date?!

    I just want to hide events older that the end date!

    • This reply was modified 4 years, 5 months ago by royaltask.
    Thread Starter royaltask

    (@royaltask)

    I almost got the automatisation working, _event_expiry_date gets changed automatically – event status is still active and shows 01.01.1970..”get_field” is not valid? I want to compare _event_end_date < $today .Let me know how to get this done:

    // Create a cron job in order to check the custom field of '_event_end_date' against today's date. If the date has passed, set the _event_expiry_date status to '_event_end_date' and hide expired events online
    
    function check_event_end_date( ) {
    
      global $post;
    
      $args = array( 
        'post_type'       => 'event_listing',
        'posts_per_page'  => -1,
      );
    
      $listings = get_posts( $args );
        foreach($listings as $post) : setup_postdata($post);
    
      $today = date( 'Ymd' );
      $expire = get_field( '_event_end_date', false, false );
        //$status = get_field( '_event_expiry_date' );
            if ( $expire < $today ) :
                $status = '_event_end_date';
                update_field( '_event_expiry_date', '$status' );
            endif;  
        endforeach;
    
    }
    
    // Schedule Cron Job Event
    
    if ( ! wp_next_scheduled( 'event_listing_cron_event' ) ) {
        wp_schedule_event( date( 'Ymd' ), 'daily', 'event_listing_cron_event' );
    }
    add_action( 'event_listing_cron_event', 'check_event_end_date' );
    
    
    • This reply was modified 4 years, 5 months ago by royaltask.
    • This reply was modified 4 years, 5 months ago by royaltask.
    • This reply was modified 4 years, 5 months ago by royaltask.
    • This reply was modified 4 years, 5 months ago by royaltask.
    • This reply was modified 4 years, 5 months ago by royaltask.
    Thread Starter royaltask

    (@royaltask)

    I managed it with a hook:

    $listings = get_posts( $args );
        foreach($listings as $post) : setup_postdata($post);
    
      $today = date( 'Ymd' ); // get date
      $expire = get_field( '_event_end_date' );  // get event_end_date
      $expire = str_replace("-", "", $expire); // same date format
    
            if ( $expire < $today ) :  // compare
                $status = '_event_end_date';
    	$post->post_status = 'draft'; // change post status
        wp_update_post( $post );

    hey @royaltask

    That’s Great.
    We are happy your issue has been resolved.

    Regards,
    Priya

    Hi,

    Do review your overall experience with the Plugin(if you haven’t already) on https://www.ads-software.com/support/plugin/wp-event-manager/reviews/

    We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.
    Priya

    Hi @royaltask,

    How did you resolve this issue?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Event expiry date not set on same date as end date automatically’ is closed to new replies.