Events Made Easy Forums How do I … How do I show last modification?

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #57710
    Anonymous
    Inactive

    It’s me again 🙂

    I use the WP internal get_the_modified_date() to show last modification on my pages but that doesn’t make sense for the parts of EME that are shown via EME’ own events page. Is there a way to indicate last updates or modification on events, places etc.?

    #57712
    Franky
    Keymaster

    Only events have a modif-info column (see the placeholders).
    I ued to implement it for everything, but that just got in the way of effective sql-statements. Maybe I’ll add an auto-update column in the future …

    #57719
    Anonymous
    Inactive

    Alright, thank you, I found #_EVENTMODIFDATE that will do the job. But how can I grab the value from the php file? I like to show that data in the template like
    <?php
    if ($page_id == 4 && eme_is_single_event_page()) {
    echo ‘Last modification: #_EVENTMODIFDATE’;
    }
    ?> }

    #57723
    Franky
    Keymaster

    If you’re using php files that shortcode only makes sense if you know the event id and evaluate the placeholder accordingly. The event id:
    $event_id = intval(get_query_var(‘event_id’));
    and then start using eme_get_event($event_id) etc.

    Why not just use it in your event template itself, much easier …

    #57724
    Anonymous
    Inactive

    The idea of my code was to check for the Event page that is created by the plugin and has in my case the ID 4 and to verify that a single event is shown as there is noch modifdate for the other parts like event places and so on. So I guess there is no need for the event ID, is it? OR how do I get from eme_get_event($event_id) to resolve #_EVENTMODIFDATE? I can’t find eme_get_event() in the documentation.

    First I put #_EVENTMODIFDATE in the form field but than it appears in the entry-content part of the template and I likle to have in the entry-header part to look similar to the other pages.

    #57725
    Franky
    Keymaster

    If you want to show the modif date for an event, you need to use the event id, get the event details and show the modif date …
    The templates api is indeed not very well documented (personally I would hide all functions and get people to use the shortcodes 🙂 ) …
    do eme_get_event on the event id, do a print_r on it and you’ll understand the contents. The modif date is in there but you’ll need some php date manipulation magic to show it the way you want it, or use an eme function to do that for you:
    eme_replace_placeholders($my_format,$event)
    and $my_format can be any single event format content string (in your case, check out the time placeholders mentioned here: http://www.e-dynamics.be/wordpress/category/documentation/7-placeholders/7-2-events/ )

    #57726
    Anonymous
    Inactive

    Wow, I am quite happy.
    Your explanation and hints, my rudimentary php skills and some trial and error brought me to my goal. Thank you very much!

    Might not be the most elegant way, but it works very satisfactorily:

    elseif ($page_id == 4 && eme_is_single_event_page()) {
    	$event_id = intval(get_query_var('event_id'));
    	$event_array = eme_get_event($event_id);
    	$the_modified_date = $event_array[modif_date];
    	$date_format = "#_{l, j. F Y}";
    	echo eme_replace_placeholders($date_format, $event, "text");
    }

    Case closed.

    #57727
    Franky
    Keymaster

    eme_is_single_event_page covers the page id of 4, so you shouldn’t need to check that value. For the rest it seems fine to me.

    #57728
    Anonymous
    Inactive

    Yes, true. I tried and see no difference. Thanks!

    #57729
    Franky
    Keymaster

    Well, I just had some coffee and realized your function won’t do what you want: the format you used suses the event start date as input, not the modif date (“#_” refers to start date, “#@_” to end date, there’s no short description to modify the modif date … I did something similar for members though, so it shouldn’t be too difficult to do something as #_MODIFDATE{xx}.
    Currently, this should work (and more efficient):

    
    elseif (eme_is_single_event_page()) {
    	$event_id = intval(get_query_var('event_id'));
    	$event_array = eme_get_event($event_id);
    	$the_modified_date = $event_array[modif_date];
    	$date_format = "l, j. F Y";
    	echo eme_localized_date($the_modified_date , $date_format);
    }
    

    To be tested of course 🙂

    #57730
    Franky
    Keymaster

    Btw, the next version will have this change included:

    Added event placeholders #_STARTDATE{xx}, #_ENDDATE{xx}, #_EVENTCREATIONDATE{xx}, #_EVENTMODIFDATE{xx}

    And I’ll rethink adding modif dates for members,locations,groups,…

    #57733
    Anonymous
    Inactive

    Hmm, I replaced my code with yours and can’t notice a difference in the outcome. As I wrote it seemed to work for me the way I wanted it to. But okay, you are more into it 🙂

    Thanks also for the upcoming changes and the rethinking.

Viewing 12 posts - 1 through 12 (of 12 total)
  • The forum ‘How do I …’ is closed to new topics and replies.
Scroll to Top