• Resolved Chris

    (@lamordnt)


    How can I prevent the application field from automatically filling in the current user’s email address? In the admin it is putting my email address as the one to use for applications and I am afraid I am going to forget to change it when creating a job. Can I disable this from happening automatically?
    Thanks!

    https://wordpress.org/plugins/wp-job-manager/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Chris

    (@lamordnt)

    I found where I can remove the value from being automatically inserted however if i update the plugin it will be overwritten.

    In the file “class-wp-job-manager-writepanels.php” on line 40 it is adding a value to the application field. If I delete all of line 40 it takes care of the problem and stops automatically inserting the email address.

    The code I am deleting is:
    'value' => metadata_exists( 'post', $post->ID, '_application' ) ? get_post_meta( $post->ID, '_application', true ) : $current_user->user_email,

    Is there a way to achieve this in my themes functions.php file so that i do not have to make this change to the plugin every time there is an update?

    Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    If you look at that code you’ll see its all wrapped in a filter. You can use the filter to adjust the value from a custom plugin/theme functions.php

    Thread Starter Chris

    (@lamordnt)

    Thanks for steering me in the right direction. I found documentation on the WP Job Manager site on how to do this here: https://wpjobmanager.com/document/editing-job-submission-fields/#section-2

    For anyone else trying to achieve this you can just copy this code below and dump it into your functions.php file and it will stop auto-filling your email address into the application field:

    add_filter( 'job_manager_job_listing_data_fields', 'remove_email_job_manager_job_listing_data_fields' );
    function remove_email_job_manager_job_listing_data_fields( $fields ) {
        $fields['_application']['value'] = "";
        return $fields;
    }
    Plugin Contributor Adam Heckler

    (@adamkheckler)

    Glad to hear you got things working!

    Let me know if there’s anything else you need. 🙂 Thanks!

    Thread Starter Chris

    (@lamordnt)

    OK so this started to create a problem for me where it would not save any of the data I put into the apply field so I had to adjust the code like so:

    // Add filter to prevent job manager from automatically insterting email address into field in the admin area
    add_filter( 'job_manager_job_listing_data_fields', 'remove_email_job_manager_job_listing_data_fields' );
    function remove_email_job_manager_job_listing_data_fields( $fields ) {
        $fields['_application']['placeholder'] = "Apply link or URL";
        return $fields;
    }

    So far this seems to be working better.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Prevent Application from Automatically using current users email address’ is closed to new replies.