• Resolved gmorley

    (@gmorley)


    I am trying to hack the search form so that users can search a single day, rather than a range of dates. I can’t find any of the files that deal with the search form besides events-search.php but I can’t figure out how I would edit the date fields so that it was just one date. I could easily delete the second box, but then the search finds all events on or after the date selected. I only want the events on the date selected.

    I even tried copying the date from one into the other using javascript, and then hiding the second one, but somehow the date selector plugin in not allowing the onchange javascript function to work. Where is the datepicker code located so I can maybe alter that?

    The website is https://altitudevip.com/events/ and the test form is the second one. I’m planning to apply all the code to the top form once I get it working properly…

    https://www.ads-software.com/extend/plugins/events-manager/

Viewing 7 replies - 1 through 7 (of 7 total)
  • have you tried to see template file at templates/events-list.php

    https://wp-events-plugin.com/documentation/using-template-files/

    Thread Starter gmorley

    (@gmorley)

    Yes and I’m not sure exactly how the search is taking place.. It appears when you use the search for, it passes specific $args to the event list page, which then displays only the events which match those criteria.

    Is there a way to search by only start date? Most of my events are going to be nightclub events, which means they go from 10pm one day, to 3am the following. The problem with this is, people search for Saturday, and don’t want to see all the Friday events that carried over.

    I’ll keep trying but so far I’ve only been able to narrow it down to search one day, but auto-filling the end date field with what’s chosen in the start date, and hiding the end date field from view.

    you can hide end date from template file events-search.php and then on events-list.php template you can add $args['scope'] = $_REQUEST['scope'][0]; inside if( get_option('dbem_events_page_search') && !defined('DOING_AJAX') ){

    Thread Starter gmorley

    (@gmorley)

    What I mean is to search by start date, but ignore end date. So if an event starts on the 18th, but carries over to the 19th, and you search on the 19th, it won’t show said event. it will only show events that START on the 19th

    Thread Starter gmorley

    (@gmorley)

    You code worked by taking the scope and instead of returning both start date and end date from the search form, it just displayed the start date. Thank you for that, it puts me halfway there. Now I just have to figure out how to alter the EM_Events::output ( $args ); to ignore all events that don’t start on the searched date. I was thinking a simple “if (event start date != search date) don’t echo” kind of solution but not sure where to alter the output…

    Thread Starter gmorley

    (@gmorley)

    SOLVED

    events manager plugin folder “classes” and file em-events.php

    add on line 162:
    global $stop_now;

    then on line 198 make it like this:
    foreach ( $events as $EM_Event ) {
    if ( !$args[‘scope’] || ( $args[‘scope’] == $EM_Event->event_start_date ) ) {
    $output .= $EM_Event->output($format);
    $stop_now = false;
    }
    else {
    $output = get_option ( ‘dbem_no_events_message’ );
    $stop_now = true;
    }

    Then line 216 add the if statement around the output

    if ( !$stop_now ) {
    $output = $format_header . $output . $format_footer;
    }

    I know it’s a dirty hack but i’m too tired to make it nicer right now and just excited that it’s fixed.

    Thread Starter gmorley

    (@gmorley)

    Please note this is after using aglonwl’s suggestion to add $args[‘scope’] = $_REQUEST[‘scope’][0]; inside if( get_option(‘dbem_events_page_search’) && !defined(‘DOING_AJAX’) ){ to the events-list.php

    also note by altering a file in the classes directory, if you update the plugin you’ll have to go back and upload your changed file again. Be careful when doing this.. better to make the alterations to the new file if it was changed.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: Events Manager] Search specific date’ is closed to new replies.