Events Manager
[resolved] [BUG/REQ] Support comma-separated list of towns for search (5 posts)

  1. Daedalon
    Posted 3 years ago #

    The category search currently supports multiple arguments in a comma-separated list, making it possible to search events in multiple categories at once after making the front-end code for it.

    The same support should be expanded for "town=" argument as well, so that "town=Dallas,Houston" would show the combined results of all matching events in either Dallas or Houston. Currently it returns only an empty result, likely mistaking the parameters as an instruction to search for a town name that includes a comma, in this case Dallas,Houston.

    Looking at classes/em-events.php lines 243-255 inside function get_post_search I'm not exactly sure why this doesn't work already:

    $accepted_searches = apply_filters('em_accepted_searches', array('scope','search','category','country','state','region','town'), $args);
    foreach($_REQUEST as $post_key => $post_value){
    	if( in_array($post_key, $accepted_searches) && !empty($post_value) ){
    			$post_value = implode(',',$post_value);
    		if($post_value != ',' ){
    			$args[$post_key] = $post_value;
    		}elseif( $post_value == ',' && $post_key == 'scope' ){
    			$args['scope'] = get_option('dbem_events_page_scope');


  2. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 3 years ago #

    a good request and can do this eventually, but this'll take a while for us to implement, given the amount of requests on our plate.

  3. Daedalon
    Posted 3 years ago #

    If you can give me a pointer at whether the above code or a different place would be the right place to implement it I'll gladly take a shot at creating a patch for you.

  4. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 3 years ago #

    If you could create it as an add-on rather than hacking the code directly, that'd be more helpful, we can slot it in the right place much easier if need be, and ppl can use it upgrade-safe immediately.

    Here's the tutorial you'd want to look at:


    This overrides the scope attribute for a new scope type, same concept though, you'd just modify 'town' and apply it to the filters used in this file:


    functions build_sql_conditions and get_default_search

  5. Daedalon
    Posted 3 years ago #

    Great, thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Events Manager
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.