WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Search result problem with date range (8 posts)

  1. Friedrich72
    Member
    Posted 1 year ago #

    Impressed with this program. Thanks for providing it.
    Using 5.3.1.
    I have created a custom placeholder to display up to 25 potential events per day if they exist.

    $mygroups = $wpdb->get_results("SELECT * FROM wp_terms WHERE term_group = 111 AND name = '$eventname'");
    
    	foreach($mygroups as $mygroup):
    	echo '<div id="location"><div class="name"><a href="'. $eventurl.'">' .$mygroup->name.'</a></div><div class="time">'.$starttime.' - '.$endtime.'</div><div class="location">'.$location.'</div></div>';
    
    	endforeach;

    Search results are fine if I do a search from 12-4 to 12-11.
    On Tuesday, 12-4, all 25 events show as expected.
    If I search from 12-4 to 12-12, my result drops to 21 events on Tuesday the 4th.
    If I search from 12-4 to 12-13, my result drops again to 20.
    From 12-4 to 12-14, drops again to 19.

    Any idea what could be causing it?

    Also, I am unable to list the events by name without altering the em-template-tags.php file despite my having changed every instance of default orderby in EM Settings.

    If you need to see a URL could I ask for a private link to submit it?

    Thanks for your thoughts.

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

  2. Friedrich72
    Member
    Posted 1 year ago #

    Follow up: the search has the same effect without using the custom placeholder. If I use #_EVENTLINK OR #_EVENTNAME instead it does the same.

  3. Friedrich72
    Member
    Posted 1 year ago #

    Follow up: Two interesting occurances;
    1st>The problem only happens when I search all categories. If I choose a specific category, results are good, pagination is good.

    2nd>The missing results are showing up on Page two of results. Partial Tuesday, Dec 4th results are on page one. It continues to show partial resutls for each date up to the 14th on page two.
    Then it starts over on page two with Tuesday, Dec 4th again, only showing the results that were not displayed on page 1.

    Pointing more towards pagination issue?

  4. agelonwl
    Member
    Posted 1 year ago #

    Hi,

    Is this using template file at wp-content/plugins/events-manager/templates/templates/events-list.php ?

    http://wp-events-plugin.com/documentation/event-search-attributes/
    http://wp-events-plugin.com/documentation/using-template-files/

  5. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    not sure where you're adding the code above, but if you're limiting which events to show during a list of events it may well throw off pagination if you're ommitting certain events.

    if you're limiting events to certain categories, why not use our internal category filter?

  6. Friedrich72
    Member
    Posted 1 year ago #

    Thank you for the responses.
    @agelonwl, yes I am using events-list.php.

    I realized the problem is due to further modifications that I am trying to work in with $output. I reloaded a fresh install this morning just to make sure I was testing properly and results were normal.
    If I increase the default limit to something really high I have no problems. So a lower limit was dividing my results up strangely per-page because of the modifications.

    @Marcus, what I need to accomplish, I dont think exists for functionality as far as what I have read in forums. FYI- I am displaying hours of operation for appx 45 locations that are open all year. Treating each location as an event.
    I need to display events on one page in groups by category and have them be searchable. ie...
    Search Form
    A-Eventlist
    B-Eventlist
    C-Eventlist
    D-Eventlist

    Ideally I'd like to use shortcodes but the [event_search_form] appears to have no effect on something like [events_list category="86" scope="today"] in the event page. Is there a way to hook the short code for the search form into the short codes in the event page? That would solve all my dilemmas.

    Please dont be too hard on my work here.:) Just trying to work it out...
    What I ended up doing was creating custom placeholders A,B,C,D.
    Example for A:

    add_filter('em_event_output_placeholder','mygroup_em_placeholder',1,3);
    function mygroup_em_placeholder($replace, $EM_Event, $result){
    	if ( $result == '#_MYGROUP' ) {
    		ob_start();
    		$template = em_locate_template('placeholders/mygroup.php', true, array('EM_Event'=>$EM_Event));
    		$replace = ob_get_clean();
    	}
    	return $replace;
    }

    and in mygroup.php

    $mygroups = $wpdb->get_results("SELECT * FROM wp_terms WHERE term_group = 111 AND name = '$eventname'");
    
    	foreach($mygroups as $mygroup):
    	echo '<div id="location"><div class="name"><a href="'. $eventurl.'">' .$mygroup->name.'</a></div><div class="time">'.$starttime.' - '.$endtime.'</div><div class="location">'.$location.'</div></div>';
    
    	endforeach;

    Modified Admin/em_optioins.php to allow 3 new formats, ie format2, format 3 and format 4 ( I know this is where it gets a little crazy)

    em_options_textarea ( __( 'Default event list format', 'dbem' ), 'dbem_event_list_item_format2', __( 'The format of any events in a list.', 'dbem' ).$events_placeholder_tip );
    and same for _format3, _format4. Created tables in the database accordingly.

    Then modified classes/em_events.php to include the new formats and also added additional outputs 2,3,4

    $format = ( empty($args['format']) ) ? get_option( 'dbem_event_list_item_format' ) : $args['format'] ;
    $format2 = ( empty($args['format']) ) ? get_option( 'dbem_event_list_item_format_2' ) : $args['format'] ;
    $format3 = ( empty($args['format']) ) ? get_option( 'dbem_event_list_item_format_3' ) : $args['format'] ;
    $format4 = ( empty($args['format']) ) ? get_option( 'dbem_event_list_item_format_4' ) : $args['format'] ;

    And

    $output = "";
    		$events = apply_filters('em_events_output_events', $events);
    		if ( $events_count > 0 ) {
    			foreach ( $events as $EM_Event ) {
    				$output .= $EM_Event->output($format);
    $output2 .= $EM_Event->output($format2);
    $output3 .= $EM_Event->output($format3);
    $output4 .= $EM_Event->output($format4);
    
    			}

    I didnt need to add headers for each output.

    I'm sure you both can think of a cleaner way to accomplish this.
    All of the mods actually work great except for the break in the search result as described in my original post.
    Any help would be much appreciated. We are testing this software out for our uses but would be very willing to upgrade to pro if you think we can accomplish our goal.

  7. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    pro won't affect this behavior (nor can we help you support-wise on this), but this is pretty custom work so it's something you'd need to hire someone to help you with or spend some more time experimenting.

    the one comment I can make is to

    modified classes/em_events.php

    bad idea. you can probably do this outside the plugin e.g. using the filter em_event_output to change the output at $EM_Event->output()

  8. Friedrich72
    Member
    Posted 1 year ago #

    Thanks again for your thoughts. I feel like I am close so I'll continue to test following your comment on em_events.php.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic