WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [BUG/REQ] Support comma-separated list of towns for search

[Resolved] [BUG/REQ] Support comma-separated list of towns for search

  • 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) ){
    		if(is_array($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');
    		}
    	}
    }

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Marcus

    @netweblogic

    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.

    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.

    Plugin Author Marcus

    @netweblogic

    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:

    Create Your Own Event Scope

    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:

    classes/em-locations.php

    functions build_sql_conditions and get_default_search

    Great, thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] [BUG/REQ] Support comma-separated list of towns for search’ is closed to new replies.