Version Description
Download this release
Release Info
Developer | adampickering |
Plugin | Regions for WP Job Manager |
Version | 1.11.0 |
Comparing to | |
See all releases |
Code changes from version 1.10.0 to 1.11.0
- assets/js/main.js +1 -1
- includes/class-taxonomy.php +73 -33
- includes/class-template.php +38 -3
- readme.txt +10 -2
- wp-job-manager-locations.php +131 -6
assets/js/main.js
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
},
|
26 |
|
27 |
addSubmission: function() {
|
28 |
-
$( '#job_region' ).chosen({
|
29 |
search_contains: true
|
30 |
});
|
31 |
},
|
25 |
},
|
26 |
|
27 |
addSubmission: function() {
|
28 |
+
$( '#job_region, #resume_region' ).chosen({
|
29 |
search_contains: true
|
30 |
});
|
31 |
},
|
includes/class-taxonomy.php
CHANGED
@@ -14,49 +14,89 @@ class Astoundify_Job_Manager_Regions_Taxonomy extends Astoundify_Job_Manager_Reg
|
|
14 |
public function register_taxonomy() {
|
15 |
$admin_capability = 'manage_job_listings';
|
16 |
|
17 |
-
$
|
18 |
-
$
|
19 |
|
20 |
if ( current_theme_supports( 'job-manager-templates' ) ) {
|
21 |
-
$
|
22 |
'slug' => _x( 'job-region', 'Job region slug - resave permalinks after changing this', 'wp-job-manager-locations' ),
|
23 |
'with_front' => false,
|
24 |
'hierarchical' => false
|
25 |
);
|
|
|
|
|
|
|
|
|
|
|
26 |
} else {
|
27 |
-
$
|
|
|
28 |
}
|
29 |
|
30 |
register_taxonomy( 'job_listing_region',
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
|
62 |
}
|
14 |
public function register_taxonomy() {
|
15 |
$admin_capability = 'manage_job_listings';
|
16 |
|
17 |
+
$job_singular = __( 'Job Region', 'wp-job-manager-locations' );
|
18 |
+
$job_plural = __( 'Job Regions', 'wp-job-manager-locations' );
|
19 |
|
20 |
if ( current_theme_supports( 'job-manager-templates' ) ) {
|
21 |
+
$job_rewrite = array(
|
22 |
'slug' => _x( 'job-region', 'Job region slug - resave permalinks after changing this', 'wp-job-manager-locations' ),
|
23 |
'with_front' => false,
|
24 |
'hierarchical' => false
|
25 |
);
|
26 |
+
$resume_rewrite = array(
|
27 |
+
'slug' => _x( 'resume-region', 'Resume region slug - resave permalinks after changing this', 'wp-job-manager-locations' ),
|
28 |
+
'with_front' => false,
|
29 |
+
'hierarchical' => false
|
30 |
+
);
|
31 |
} else {
|
32 |
+
$job_rewrite = false;
|
33 |
+
$resume_rewrite = false;
|
34 |
}
|
35 |
|
36 |
register_taxonomy( 'job_listing_region',
|
37 |
+
array( 'job_listing' ),
|
38 |
+
array(
|
39 |
+
'hierarchical' => true,
|
40 |
+
'update_count_callback' => '_update_post_term_count',
|
41 |
+
'label' => $job_plural,
|
42 |
+
'labels' => array(
|
43 |
+
'name' => $job_plural,
|
44 |
+
'singular_name' => $job_singular,
|
45 |
+
'search_items' => sprintf( __( 'Search %s', 'wp-job-manager-locations' ), $job_plural ),
|
46 |
+
'all_items' => sprintf( __( 'All %s', 'wp-job-manager-locations' ), $job_plural ),
|
47 |
+
'parent_item' => sprintf( __( 'Parent %s', 'wp-job-manager-locations' ), $job_singular ),
|
48 |
+
'parent_item_colon' => sprintf( __( 'Parent %s:', 'wp-job-manager-locations' ), $job_singular ),
|
49 |
+
'edit_item' => sprintf( __( 'Edit %s', 'wp-job-manager-locations' ), $job_singular ),
|
50 |
+
'update_item' => sprintf( __( 'Update %s', 'wp-job-manager-locations' ), $job_singular ),
|
51 |
+
'add_new_item' => sprintf( __( 'Add New %s', 'wp-job-manager-locations' ), $job_singular ),
|
52 |
+
'new_item_name' => sprintf( __( 'New %s Name', 'wp-job-manager-locations' ), $job_singular )
|
53 |
+
),
|
54 |
+
'show_ui' => true,
|
55 |
+
'query_var' => true,
|
56 |
+
'has_archive' => true,
|
57 |
+
'capabilities' => array(
|
58 |
+
'manage_terms' => $admin_capability,
|
59 |
+
'edit_terms' => $admin_capability,
|
60 |
+
'delete_terms' => $admin_capability,
|
61 |
+
'assign_terms' => $admin_capability,
|
62 |
+
),
|
63 |
+
'rewrite' => $job_rewrite,
|
64 |
+
)
|
65 |
+
);
|
66 |
+
|
67 |
+
$resume_singular = __( 'Resume Region', 'wp-job-manager-locations' );
|
68 |
+
$resume_plural = __( 'Resume Regions', 'wp-job-manager-locations' );
|
69 |
+
|
70 |
+
register_taxonomy( 'resume_region',
|
71 |
+
array( 'resume' ),
|
72 |
+
array(
|
73 |
+
'hierarchical' => true,
|
74 |
+
'update_count_callback' => '_update_post_term_count',
|
75 |
+
'label' => $resume_plural,
|
76 |
+
'labels' => array(
|
77 |
+
'name' => $resume_plural,
|
78 |
+
'singular_name' => $resume_singular,
|
79 |
+
'search_items' => sprintf( __( 'Search %s', 'wp-job-manager-locations' ), $resume_plural ),
|
80 |
+
'all_items' => sprintf( __( 'All %s', 'wp-job-manager-locations' ), $resume_plural ),
|
81 |
+
'parent_item' => sprintf( __( 'Parent %s', 'wp-job-manager-locations' ), $resume_singular ),
|
82 |
+
'parent_item_colon' => sprintf( __( 'Parent %s:', 'wp-job-manager-locations' ), $resume_singular ),
|
83 |
+
'edit_item' => sprintf( __( 'Edit %s', 'wp-job-manager-locations' ), $resume_singular ),
|
84 |
+
'update_item' => sprintf( __( 'Update %s', 'wp-job-manager-locations' ), $resume_singular ),
|
85 |
+
'add_new_item' => sprintf( __( 'Add New %s', 'wp-job-manager-locations' ), $resume_singular ),
|
86 |
+
'new_item_name' => sprintf( __( 'New %s Name', 'wp-job-manager-locations' ), $resume_singular )
|
87 |
+
),
|
88 |
+
'show_ui' => true,
|
89 |
+
'query_var' => true,
|
90 |
+
'has_archive' => true,
|
91 |
+
'capabilities' => array(
|
92 |
+
'manage_terms' => $admin_capability,
|
93 |
+
'edit_terms' => $admin_capability,
|
94 |
+
'delete_terms' => $admin_capability,
|
95 |
+
'assign_terms' => $admin_capability,
|
96 |
+
),
|
97 |
+
'rewrite' => $resume_rewrite,
|
98 |
+
)
|
99 |
+
);
|
100 |
}
|
101 |
|
102 |
}
|
includes/class-template.php
CHANGED
@@ -4,15 +4,21 @@ class Astoundify_Job_Manager_Regions_Template extends Astoundify_Job_Manager_Reg
|
|
4 |
|
5 |
public function __construct() {
|
6 |
add_filter( 'submit_job_form_fields', array( $this, 'submit_job_form_fields' ) );
|
7 |
-
add_filter( '
|
|
|
|
|
|
|
8 |
add_filter( 'submit_job_form_fields_get_job_data', array( $this, 'submit_job_form_fields_get_job_data' ), 10, 2 );
|
|
|
|
|
9 |
|
10 |
add_action( 'wp', array( $this, 'sort' ) );
|
11 |
}
|
12 |
|
13 |
public function sort() {
|
|
|
|
|
14 |
if ( get_option( 'job_manager_regions_filter' ) || is_tax( 'job_listing_region' ) ) {
|
15 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ) );
|
16 |
add_action( 'job_manager_job_filters_search_jobs_end', array( $this, 'job_manager_job_filters_search_jobs_end' ) );
|
17 |
} else {
|
18 |
add_action( 'job_manager_job_filters_search_jobs_end', array( $this, 'tax_archive_field' ) );
|
@@ -24,7 +30,17 @@ class Astoundify_Job_Manager_Regions_Template extends Astoundify_Job_Manager_Reg
|
|
24 |
* Frontend scripts.
|
25 |
*/
|
26 |
public function wp_enqueue_scripts() {
|
27 |
-
wp_enqueue_script( 'job-regions', wp_job_manager_regions()->plugin_url . '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
29 |
|
30 |
public function submit_job_form_fields_get_job_data( $fields, $job ) {
|
@@ -37,6 +53,19 @@ class Astoundify_Job_Manager_Regions_Template extends Astoundify_Job_Manager_Reg
|
|
37 |
return $fields;
|
38 |
}
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
/**
|
41 |
* Add the field to the submission form.
|
42 |
*/
|
@@ -73,6 +102,12 @@ class Astoundify_Job_Manager_Regions_Template extends Astoundify_Job_Manager_Reg
|
|
73 |
) ) );
|
74 |
}
|
75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
/**
|
77 |
* If we are not using regions on the filter set a hidden field so the AJAX
|
78 |
* call still only looks in that area.
|
4 |
|
5 |
public function __construct() {
|
6 |
add_filter( 'submit_job_form_fields', array( $this, 'submit_job_form_fields' ) );
|
7 |
+
add_filter( 'submit_resume_form_fields', array( $this, 'submit_resume_form_fields' ) );
|
8 |
+
if ( get_option( 'job_manager_enable_regions_filter' ) ) {
|
9 |
+
add_filter( 'the_job_location', array( $this, 'the_job_location' ), 10, 2 );
|
10 |
+
}
|
11 |
add_filter( 'submit_job_form_fields_get_job_data', array( $this, 'submit_job_form_fields_get_job_data' ), 10, 2 );
|
12 |
+
add_filter( 'submit_resume_form_fields_get_resume_data', array( $this, 'submit_resume_form_fields_get_resume_data' ), 10, 2 );
|
13 |
+
add_filter( 'job_manager_term_select_field_wp_dropdown_categories_args', array( $this, 'job_manager_term_select_field_wp_dropdown_categories_args' ), 10, 3 );
|
14 |
|
15 |
add_action( 'wp', array( $this, 'sort' ) );
|
16 |
}
|
17 |
|
18 |
public function sort() {
|
19 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ) );
|
20 |
+
|
21 |
if ( get_option( 'job_manager_regions_filter' ) || is_tax( 'job_listing_region' ) ) {
|
|
|
22 |
add_action( 'job_manager_job_filters_search_jobs_end', array( $this, 'job_manager_job_filters_search_jobs_end' ) );
|
23 |
} else {
|
24 |
add_action( 'job_manager_job_filters_search_jobs_end', array( $this, 'tax_archive_field' ) );
|
30 |
* Frontend scripts.
|
31 |
*/
|
32 |
public function wp_enqueue_scripts() {
|
33 |
+
wp_enqueue_script( 'job-regions', wp_job_manager_regions()->plugin_url . 'assets/js/main.js', array( 'jquery', 'chosen' ), 20140525, true );
|
34 |
+
}
|
35 |
+
|
36 |
+
public function submit_resume_form_fields_get_resume_data( $fields, $job ) {
|
37 |
+
$field = isset( $fields[ 'resume_fields' ][ 'resume_region' ] ) ? $fields[ 'resume_fields' ][ 'resume_region' ] : false;
|
38 |
+
|
39 |
+
if ( $field ) {
|
40 |
+
$fields[ 'resume_fields' ][ 'resume_region' ][ 'value' ] = wp_get_object_terms( $job->ID, $field['taxonomy'], array( 'fields' => 'ids' ) );
|
41 |
+
}
|
42 |
+
|
43 |
+
return $fields;
|
44 |
}
|
45 |
|
46 |
public function submit_job_form_fields_get_job_data( $fields, $job ) {
|
53 |
return $fields;
|
54 |
}
|
55 |
|
56 |
+
public function submit_resume_form_fields( $fields ) {
|
57 |
+
$fields[ 'resume_fields' ][ 'resume_region' ] = array(
|
58 |
+
'label' => __( 'Region', 'wp-job-manager-locations' ),
|
59 |
+
'type' => 'term-select',
|
60 |
+
'taxonomy' => 'resume_region',
|
61 |
+
'required' => true,
|
62 |
+
'priority' => '2.5',
|
63 |
+
'default' => -1
|
64 |
+
);
|
65 |
+
|
66 |
+
return $fields;
|
67 |
+
}
|
68 |
+
|
69 |
/**
|
70 |
* Add the field to the submission form.
|
71 |
*/
|
102 |
) ) );
|
103 |
}
|
104 |
|
105 |
+
public function job_manager_term_select_field_wp_dropdown_categories_args( $args, $key, $field ) {
|
106 |
+
$args['show_option_none'] = __( 'Select Region', 'wp-job-manager-locations' );
|
107 |
+
$args['option_none_value'] = '';
|
108 |
+
return $args;
|
109 |
+
}
|
110 |
+
|
111 |
/**
|
112 |
* If we are not using regions on the filter set a hidden field so the AJAX
|
113 |
* call still only looks in that area.
|
readme.txt
CHANGED
@@ -6,8 +6,8 @@ Donate link: https://www.paypal.me/astoundify
|
|
6 |
Contributors: Astoundify
|
7 |
Tags: job, job listing, job region
|
8 |
Requires at least: 4.4
|
9 |
-
Tested up to: 4.
|
10 |
-
Stable Tag: 1.
|
11 |
License: GPLv3
|
12 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
13 |
|
@@ -32,6 +32,14 @@ Astoundify has released two themes that are fully integrated with the WP Job Man
|
|
32 |
|
33 |
== Changelog ==
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
= 1.10.0: February 5, 2016 =
|
36 |
|
37 |
* New: Use `search_contains` to search less strictly.
|
6 |
Contributors: Astoundify
|
7 |
Tags: job, job listing, job region
|
8 |
Requires at least: 4.4
|
9 |
+
Tested up to: 4.6
|
10 |
+
Stable Tag: 1.11.0
|
11 |
License: GPLv3
|
12 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
13 |
|
32 |
|
33 |
== Changelog ==
|
34 |
|
35 |
+
= 1.11.0: September 1, 2016 =
|
36 |
+
|
37 |
+
* New: Tested up to: WordPress 4.6
|
38 |
+
* New: add in option to disable filtering location
|
39 |
+
* New: add in new taxonomy for resumes
|
40 |
+
* Fix: Remove trailing slash and account for https
|
41 |
+
* Fix: Update settings strings
|
42 |
+
|
43 |
= 1.10.0: February 5, 2016 =
|
44 |
|
45 |
* New: Use `search_contains` to search less strictly.
|
wp-job-manager-locations.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: Create predefined regions/locations that job submissions can associate themselves with.
|
6 |
* Author: Astoundify
|
7 |
* Author URI: http://astoundify.com
|
8 |
-
* Version: 1.
|
9 |
* Text Domain: wp-job-manager-locations
|
10 |
*/
|
11 |
|
@@ -39,7 +39,7 @@ class Astoundify_Job_Manager_Regions {
|
|
39 |
$this->file = __FILE__;
|
40 |
$this->basename = plugin_basename( $this->file );
|
41 |
$this->plugin_dir = plugin_dir_path( $this->file );
|
42 |
-
$this->plugin_url = plugin_dir_url ( $this->file );
|
43 |
$this->lang_dir = trailingslashit( $this->plugin_dir . 'languages' );
|
44 |
$this->domain = 'wp-job-manager-locations';
|
45 |
|
@@ -69,6 +69,7 @@ class Astoundify_Job_Manager_Regions {
|
|
69 |
private function setup_actions() {
|
70 |
add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
|
71 |
|
|
|
72 |
add_filter( 'job_manager_settings', array( $this, 'job_manager_settings' ) );
|
73 |
|
74 |
add_filter( 'job_manager_output_jobs_defaults', array( $this, 'job_manager_output_jobs_defaults' ) );
|
@@ -76,6 +77,13 @@ class Astoundify_Job_Manager_Regions {
|
|
76 |
add_filter( 'job_manager_get_listings_args', array( $this, 'job_manager_get_listings_args' ) );
|
77 |
|
78 |
add_filter( 'job_feed_args', array( $this, 'job_feed_args' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
}
|
80 |
|
81 |
/**
|
@@ -85,13 +93,42 @@ class Astoundify_Job_Manager_Regions {
|
|
85 |
*
|
86 |
* @return void
|
87 |
*/
|
88 |
-
public function job_manager_settings($settings) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
$settings[ 'job_listings' ][1][] = array(
|
90 |
'name' => 'job_manager_regions_filter',
|
91 |
'std' => '0',
|
92 |
-
'label' => __( '
|
93 |
-
'cb_label' => __( '
|
94 |
-
'desc' => __( 'Use a dropdown instead of a text input.', 'wp-job-manager-locations' ),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
'type' => 'checkbox'
|
96 |
);
|
97 |
|
@@ -121,6 +158,23 @@ class Astoundify_Job_Manager_Regions {
|
|
121 |
return $defaults;
|
122 |
}
|
123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
public function job_manager_get_listings( $query_args, $args ) {
|
125 |
$params = array();
|
126 |
|
@@ -181,6 +235,65 @@ class Astoundify_Job_Manager_Regions {
|
|
181 |
return $query_args;
|
182 |
}
|
183 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
/**
|
185 |
* Filter the AJAX request to set the search location to null if a region
|
186 |
* is being passed as well.
|
@@ -216,6 +329,18 @@ class Astoundify_Job_Manager_Regions {
|
|
216 |
return $text;
|
217 |
}
|
218 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
/**
|
220 |
* Filter the AJAX request to update the RSS feed URL.
|
221 |
*/
|
5 |
* Description: Create predefined regions/locations that job submissions can associate themselves with.
|
6 |
* Author: Astoundify
|
7 |
* Author URI: http://astoundify.com
|
8 |
+
* Version: 1.11.0
|
9 |
* Text Domain: wp-job-manager-locations
|
10 |
*/
|
11 |
|
39 |
$this->file = __FILE__;
|
40 |
$this->basename = plugin_basename( $this->file );
|
41 |
$this->plugin_dir = plugin_dir_path( $this->file );
|
42 |
+
$this->plugin_url = set_url_scheme( plugin_dir_url ( $this->file ), is_ssl() ? 'https' : 'http' );
|
43 |
$this->lang_dir = trailingslashit( $this->plugin_dir . 'languages' );
|
44 |
$this->domain = 'wp-job-manager-locations';
|
45 |
|
69 |
private function setup_actions() {
|
70 |
add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
|
71 |
|
72 |
+
/* Job Manager */
|
73 |
add_filter( 'job_manager_settings', array( $this, 'job_manager_settings' ) );
|
74 |
|
75 |
add_filter( 'job_manager_output_jobs_defaults', array( $this, 'job_manager_output_jobs_defaults' ) );
|
77 |
add_filter( 'job_manager_get_listings_args', array( $this, 'job_manager_get_listings_args' ) );
|
78 |
|
79 |
add_filter( 'job_feed_args', array( $this, 'job_feed_args' ) );
|
80 |
+
|
81 |
+
/* Resumes */
|
82 |
+
add_filter( 'resume_manager_settings', array( $this, 'resume_manager_settings' ) );
|
83 |
+
|
84 |
+
add_filter( 'resume_manager_output_resumes_defaults', array( $this, 'resume_manager_output_resumes_defaults' ) );
|
85 |
+
add_filter( 'resume_manager_get_resumes', array( $this, 'resume_manager_get_resumes' ), 10, 2 );
|
86 |
+
add_filter( 'resume_manager_get_resumes_args', array( $this, 'job_manager_get_listings_args' ) );
|
87 |
}
|
88 |
|
89 |
/**
|
93 |
*
|
94 |
* @return void
|
95 |
*/
|
96 |
+
public function job_manager_settings( $settings ) {
|
97 |
+
$settings[ 'job_listings' ][1][] = array(
|
98 |
+
'name' => 'job_manager_enable_regions_filter',
|
99 |
+
'std' => '1',
|
100 |
+
'label' => __( 'Filter Location Display', 'wp-job-manager-locations' ),
|
101 |
+
'cb_label' => __( 'Display Region', 'wp-job-manager-locations' ),
|
102 |
+
'desc' => __( 'Replace the entered address with the selected region on output.', 'wp-job-manager-locations' ),
|
103 |
+
'type' => 'checkbox'
|
104 |
+
);
|
105 |
$settings[ 'job_listings' ][1][] = array(
|
106 |
'name' => 'job_manager_regions_filter',
|
107 |
'std' => '0',
|
108 |
+
'label' => __( 'Search by Region', 'wp-job-manager-locations' ),
|
109 |
+
'cb_label' => __( 'Search by Region', 'wp-job-manager-locations' ),
|
110 |
+
'desc' => __( 'Use a dropdown of defined regions instead of a text input. Disables radius search.', 'wp-job-manager-locations' ),
|
111 |
+
'type' => 'checkbox'
|
112 |
+
);
|
113 |
+
|
114 |
+
return $settings;
|
115 |
+
}
|
116 |
+
|
117 |
+
public function resume_manager_settings( $settings ) {
|
118 |
+
$settings[ 'resume_listings' ][1][] = array(
|
119 |
+
'name' => 'resume_manager_enable_regions_filter',
|
120 |
+
'std' => '1',
|
121 |
+
'label' => __( 'Filter Location Display', 'wp-job-manager-locations' ),
|
122 |
+
'cb_label' => __( 'Display Region', 'wp-job-manager-locations' ),
|
123 |
+
'desc' => __( 'Replace the entered address with the selected region on output.', 'wp-job-manager-locations' ),
|
124 |
+
'type' => 'checkbox'
|
125 |
+
);
|
126 |
+
$settings[ 'resume_listings' ][1][] = array(
|
127 |
+
'name' => 'resume_manager_regions_filter',
|
128 |
+
'std' => '0',
|
129 |
+
'label' => __( 'Search by Region', 'wp-job-manager-locations' ),
|
130 |
+
'cb_label' => __( 'Search by Region', 'wp-job-manager-locations' ),
|
131 |
+
'desc' => __( 'Use a dropdown of defined regions instead of a text input. Disables radius search.', 'wp-job-manager-locations' ),
|
132 |
'type' => 'checkbox'
|
133 |
);
|
134 |
|
158 |
return $defaults;
|
159 |
}
|
160 |
|
161 |
+
public function resume_manager_output_resumes_defaults( $defaults ) {
|
162 |
+
$defaults[ 'selected_region' ] = '';
|
163 |
+
|
164 |
+
if ( is_tax( 'resume_region' ) ) {
|
165 |
+
$type = get_queried_object();
|
166 |
+
|
167 |
+
if ( ! $type ) {
|
168 |
+
return $defaults;
|
169 |
+
}
|
170 |
+
|
171 |
+
$defaults[ 'show_categories' ] = true;
|
172 |
+
$defaults[ 'selected_region' ] = $type->term_id;
|
173 |
+
}
|
174 |
+
|
175 |
+
return $defaults;
|
176 |
+
}
|
177 |
+
|
178 |
public function job_manager_get_listings( $query_args, $args ) {
|
179 |
$params = array();
|
180 |
|
235 |
return $query_args;
|
236 |
}
|
237 |
|
238 |
+
public function resume_manager_get_resumes( $query_args, $args ) {
|
239 |
+
$params = array();
|
240 |
+
|
241 |
+
if ( isset( $_REQUEST[ 'form_data' ] ) ) {
|
242 |
+
|
243 |
+
parse_str( $_REQUEST[ 'form_data' ], $params );
|
244 |
+
|
245 |
+
if ( isset( $params[ 'search_region' ] ) && 0 != $params[ 'search_region' ] ) {
|
246 |
+
$region = $params[ 'search_region' ];
|
247 |
+
|
248 |
+
if ( is_int( $region ) ) {
|
249 |
+
$region = array( $region );
|
250 |
+
}
|
251 |
+
|
252 |
+
$query_args[ 'tax_query' ][] = array(
|
253 |
+
'taxonomy' => 'resume_region',
|
254 |
+
'field' => 'id',
|
255 |
+
'terms' => $region,
|
256 |
+
'operator' => 'IN'
|
257 |
+
);
|
258 |
+
|
259 |
+
add_filter( 'resume_manager_get_resumes_custom_filter', '__return_true' );
|
260 |
+
add_filter( 'resume_manager_get_resumes_custom_filter_text', array( $this, 'resume_custom_filter_text' ) );
|
261 |
+
}
|
262 |
+
|
263 |
+
} elseif ( isset( $_GET[ 'selected_region' ] ) ) {
|
264 |
+
|
265 |
+
$region = $_GET[ 'selected_region' ];
|
266 |
+
|
267 |
+
if ( is_int( $region ) ) {
|
268 |
+
$region = array( $region );
|
269 |
+
}
|
270 |
+
|
271 |
+
$query_args[ 'tax_query' ][] = array(
|
272 |
+
'taxonomy' => 'resume_region',
|
273 |
+
'field' => 'id',
|
274 |
+
'terms' => $region,
|
275 |
+
'operator' => 'IN'
|
276 |
+
);
|
277 |
+
|
278 |
+
} elseif( isset( $args['search_region'] ) ) { // WPJM Alerts support
|
279 |
+
$region = $args[ 'search_region' ];
|
280 |
+
|
281 |
+
if ( is_array( $region ) && empty( $region ) ) {
|
282 |
+
return $query_args;
|
283 |
+
}
|
284 |
+
|
285 |
+
$query_args[ 'tax_query' ][] = array(
|
286 |
+
'taxonomy' => 'resume_region',
|
287 |
+
'field' => 'id',
|
288 |
+
'terms' => $region,
|
289 |
+
'operator' => 'IN'
|
290 |
+
);
|
291 |
+
|
292 |
+
}
|
293 |
+
|
294 |
+
return $query_args;
|
295 |
+
}
|
296 |
+
|
297 |
/**
|
298 |
* Filter the AJAX request to set the search location to null if a region
|
299 |
* is being passed as well.
|
329 |
return $text;
|
330 |
}
|
331 |
|
332 |
+
public function resume_custom_filter_text( $text ) {
|
333 |
+
$params = array();
|
334 |
+
|
335 |
+
parse_str( $_REQUEST[ 'form_data' ], $params );
|
336 |
+
|
337 |
+
$term = get_term( $params[ 'search_region' ], 'resume_region' );
|
338 |
+
|
339 |
+
$text .= sprintf( ' ' . __( 'in %s', 'wp-job-manager-locations' ) . ' ', $term->name );
|
340 |
+
|
341 |
+
return $text;
|
342 |
+
}
|
343 |
+
|
344 |
/**
|
345 |
* Filter the AJAX request to update the RSS feed URL.
|
346 |
*/
|