WordPress.org

Forums

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

  1. Daedalon
    Member
    Posted 2 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) ){
    		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/

  2. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 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
    Member
    Posted 2 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 2 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:

    http://wp-events-plugin.com/tutorials/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

  5. Daedalon
    Member
    Posted 2 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

Tags

No tags yet.