• Resolved thomastrethan

    (@thomastrethan)


    it would be great to have some custom filters to hook to when replacing eme placeholders to extend functionality. background: I’m currently using eme to manage (sport) tournaments. I’m currently in need of replacing the attendees list with a result-list if events are in the past and results exist.

    probably 2 hooks (before and after replacing placeholders) in eme_replace_placeholders() in events-manager.php would do. I don’t have any concrete idea yet, suggestions?

    kind regard, tom

    https://www.ads-software.com/plugins/events-made-easy/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Franky

    (@liedekef)

    Can’t the EME conditional tags help you there? See
    https://www.e-dynamics.be/wordpress/?cat=24

    Thread Starter thomastrethan

    (@thomastrethan)

    unfortunately not, because results are handled by another plugin; I’d need to hook a separate function to eme shortcodes before they get replaced.

    maybe an idea using conditional tags would be to check the date and show the shortcode #ATTENDEES for future events and use another (new/unused) marker (eg #RESULTS) for past events. later hook to the final text using wp filters and replace this marker. This would work, if there always would be results, but in case where no results exist I still would like to display the list of attendees.

    Plugin Author Franky

    (@liedekef)

    If your replacement would happen before eme replaces the placeholders, you could just check if your #RESULTS (or whatever) is empty and show the attendees then (using either eme conditional tags, or replacing #RESULTS by either the html you want, or by the string #_ATTENDEES, which eme will later replace by the list of attendees then).

    Thread Starter thomastrethan

    (@thomastrethan)

    correct, that would do. but how to get exactly there: after eme puts the templates together and before replacing the placeholders? does an appropriate filter exist already?

    Plugin Author Franky

    (@liedekef)

    I added a filter called eme_events_format_prefilter, see if that works for you:

    https://plugins.trac.www.ads-software.com/changeset/1048643

    Thread Starter thomastrethan

    (@thomastrethan)

    works pretty good, but one thing: it’ll be great to pass the event to the filter:

    if (has_filter(’eme_events_format_prefilter’)) $format=apply_filters(’eme_events_format_prefilter’,$format,$event);

    Plugin Author Franky

    (@liedekef)

    If you confirm that it works with $event as a second parameter then I’ll add it to the code.

    Thread Starter thomastrethan

    (@thomastrethan)

    confirmed, I currently have the following hack running pretty fine:

    in events-manager.php in function eme_replace_placeholders():


    if (has_filter('eme_events_format_prefilter')) $format=apply_filters('eme_events_format_prefilter',$format,$event);

    and in my theme’s function.php:


    function my_eme_events_format_prefilter($html, $event) {
    ...
    }

    add_filter('eme_events_format_prefilter', 'my_eme_events_format_prefilter', 10, 2);

    Plugin Author Franky

    (@liedekef)

    Ok, implemented in trunk.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘custom filter for placeholders’ is closed to new replies.