Support » Plugin: Events Manager » Custom date field can not be used for date comparison

  • Hello

    Since version, I can no longer use my custom date field (#_ATT{deadline}) in a shortcode as a date.

    I use a function to compare the current date with the end date.
    As long as the deadline> = current date, custom content should be output.

    Here is an example of formatting the single event page

    [datum_vb from = ’01 .01.2017′ to =’#_ATT{deadline}’] CUSTOM_CONTENT [/ datum_vb]

    As a text output, the value from variable $to (source: #_ATT{deadline} = 18/05/2018) is passed correctly, but as soon as you want to use it as a date to compare with the current date, you can not.
    Strangely not “18.05.2018” used, but “#_ATT{deadline}” as text – so no date comparison can work.

    I did not change a shortcode, but I had the last plugin updates.

    Up to version it worked without problems.

    Thanks a lot in advance

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support angelo_nwl


    does it make any difference trying EM version

    I noticed it only after the update to version
    Yes, even with version the error occurs!

    Actually should be displayed here a note for the registration.

    Here is an example link

    Here the formatting for single page of the call
    Comments and text are in German

    [datum_vb von=’01.01.2017′ bis=’#_ATT{Anmeldeschluss}’]
    Hinweise für die Anmeldung finden Sie hier… (Link mit anderen Felder (#_EVENTNAME, #_EVENTDATES, #_EVENTTIMES und #_ATT{Code})

    Here is the shortcode used
    Comments and text are in German

    * datum_check – datum ueberpruefen
    function date2timestamp($datum) {
    list($tag, $monat, $jahr) = explode(“.”, $datum);
    $jahr = sprintf(“%04d”, $jahr);
    $monat = sprintf(“%02d”, $monat);
    $tag = sprintf(“%02d”, $tag);
    return(mktime(0, 0, 0, $monat, $tag, $jahr));

    function datum_vb( $atts, $custom_content = null ) {
    $a = shortcode_atts( array (
    ‘von’ => “01.01.2010”,
    ‘bis’ => “01.01.2010”,
    ), $atts );

    $no_text = ‘ ‘; // alternative Ausgabe
    $datum_h = date(“d.m.Y”,time());

    if (empty($a[von])) {
    $datum_von = “02.02.2012”;
    } else {
    $datum_von = $a[von] ;

    if (empty($a[bis])) {
    $datum_bis = “04.04.2014”;
    } else {
    $datum_bis = $a[bis] ;

    // Anmeldung-Hinweis
    return do_shortcode($custom_content) ;
    } else {
    // keine Anmeldung-Hinweis
    return do_shortcode($no_text) ;
    add_shortcode( ‘datum_vb’, ‘datum_vb’ );

    Maybe that helps with troubleshooting on

    Plugin Support caimin_nwl


    NetWebLogic Support

    Thanks for the extra information. I’m pretty sure this is connected with a bug that’s already been reported to the developer team.

    We’ll update this thread once there’s a fix.

    Plugin Author Marcus


    unfortunately this bug arose by us trying to fix another bug where users were trying to create shortcodes with formats within it e.g.


    Previously you’d end up with a list containing the name of the same event since #_EVENTNAME was parsed before the shortcode. ‘fixed’ this by parsing shortcodes first, but inadvertedly created this bug you’re reporting since any arguments are not parsed yet.

    We’re going to revert this in the next update. However, since we’re in a bit of a limbo with timezone integration it may be a few more weeks between the next update, so the short-term solution would be to manually edit and comment out or remove this line on /events-manager/classes/em-events.php (line 1710):

    $format = do_shortcode($format); //parse shortcode first, so that formats within shortcodes are parsed properly

    Sorry for the inconvenience! We’ll also be putting this out on the next dev update too, so if you’re up for experimenting with our new timezone features, we’d love to get more people trying it out.

    thanks for this information

    The error only occurs if you want to continue using the value in an external function.
    Like in a query on my problem, where I check a ‘#_ATT{deadline}’.

    [datum_vb von='01.01.2017' bis='#_ATT{Anmeldeschluss}']
    Hinweise für die Anmeldung finden Sie hier… (Link mit anderen Felder (#_EVENTNAME, #_EVENTDATES, #_EVENTTIMES und #_ATT{Code})

    For example, by simply passing in fields as a link parameter, there are no problems.

    <a href="{Code}&ev_url=#_EVENTURL&ev_ort=&ev_ort=#_LOCATIONNAME, #_LOCATIONTOWN, #_LOCATIONADDRESS&ev_ort_alter=#_ATT{Alternativer-Ort}&ev_datum=#_EVENTDATES, #_EVENTTIMES" >Veranstaltungsanmeldung (ex)</a>


    In my version, the location is not in the file (em-events.php) and not in the line (line 1710) of you.

    I found them in the file /events-manager/classes/em-event.php (line 1500).

    The temporary solution works though.

    I hope for a solution from you.

    Plugin Support caimin_nwl


    NetWebLogic Support

    We’ll update this thread when there’s a fix.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Custom date field can not be used for date comparison’ is closed to new replies.