Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a filter that disables promoted jobs #2808

Merged
merged 2 commits into from
Apr 23, 2024
Merged

Conversation

gikaragia
Copy link
Contributor

@gikaragia gikaragia commented Apr 19, 2024

Part of https://github.com/Automattic/greenhouse/issues/2085

Changes Proposed in this Pull Request

  • Adds a filter that disables promoted jobs functionality.
  • We can merge this now and set the default value to false whenever we want to disable it.

Testing Instructions

  • Add the snippet add_filter('job_manager_enable_promoted_jobs', '__return_false' );
  • Go through admin and observe that there is no promoted jobs functionality and no console errors:
    * Delete wp_job_manager_dismissed_notices both from the options table and the users table to reset notices
    * Publish a new job and observe that no popup is shown
    * Go to job listings and observe that no Promote button exists
  • Delete the snippet, repeat the steps, and observe that promote functionality works.

Plugin build for 537bde6
📦 Download plugin zip
▶️ Open in playground

@gikaragia gikaragia requested a review from a team April 19, 2024 15:31
@gikaragia gikaragia self-assigned this Apr 22, 2024
Copy link
Contributor

@yscik yscik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just small things

includes/admin/class-wp-job-manager-admin.php Outdated Show resolved Hide resolved
/**
* Documented in class-wp-job-manager.php
*/
$this->are_promoted_jobs_enabled = apply_filters( 'job_manager_enable_promoted_jobs', true );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking it's fine to just call the filter in multiple places, no need for a new class property for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I am not sure I agree with this one. It will be easier to update when we change the default value. Also we will probably need to repeat the comments too if we want all filters to be documented.

@gikaragia gikaragia requested a review from yscik April 23, 2024 11:02
Copy link
Contributor

@yscik yscik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@gikaragia gikaragia merged commit 8684205 into trunk Apr 23, 2024
11 checks passed
@gikaragia gikaragia deleted the change/promoted-job-filter branch April 23, 2024 13:05
@yscik yscik added this to the 2.3.0 milestone Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants