WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Wrong Date and Time on Single Event using #_EVENTDATES and #_EVENTTIMES (10 posts)

  1. rliverman
    Member
    Posted 5 months ago #

    I'm having an issue after recent plugin updates where the date listed in the single-event page is incorrect.

    You can see a quick example here. This page features an events list and has the correct date information from the event:
    http://shenandoahcountyva.us/industrial/minutes/

    It is just a page with the events_list shortcode running:
    [events_list order="DESC" pagination=1 scope="past"]

    When you click through to the event however the date is wrong, not even close:
    http://shenandoahcountyva.us/industrial/events/ida-meeting/

    This page is using a custom single-event.php template and the date is created by using:

    <div class="entry-meta">
    <?php echo $EM_Event->output('#_EVENTDATES').' - '.$EM_Event->output('#_EVENTTIMES'); ?>
    </div>

    My settings currently have the "date format" set as: m/d/Y

    Checked MySQL and the database has the correct date and time stored, however when I dump the $EM_Event element it all has the wrong date and time but correct other information (title, content, etc.)

    Any thoughts on why #_EVENTDATES and #_EVENTTIMES seem to be having issues all of a sudden when used in template files?

    Thanks!

    http://wordpress.org/plugins/events-manager/

  2. philipjohn
    Member
    Posted 5 months ago #

    Hiya,

    That is the date and time that you created the event. It is added by your theme so you'll need to modify your theme to get rid of it.

    1. Copy single.php
    2. Rename your copy to single-event.php
    3. Edit single-event.php
    4. Find the line that starts <div class="entry-meta"> and delete it

    Thanks

  3. rliverman
    Member
    Posted 5 months ago #

    The file is already single-event.php as I created it to format the way these events were displaying.

    The meta is coming from the event but is pulling the wrong date, that is the issue see:

    <header class="entry-header">
    <h1 class="entry-title"><?php echo $EM_Event->output('#_EVENTNAME'); ?></h1>
    <div class="entry-meta">
    <?php echo $EM_Event->output('#_EVENTDATES').' - '.$EM_Event->output('#_EVENTTIMES'); ?>
    </div>
    </header>
    <div class="entry-content">
    <?php echo $EM_Event->output('#_EVENTNOTES'); ?>
    </div>

    In that code, the #_EVENTNAME and #_EVENTNOTES functions are working perfectly, but the #_EVENTDATES and #_EVENTTIMES are not.

    And when I dump the $EM_Event variable it has the incorrect start / end dates and time information even though all information in the database entry for the event is correct.

    Ryan

  4. rliverman
    Member
    Posted 5 months ago #

    Also the date (wrong) that is displaying isn't tied to the publish date as this site was built in 2013 and this particular event was first published on 1/30.

    Thanks for your speedy help, I love the plugin, just need to figure out this odd bug!

  5. rliverman
    Member
    Posted 5 months ago #

    I should have mentioned this is a multisite install.

    Okay I've found part of the issue, here is a very partial dump of the $EM_event variable:

    EM_EVENT OBJECT ( [EVENT_ID] => 104 [POST_ID] => 88 [EVENT_SLUG] => IDA-MEETING [EVENT_OWNER] => 16 [EVENT_NAME] => IDA MEETING [EVENT_START_TIME] => 19:00:00 [EVENT_END_TIME] => 19:00:00

    You can see that the slug and name are being pulled correctly but when looking in the database it seems that the "Event ID" in the global events table for this particular event is actually 529 not 104.

    Another blog on the multisite also has a post 88 and THAT is where this incorrect event data (104) is coming from.

    So the dates and times need to be pulled like the event slug and event name are being pulled, otherwise they will get data from the POST_ID rather than the correct EVENT_ID in the database which is a problem on multi-site installs.

    I assume this is a bug, happy to help with more info.

  6. rliverman
    Member
    Posted 5 months ago #

    Here it is, but clearer (the dump of the $EM_event) and with comments:

    Notes from the Database:
    The event in question is actually EVENT_ID #529 (from the global _em_events table) on POST_ID #88 (from the site's particular _posts table)

    EM_EVENT OBJECT(
    [EVENT_ID] => 104 (WRONG: this ID belongs to the event with POST_ID #88 on ANOTHER site on the multisite)
    [POST_ID] => 88 (RIGHT, although this post ID is obviously used on other sites on the multisite)
    [EVENT_SLUG] => IDA-MEETING (RIGHT)
    [EVENT_OWNER] => 16
    [EVENT_NAME] => IDA MEETING (RIGHT)
    [EVENT_START_TIME] => 19:00:00 (WRONG, but correct for event #104 from that other site)
    [EVENT_END_TIME] => 19:00:00 (WRONG, but correct for event #104 from that other site)

    So looks like some info is coming over correctly but it would be better (i think?) if all data was coming from the proper event id rather than the post id since post ids can be repeated across a multisite but the global event ID is unique?

    Ryan

  7. caimin_nwl
    NetWebLogic Support
    Posted 5 months ago #

    Hey Ryan,

    Thanks for all this info. Are these the only two events with this kind of crossover? Or can you replicate the problem?

  8. rliverman
    Member
    Posted 5 months ago #

    Appears to happen every time post_id's are the same.

    Here is an example from another site on the multisite:

    http://shenandoahcountyva.us/conservation/minutes/

    The top two (only ones i checked) are having the same issue. Click through and you'll see the dates change but oddly the title and content are connected to the right event.

    I'd have to check the database to see which sites they are crossing with.

    Thanks for looking into this, definitely appearing all across the multisite as more and more events are added and conflicts increase.

    Ryan

  9. rliverman
    Member
    Posted 5 months ago #

    Edit: it appears that for some, the content or EVENTNOTES are also getting pulled from the wrong post / area.

    The proper date here is 3/3/2014 but the date is getting pulled from the last updated time (i.e. now) and the EVENTNOTES are being pulled from another post.

    http://shenandoahcountyva.us/planning-committee/events/planning-commission-meeting-3/

  10. rliverman
    Member
    Posted 5 months ago #

    Until this issue is resolved I'm temporarily pulling the info from the database using post_meta, i.e.

    get_post_meta($post->ID, '_event_start_date', true );

    But I'd like to find a solution that will allow us to use the events manager placeholders and have them work properly.

    Thanks!
    Ryan

Reply

You must log in to post.

About this Plugin

About this Topic