From 63796e0ea3d0b9a9996c682c56138715fb250f16 Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 11 Nov 2023 10:10:12 +0100 Subject: [PATCH 01/16] Add Salary Range Features to WPJM Template --- wp-job-manager-template.php | 48 +++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/wp-job-manager-template.php b/wp-job-manager-template.php index 0c7665e5a..93d0e7417 100644 --- a/wp-job-manager-template.php +++ b/wp-job-manager-template.php @@ -418,10 +418,19 @@ function wpjm_get_job_listing_structured_data( $post = null ) { } } - $salary = get_the_job_salary( $post ); - $currency = get_the_job_salary_currency( $post ); - $unit = get_the_job_salary_unit( $post ); - if ( ! empty( $salary ) ) { + $salary = get_the_job_salary( $post ); + $salary_max = get_the_job_salary_max( $post ); + $currency = get_the_job_salary_currency( $post ); + $unit = get_the_job_salary_unit( $post ); + if ( ! empty( $salary_max ) ) { + $data['baseSalary'] = []; + $data['baseSalary']['@type'] = 'MonetaryAmount'; + $data['baseSalary']['currency'] = $currency; + $data['baseSalary']['value']['@type'] = 'QuantitativeValue'; + $data['baseSalary']['value']['minValue'] = $salary; + $data['baseSalary']['value']['maxValue'] = $salary_max; + $data['baseSalary']['value']['unitText'] = $unit; + } elseif ( ! empty( $salary ) ) { $data['baseSalary'] = []; $data['baseSalary']['@type'] = 'MonetaryAmount'; $data['baseSalary']['currency'] = $currency; @@ -1298,6 +1307,33 @@ function get_the_job_salary( $post = null ) { return apply_filters( 'the_job_salary', $job_salary, $post ); } +/** + * Gets the max job salary. + * + * @since 1.37.0 + * @param int|WP_Post|null $post (default: null). + * @return string|null + */ +function get_the_job_salary_max( $post = null ) { + $post = get_post( $post ); + if ( ! $post || 'job_listing' !== $post->post_type ) { + return; + } + + $job_salary_max = $post->_job_salary_max; + + /** + * Filter the returned job salary. + * + * @since 1.36.0 + * + * @param string $job_salary + * @param WP_Post $post + */ + return apply_filters( 'the_job_salary_max', $job_salary_max, $post ); +} + + /** * Displays or retrieves the job salary with optional content. * @@ -1311,6 +1347,7 @@ function get_the_job_salary( $post = null ) { function the_job_salary( $before = '', $after = '', $echo = true, $post = null ) { $post = get_post( $post ); $salary = get_the_job_salary( $post ); + $salarymax = get_the_job_salary_max( $post ); $currency = get_the_job_salary_currency( $post ); $unit = get_the_job_salary_unit_display_text( $post ); @@ -1319,6 +1356,9 @@ function the_job_salary( $before = '', $after = '', $echo = true, $post = null ) } $job_salary = $before . $salary . ' ' . $currency; + if ( ! empty( $salarymax ) ) { + $job_salary .= ' - ' . $salarymax . ' ' . $currency; + } if ( ! empty( $unit ) ) { $job_salary .= ' / ' . $unit; } From e19e6d315fbcfcb6a82f44a275fbfdf67649fef2 Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 11 Nov 2023 10:37:07 +0100 Subject: [PATCH 02/16] add max salary to promoted jobs api --- .../promoted-jobs/class-wp-job-manager-promoted-jobs-api.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/promoted-jobs/class-wp-job-manager-promoted-jobs-api.php b/includes/promoted-jobs/class-wp-job-manager-promoted-jobs-api.php index 6e5168e19..58d91c130 100644 --- a/includes/promoted-jobs/class-wp-job-manager-promoted-jobs-api.php +++ b/includes/promoted-jobs/class-wp-job-manager-promoted-jobs-api.php @@ -243,6 +243,7 @@ private function prepare_item_for_response( WP_Post $item ) { 'job_type' => $terms_array, 'salary' => [ 'amount' => get_post_meta( $item->ID, '_job_salary', true ), + 'amountmax'=> get_post_meta( $item->ID, '_job_salary_max', true ), 'currency' => get_the_job_salary_currency( $item ), 'unit' => get_the_job_salary_unit_display_text( $item ), ], From e8cb9c812368d0d7e259b40b85613e10d89e883c Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 11 Nov 2023 10:38:34 +0100 Subject: [PATCH 03/16] add max salary range to unset at form --- includes/forms/class-wp-job-manager-form-submit-job.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/forms/class-wp-job-manager-form-submit-job.php b/includes/forms/class-wp-job-manager-form-submit-job.php index b76593797..f240bf55e 100644 --- a/includes/forms/class-wp-job-manager-form-submit-job.php +++ b/includes/forms/class-wp-job-manager-form-submit-job.php @@ -371,7 +371,7 @@ public function init_fields() { unset( $this->fields['job']['job_salary_unit'] ); } } else { - unset( $this->fields['job']['job_salary'], $this->fields['job']['job_salary_currency'], $this->fields['job']['job_salary_unit'] ); + unset( $this->fields['job']['job_salary'], $this->fields['job']['job_salary_max'], $this->fields['job']['job_salary_currency'], $this->fields['job']['job_salary_unit'] ); } if ( ! get_option( 'job_manager_enable_remote_position' ) ) { unset( $this->fields['job']['remote_position'] ); From 78a54d4daa6b80793bee70d32a5bb3a20dc98aec Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 11 Nov 2023 10:41:58 +0100 Subject: [PATCH 04/16] add salaryrange field to posttype --- includes/class-wp-job-manager-post-types.php | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/includes/class-wp-job-manager-post-types.php b/includes/class-wp-job-manager-post-types.php index af894afcf..1b3288f9b 100644 --- a/includes/class-wp-job-manager-post-types.php +++ b/includes/class-wp-job-manager-post-types.php @@ -700,6 +700,7 @@ public function job_feed_item() { $company = get_the_company_name( $post_id ); $job_types = wpjm_get_the_job_types( $post_id ); $salary = get_the_job_salary( $post_id ); + $salarymax = get_the_job_salary_max( $post_id ); if ( $location ) { echo '\n"; @@ -714,6 +715,9 @@ public function job_feed_item() { if ( $salary ) { echo '\n"; } + if ( $salarymax ) { + echo '\n"; + } /** * Fires at the end of each job RSS feed item. @@ -1605,7 +1609,7 @@ public static function get_job_listing_fields() { 'show_in_rest' => true, ], '_job_salary' => [ - 'label' => __( 'Salary', 'wp-job-manager' ), + 'label' => __( 'Salary / Salary (min)', 'wp-job-manager' ), 'type' => 'text', 'placeholder' => __( 'e.g. 20000', 'wp-job-manager' ), 'priority' => 13, @@ -1614,12 +1618,22 @@ public static function get_job_listing_fields() { 'show_in_admin' => (bool) get_option( 'job_manager_enable_salary' ), 'show_in_rest' => true, ], + '_job_salary_max' => [ + 'label' => __( 'Salary (max)', 'wp-job-manager' ), + 'type' => 'text', + 'placeholder' => __( 'e.g. 25000', 'wp-job-manager' ), + 'priority' => 14, + 'description' => __( 'Add a max salary field, this field is optional.', 'wp-job-manager' ), + 'data_type' => 'string', + 'show_in_admin' => (bool) get_option( 'job_manager_enable_salary' ), + 'show_in_rest' => true, + ], '_job_salary_currency' => [ 'label' => __( 'Salary Currency', 'wp-job-manager' ), 'type' => 'text', 'data_type' => 'string', 'placeholder' => __( 'e.g. USD', 'wp-job-manager' ), - 'priority' => 14, + 'priority' => 15, 'description' => __( 'Add a salary currency, this field is optional. Leave it empty to use the default salary currency.', 'wp-job-manager' ), 'default' => '', 'show_in_admin' => get_option( 'job_manager_enable_salary' ) && get_option( 'job_manager_enable_salary_currency' ), @@ -1630,7 +1644,7 @@ public static function get_job_listing_fields() { 'type' => 'select', 'data_type' => 'string', 'options' => job_manager_get_salary_unit_options(), - 'priority' => 15, + 'priority' => 16, 'description' => __( 'Add a salary period unit, this field is optional. Leave it empty to use the default salary unit, if one is defined.', 'wp-job-manager' ), 'default' => '', 'show_in_admin' => get_option( 'job_manager_enable_salary' ) && get_option( 'job_manager_enable_salary_unit' ), From e05baca2b5d2dbb162e551de9dcb807bf5e15443 Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 11 Nov 2023 20:31:49 +0100 Subject: [PATCH 05/16] adjust template for salary range / job sumission fixes --- wp-job-manager-template.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wp-job-manager-template.php b/wp-job-manager-template.php index 93d0e7417..c463e7101 100644 --- a/wp-job-manager-template.php +++ b/wp-job-manager-template.php @@ -1323,11 +1323,11 @@ function get_the_job_salary_max( $post = null ) { $job_salary_max = $post->_job_salary_max; /** - * Filter the returned job salary. + * Filter the returned max job salary. * * @since 1.36.0 * - * @param string $job_salary + * @param string $job_salary_max * @param WP_Post $post */ return apply_filters( 'the_job_salary_max', $job_salary_max, $post ); @@ -1372,11 +1372,12 @@ function the_job_salary( $before = '', $after = '', $echo = true, $post = null ) * @param WP_Post $post * @param string $before * @param string $salary + * @param string $salarymax * @param string $currency * @param string $unit * @param string $after */ - $job_salary = apply_filters( 'the_job_salary_message', $job_salary, $post, $before, $salary, $currency, $unit, $after ); + $job_salary = apply_filters( 'the_job_salary_message', $job_salary, $post, $before, $salary, $currency, $salarymax, $unit, $after ); if ( $echo ) { echo esc_html( $job_salary ); From 5f2a42ba1dabcba950c682b4369e89f1360862ca Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 11 Nov 2023 20:34:02 +0100 Subject: [PATCH 06/16] allow salary range also on job submit form --- .../forms/class-wp-job-manager-form-submit-job.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/includes/forms/class-wp-job-manager-form-submit-job.php b/includes/forms/class-wp-job-manager-form-submit-job.php index f240bf55e..b1e8a397c 100644 --- a/includes/forms/class-wp-job-manager-form-submit-job.php +++ b/includes/forms/class-wp-job-manager-form-submit-job.php @@ -276,19 +276,26 @@ public function init_fields() { 'priority' => 7, ], 'job_salary' => [ - 'label' => __( 'Salary', 'wp-job-manager' ), + 'label' => __( 'Salary / Salary (min)', 'wp-job-manager' ), 'type' => 'text', 'required' => false, 'placeholder' => __( 'e.g. 20000', 'wp-job-manager' ), 'priority' => 8, ], + 'job_salary_max' => [ + 'label' => __( 'Salary (max)', 'wp-job-manager' ), + 'type' => 'text', + 'required' => false, + 'placeholder' => __( 'e.g. 25000', 'wp-job-manager' ), + 'priority' => 9, + ], 'job_salary_currency' => [ 'label' => __( 'Salary Currency', 'wp-job-manager' ), 'type' => 'text', 'required' => false, 'placeholder' => __( 'e.g. USD', 'wp-job-manager' ), 'description' => __( 'Add a salary currency, this field is optional. Leave it empty to use the default salary currency.', 'wp-job-manager' ), - 'priority' => 9, + 'priority' => 10, ], 'job_salary_unit' => [ 'label' => __( 'Salary Unit', 'wp-job-manager' ), @@ -296,7 +303,7 @@ public function init_fields() { 'options' => job_manager_get_salary_unit_options(), 'description' => __( 'Add a salary period unit, this field is optional. Leave it empty to use the default salary unit, if one is defined.', 'wp-job-manager' ), 'required' => false, - 'priority' => 10, + 'priority' => 11, ], ], 'company' => [ From 035741fd410ca565f994fb07db83701fa648337d Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 11 Nov 2023 22:22:41 +0100 Subject: [PATCH 07/16] fix lint errors form-submit-job.php --- .../forms/class-wp-job-manager-form-submit-job.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/includes/forms/class-wp-job-manager-form-submit-job.php b/includes/forms/class-wp-job-manager-form-submit-job.php index b1e8a397c..f131fdcc8 100644 --- a/includes/forms/class-wp-job-manager-form-submit-job.php +++ b/includes/forms/class-wp-job-manager-form-submit-job.php @@ -282,12 +282,12 @@ public function init_fields() { 'placeholder' => __( 'e.g. 20000', 'wp-job-manager' ), 'priority' => 8, ], - 'job_salary_max' => [ - 'label' => __( 'Salary (max)', 'wp-job-manager' ), - 'type' => 'text', - 'required' => false, - 'placeholder' => __( 'e.g. 25000', 'wp-job-manager' ), - 'priority' => 9, + 'job_salary_max' => [ + 'label' => __( 'Salary (max)', 'wp-job-manager' ), + 'type' => 'text', + 'required' => false, + 'placeholder' => __( 'e.g. 25000', 'wp-job-manager' ), + 'priority' => 9, ], 'job_salary_currency' => [ 'label' => __( 'Salary Currency', 'wp-job-manager' ), From 7937d72e9476ee03416aaf580bdf08875aa1cbec Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 11 Nov 2023 22:23:22 +0100 Subject: [PATCH 08/16] fix lint errors --- includes/class-wp-job-manager-post-types.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-wp-job-manager-post-types.php b/includes/class-wp-job-manager-post-types.php index 1b3288f9b..8169f4e0f 100644 --- a/includes/class-wp-job-manager-post-types.php +++ b/includes/class-wp-job-manager-post-types.php @@ -1618,7 +1618,7 @@ public static function get_job_listing_fields() { 'show_in_admin' => (bool) get_option( 'job_manager_enable_salary' ), 'show_in_rest' => true, ], - '_job_salary_max' => [ + '_job_salary_max' => [ 'label' => __( 'Salary (max)', 'wp-job-manager' ), 'type' => 'text', 'placeholder' => __( 'e.g. 25000', 'wp-job-manager' ), From c223e59013932759c9cf4ad1870b99e067bd0d50 Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 11 Nov 2023 22:24:17 +0100 Subject: [PATCH 09/16] fix lint error --- .../class-wp-job-manager-promoted-jobs-api.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/promoted-jobs/class-wp-job-manager-promoted-jobs-api.php b/includes/promoted-jobs/class-wp-job-manager-promoted-jobs-api.php index 58d91c130..c7f19cfe4 100644 --- a/includes/promoted-jobs/class-wp-job-manager-promoted-jobs-api.php +++ b/includes/promoted-jobs/class-wp-job-manager-promoted-jobs-api.php @@ -242,10 +242,10 @@ private function prepare_item_for_response( WP_Post $item ) { 'is_remote' => (bool) get_post_meta( $item->ID, '_remote_position', true ), 'job_type' => $terms_array, 'salary' => [ - 'amount' => get_post_meta( $item->ID, '_job_salary', true ), - 'amountmax'=> get_post_meta( $item->ID, '_job_salary_max', true ), - 'currency' => get_the_job_salary_currency( $item ), - 'unit' => get_the_job_salary_unit_display_text( $item ), + 'amount' => get_post_meta( $item->ID, '_job_salary', true ), + 'amountmax' => get_post_meta( $item->ID, '_job_salary_max', true ), + 'currency' => get_the_job_salary_currency( $item ), + 'unit' => get_the_job_salary_unit_display_text( $item ), ], ]; } From 31f86864abf8fd55078543dc9667c23d09752ccf Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 11 Nov 2023 22:28:04 +0100 Subject: [PATCH 10/16] fix lint --- .../class-wp-job-manager-promoted-jobs-api.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/promoted-jobs/class-wp-job-manager-promoted-jobs-api.php b/includes/promoted-jobs/class-wp-job-manager-promoted-jobs-api.php index c7f19cfe4..d88226380 100644 --- a/includes/promoted-jobs/class-wp-job-manager-promoted-jobs-api.php +++ b/includes/promoted-jobs/class-wp-job-manager-promoted-jobs-api.php @@ -242,10 +242,10 @@ private function prepare_item_for_response( WP_Post $item ) { 'is_remote' => (bool) get_post_meta( $item->ID, '_remote_position', true ), 'job_type' => $terms_array, 'salary' => [ - 'amount' => get_post_meta( $item->ID, '_job_salary', true ), - 'amountmax' => get_post_meta( $item->ID, '_job_salary_max', true ), - 'currency' => get_the_job_salary_currency( $item ), - 'unit' => get_the_job_salary_unit_display_text( $item ), + 'amount' => get_post_meta( $item->ID, '_job_salary', true ), + 'amountmax' => get_post_meta( $item->ID, '_job_salary_max', true ), + 'currency' => get_the_job_salary_currency( $item ), + 'unit' => get_the_job_salary_unit_display_text( $item ), ], ]; } From fe8866067e39ed9040fda4d268aa7da9ece86220 Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 11 Nov 2023 22:30:48 +0100 Subject: [PATCH 11/16] finally fix jobs api lint --- .../class-wp-job-manager-promoted-jobs-api.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/promoted-jobs/class-wp-job-manager-promoted-jobs-api.php b/includes/promoted-jobs/class-wp-job-manager-promoted-jobs-api.php index d88226380..f128c3940 100644 --- a/includes/promoted-jobs/class-wp-job-manager-promoted-jobs-api.php +++ b/includes/promoted-jobs/class-wp-job-manager-promoted-jobs-api.php @@ -242,10 +242,10 @@ private function prepare_item_for_response( WP_Post $item ) { 'is_remote' => (bool) get_post_meta( $item->ID, '_remote_position', true ), 'job_type' => $terms_array, 'salary' => [ - 'amount' => get_post_meta( $item->ID, '_job_salary', true ), - 'amountmax' => get_post_meta( $item->ID, '_job_salary_max', true ), - 'currency' => get_the_job_salary_currency( $item ), - 'unit' => get_the_job_salary_unit_display_text( $item ), + 'amount' => get_post_meta( $item->ID, '_job_salary', true ), + 'amountmax' => get_post_meta( $item->ID, '_job_salary_max', true ), + 'currency' => get_the_job_salary_currency( $item ), + 'unit' => get_the_job_salary_unit_display_text( $item ), ], ]; } From 3345f2284e43bc6437fa8fd3149dd90588e19266 Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 11 Nov 2023 22:32:32 +0100 Subject: [PATCH 12/16] fix lint errors --- wp-job-manager-template.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/wp-job-manager-template.php b/wp-job-manager-template.php index c463e7101..10e3c7f70 100644 --- a/wp-job-manager-template.php +++ b/wp-job-manager-template.php @@ -418,10 +418,10 @@ function wpjm_get_job_listing_structured_data( $post = null ) { } } - $salary = get_the_job_salary( $post ); - $salary_max = get_the_job_salary_max( $post ); - $currency = get_the_job_salary_currency( $post ); - $unit = get_the_job_salary_unit( $post ); + $salary = get_the_job_salary( $post ); + $salary_max = get_the_job_salary_max( $post ); + $currency = get_the_job_salary_currency( $post ); + $unit = get_the_job_salary_unit( $post ); if ( ! empty( $salary_max ) ) { $data['baseSalary'] = []; $data['baseSalary']['@type'] = 'MonetaryAmount'; @@ -1345,11 +1345,11 @@ function get_the_job_salary_max( $post = null ) { * @return string|void */ function the_job_salary( $before = '', $after = '', $echo = true, $post = null ) { - $post = get_post( $post ); - $salary = get_the_job_salary( $post ); + $post = get_post( $post ); + $salary = get_the_job_salary( $post ); $salarymax = get_the_job_salary_max( $post ); - $currency = get_the_job_salary_currency( $post ); - $unit = get_the_job_salary_unit_display_text( $post ); + $currency = get_the_job_salary_currency( $post ); + $unit = get_the_job_salary_unit_display_text( $post ); if ( strlen( $salary ) === 0 ) { return; From afb3b91ecf73b74210b3e9fb9d89ca5d966d8d6a Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 11 Nov 2023 22:33:49 +0100 Subject: [PATCH 13/16] fix lint errors on class-wp-job-manager-post-types.php --- includes/class-wp-job-manager-post-types.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-wp-job-manager-post-types.php b/includes/class-wp-job-manager-post-types.php index 8169f4e0f..3a1d05c3b 100644 --- a/includes/class-wp-job-manager-post-types.php +++ b/includes/class-wp-job-manager-post-types.php @@ -1618,7 +1618,7 @@ public static function get_job_listing_fields() { 'show_in_admin' => (bool) get_option( 'job_manager_enable_salary' ), 'show_in_rest' => true, ], - '_job_salary_max' => [ + '_job_salary_max' => [ 'label' => __( 'Salary (max)', 'wp-job-manager' ), 'type' => 'text', 'placeholder' => __( 'e.g. 25000', 'wp-job-manager' ), From 47b476f269fc6a173e74daa211611e149bca4259 Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 11 Nov 2023 22:36:28 +0100 Subject: [PATCH 14/16] fix lint errors on last file --- .../forms/class-wp-job-manager-form-submit-job.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/includes/forms/class-wp-job-manager-form-submit-job.php b/includes/forms/class-wp-job-manager-form-submit-job.php index f131fdcc8..bd8628a3b 100644 --- a/includes/forms/class-wp-job-manager-form-submit-job.php +++ b/includes/forms/class-wp-job-manager-form-submit-job.php @@ -282,12 +282,12 @@ public function init_fields() { 'placeholder' => __( 'e.g. 20000', 'wp-job-manager' ), 'priority' => 8, ], - 'job_salary_max' => [ - 'label' => __( 'Salary (max)', 'wp-job-manager' ), - 'type' => 'text', - 'required' => false, - 'placeholder' => __( 'e.g. 25000', 'wp-job-manager' ), - 'priority' => 9, + 'job_salary_max' => [ + 'label' => __( 'Salary (max)', 'wp-job-manager' ), + 'type' => 'text', + 'required' => false, + 'placeholder' => __( 'e.g. 25000', 'wp-job-manager' ), + 'priority' => 9, ], 'job_salary_currency' => [ 'label' => __( 'Salary Currency', 'wp-job-manager' ), From 4edd9002a8858ead12bb52e1b4f92f6e19f1c2e7 Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 11 Nov 2023 22:47:10 +0100 Subject: [PATCH 15/16] add job_salary_max field to test class --- .../rest-api/test_class.wp-job-manager-job-listings.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/php/tests/includes/rest-api/test_class.wp-job-manager-job-listings.php b/tests/php/tests/includes/rest-api/test_class.wp-job-manager-job-listings.php index 8fc5c3763..d38cb22be 100644 --- a/tests/php/tests/includes/rest-api/test_class.wp-job-manager-job-listings.php +++ b/tests/php/tests/includes/rest-api/test_class.wp-job-manager-job-listings.php @@ -171,7 +171,7 @@ public function test_get_job_listings_success_guest() { * Tests to make sure public meta fields are exposed to guest users and private meta fields are hidden. */ public function test_guest_can_read_only_public_fields() { - $public_fields = [ '_job_location', '_application', '_company_name', '_company_website', '_company_tagline', '_company_twitter', '_company_video', '_filled', '_featured', '_remote_position', '_job_salary', '_job_salary_currency', '_job_salary_unit' ]; + $public_fields = [ '_job_location', '_application', '_company_name', '_company_website', '_company_tagline', '_company_twitter', '_company_video', '_filled', '_featured', '_remote_position', '_job_salary', '_job_salary_max', '_job_salary_currency', '_job_salary_unit' ]; $private_fields = [ '_job_expires' ]; $this->logout(); $post_id = $this->get_job_listing(); @@ -192,7 +192,7 @@ public function test_guest_can_read_only_public_fields() { } public function test_same_employer_read_access_to_private_meta_fields() { - $available_fields = [ '_job_location', '_application', '_company_name', '_company_website', '_company_tagline', '_company_twitter', '_company_video', '_filled', '_featured', '_job_expires', '_remote_position', '_job_salary', '_job_salary_currency', '_job_salary_unit' ]; + $available_fields = [ '_job_location', '_application', '_company_name', '_company_website', '_company_tagline', '_company_twitter', '_company_video', '_filled', '_featured', '_job_expires', '_remote_position', '_job_salary', '_job_salary_max', '_job_salary_currency', '_job_salary_unit' ]; $this->login_as_employer(); $post_id = $this->get_job_listing(); @@ -207,7 +207,7 @@ public function test_same_employer_read_access_to_private_meta_fields() { } public function test_different_employer_read_access_to_private_meta_fields() { - $public_fields = [ '_job_location', '_application', '_company_name', '_company_website', '_company_tagline', '_company_twitter', '_company_video', '_filled', '_featured', '_remote_position', '_job_salary', '_job_salary_currency', '_job_salary_unit' ]; + $public_fields = [ '_job_location', '_application', '_company_name', '_company_website', '_company_tagline', '_company_twitter', '_company_video', '_filled', '_featured', '_remote_position', '_job_salary', '_job_salary_max', '_job_salary_currency', '_job_salary_unit' ]; $private_fields = [ '_job_expires' ]; $this->login_as_employer(); $post_id = $this->get_job_listing(); From 5e35747682d00b54d7338f7c806d46f8457e12f4 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 14 Nov 2023 12:24:00 +0100 Subject: [PATCH 16/16] added argument in the end for backwards compatibility --- wp-job-manager-template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-job-manager-template.php b/wp-job-manager-template.php index 10e3c7f70..3572c81d9 100644 --- a/wp-job-manager-template.php +++ b/wp-job-manager-template.php @@ -1377,7 +1377,7 @@ function the_job_salary( $before = '', $after = '', $echo = true, $post = null ) * @param string $unit * @param string $after */ - $job_salary = apply_filters( 'the_job_salary_message', $job_salary, $post, $before, $salary, $currency, $salarymax, $unit, $after ); + $job_salary = apply_filters( 'the_job_salary_message', $job_salary, $post, $before, $salary, $currency, $unit, $after, $salarymax ); if ( $echo ) { echo esc_html( $job_salary );