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

WP Job Manager - Applications - Job Dashboard Shows Application Forms from All Languages #2868

Open
nicolasviallet opened this issue Jan 17, 2025 · 1 comment

Comments

@nicolasviallet
Copy link

nicolasviallet commented Jan 17, 2025

Is your feature request related to a problem? Please describe

When using WPML with the Applications add-on of WP Job Manager, the Job Dashboard incorrectly displays application forms from all languages, instead of showing only the forms in the current language. This affects the job edit form and creates confusion for users.

Describe the solution you'd like

  • Open the …/wp-content/plugins/wp-job-manager-applications/includes/wp-job-manager-applications-functions.php file.
  • Look for line 302.
  • Replace:
function get_application_forms() {
    $posts = new WP_Query(
        array(
            'post_type'        => 'job_application_form',
            'posts_per_page'   => - 1,
            'suppress_filters' => true,
            'orderby'          => 'title',
            'order'            => 'ASC',
        )
    );
 
    $default_form = WP_Job_Manager_Applications_Default_Form::get_default_form();
 
    if ( $posts->post_count <= 1 ) {
        return null;
    }
    $application_forms = [];
 
    if ( array_key_exists( 'ID', $default_form ) ) {
        $application_forms[ $default_form['ID'] ] = $default_form['post_title'];
    }
 
    foreach ( $posts->posts as $post ) {
        $application_forms[ $post->ID ] = $post->post_title;
    }
    return apply_filters( 'job_application_forms', $application_forms );
}
  • With:
// WPML Workaround for compsupp-7797
function get_application_forms() {
    $posts = new WP_Query(
        array(
            'post_type'        => 'job_application_form',
            'posts_per_page'   => - 1,
            'suppress_filters' => false, // replace true with false
            'orderby'          => 'title',
            'order'            => 'ASC',
        )
    );
 
    $default_form = WP_Job_Manager_Applications_Default_Form::get_default_form();
 
    if ( $posts->post_count < 1 ) { // replace <= with <
        return null;
    }
    $application_forms = [];
  /* comment out this part if you don't want to see the default form in other languages
    if ( array_key_exists( 'ID', $default_form ) ) {
        $application_forms[ $default_form['ID'] ] = $default_form['post_title'];
    }*/
 
    foreach ( $posts->posts as $post ) {
        $application_forms[ $post->ID ] = $post->post_title;
    }
    return apply_filters( 'job_application_forms', $application_forms );
}
@nicolasviallet
Copy link
Author

The following change also needs to be made.

  • Open the …/wp-job-manager-applications/includes/class-wp-job-manager-applications-apply.php file.
  • Look for line 250.
  • Replace:
$args         = apply_filters(
    'resume_manager_get_application_form_resumes_args',
    [
        'post_type'           => 'resume',
        'post_status'         => [ 'publish' ],
        'ignore_sticky_posts' => 1,
        'posts_per_page'      => -1,
        'orderby'             => 'date',
        'order'               => 'desc',
        'author'              => get_current_user_id(),
    ]
);
  • With:
// WPML Workaround for compsupp-7819
$args         = apply_filters(
    'resume_manager_get_application_form_resumes_args',
    [
        'post_type'           => 'resume',
        'post_status'         => [ 'publish' ],
        'ignore_sticky_posts' => 1,
        'posts_per_page'      => -1,
        'orderby'             => 'date',
        'order'               => 'desc',
        'author'              => get_current_user_id(),
        'suppress_filters'    => false, // add this line
    ]
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant