public static function get_default_search($array_or_defaults = array(), $array = array())
 {
     self::$context = EM_POST_TYPE_LOCATION;
     $defaults = array('eventful' => false, 'eventless' => false, 'orderby' => 'location_name', 'town' => false, 'state' => false, 'country' => false, 'region' => false, 'status' => 1, 'scope' => 'all', 'blog' => get_current_blog_id(), 'private' => current_user_can('read_private_locations'), 'private_only' => false, 'post_id' => false);
     //sort out whether defaults were supplied or just the array of search values
     if (empty($array)) {
         $array = $array_or_defaults;
     } else {
         $defaults = array_merge($defaults, $array_or_defaults);
     }
     //specific functionality
     if (EM_MS_GLOBAL) {
         if (get_site_option('dbem_ms_mainblog_locations')) {
             //when searching in MS Global mode with all locations being stored on the main blog, blog_id becomes redundant as locations are stored in one blog table set
             $array['blog'] = false;
         } elseif ((!is_admin() || defined('DOING_AJAX')) && empty($array['blog']) && is_main_site() && get_site_option('dbem_ms_global_locations')) {
             //if enabled, by default we display all blog locations on main site
             $array['blog'] = false;
         }
     }
     $array['eventful'] = !empty($array['eventful']) && $array['eventful'] == true;
     $array['eventless'] = !empty($array['eventless']) && $array['eventless'] == true;
     if (is_admin() && !defined('DOING_AJAX')) {
         $defaults['owner'] = !current_user_can('read_others_locations') ? get_current_user_id() : false;
     }
     return apply_filters('em_locations_get_default_search', parent::get_default_search($defaults, $array), $array, $defaults);
 }
Example #2
0
 function get_default_search($array = array())
 {
     self::$context = EM_POST_TYPE_LOCATION;
     $defaults = array('eventful' => false, 'eventless' => false, 'orderby' => 'location_name', 'town' => false, 'state' => false, 'country' => false, 'region' => false, 'status' => 1, 'scope' => 'all', 'blog' => get_current_blog_id(), 'private' => current_user_can('read_private_locations'), 'private_only' => false, 'post_id' => false);
     if (EM_MS_GLOBAL && get_site_option('dbem_ms_mainblog_locations')) {
         //when searching in MS Global mode with all locations being stored on the main blog, blog_id becomes redundant as locations are stored in one blog table set
         $array['blog'] = false;
     }
     $array['eventful'] = !empty($array['eventful']) && $array['eventful'] == true;
     $array['eventless'] = !empty($array['eventless']) && $array['eventless'] == true;
     if (is_admin()) {
         $defaults['owner'] = !current_user_can('read_others_locations') ? get_current_user_id() : false;
     }
     return apply_filters('em_locations_get_default_search', parent::get_default_search($defaults, $array), $array, $defaults);
 }