• Resolved Jonnyirish

    (@jonnyirish)


    WP Install (your installed version) : 4.2.2
    Job Manager Installed (your installed version) : Version 0.7.23
    Website URL http://djonryan.com/QPTECH

    Hi Tom,

    I use a plugin called ‘WP All Import Pro’ to create jobs on my job board. The jobs all import fine except for one thing:

    The new jobs get created on the root of my domain rather than in the “/jobs/” folder.

    For example, if I create a job manually, the job will be created like “http://mydomain.com/jobs/name-of-job-post” …. and when I click on it to ‘view’ it via the settings page, it opens up and displays perfectly.

    However, when I pull in new jobs using the importer, the new jobs get created like “http://mydomain.com/name-of-job-post” (that is, the “/jobs” piece of the URL is not present).

    I understand that it’s not your responsibility to have a view on other plugins, but the Importer plugin’s author thought that maybe newly imported jobs, by default, are in an ‘archived’ state. He further suggested:

    ” … maybe reach out to the Job Manager plugin developer to check what type of data within the custom post type ‘Jobs’ is this information (archived / live) stored in. This could be custom fields, taxonomies or a specific field within the wp_posts table.”

    … So, wondering if there is code anywhere that causes imported jobs to be ‘archived’ by default. You see, when I simply click the edit link on a job that was created using the importer, and scroll down to the bottom of the page and click ‘Update Job’… the job then appears with the “/jobs” part in the URL !

    Thanks in advance for any guidance you can give me-

    Regards,
    Jon

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Thomas Townsend

    (@smb-dev)

    The issue is that our data is stored in arrays. Most importers can’s deal with that. You might give this a try – something we are looking into as well.

    Looks like they have custom add-ons that might work. If your handy with code and you wanted to build an add-on, we could post a link to share with users here.

    Hope this helps

    Thread Starter Jonnyirish

    (@jonnyirish)

    Hi Tom,

    The link you referenced is the importer that I’m using.

    I will try to figure it out. To get me started, would you be able to tell me what fires in your plugin when the ‘update jobs’ button is clicked?

    Cheers,
    jon

    Plugin Author Thomas Townsend

    (@smb-dev)

    Johnny let me take a look at specific reference and get back to you. Working on a release for the WE so may not be till late Sunday. Thanks

    Thread Starter Jonnyirish

    (@jonnyirish)

    Much appreciated Tom-

    Plugin Author Thomas Townsend

    (@smb-dev)

    Johhny,

    Here is what I have for you. It’s kind of complicated and you may have to delve into the two areas of the code that deal with this.

    When the button is pushed,

    JM function looks for an update to the DB via $listdisplay and looks for the array key that was associated with that DB entry to update that array.
    This starts about Line #121 (admin-jobs-settings.php)
    Will also need to look into (admin-jobs.php)

    What you have to remember is that each job ID may also be associated with an application. via

    “post_type=jobman_app&meta_key=job&meta_value=$job->ID&post_status=publish,private&numberposts=-1”

    That’s why it’s pretty near impossible to move jobs w/ importing the entire DB and why I specifically recommend culling of the Old DB beforehand, otherwise it can cause unknown issues.

    The array contains/attached meta data. So any given job ID is looking to connect with a given application and if it’s missing it can cause issues too, their are also custom Post ID’s you have to contend with.

    You can try running Debug Bar with Debug Bar Post Types and you can better identify the Arrays/Post Types

    Thread Starter Jonnyirish

    (@jonnyirish)

    Thanks for that Thomas. I’ll dig into it and reply back here when I have it figured out. I appreciate the responses –

    I imagine this will take me some time so by all means mark this topic as resolved while I go do some work.

    Rgds,
    Jonny

    Plugin Author Thomas Townsend

    (@smb-dev)

    Let me know if you need more assistance. support AT wp-jobmanager dot com

    Thread Starter Jonnyirish

    (@jonnyirish)

    Thomas,

    I have found an interesting situation in relation to my imported jobs showing with no ‘/jobs/’ piece in the URL on the ‘Job Manager: Jobs List’ page where we can view or edit or archive each job by selecting it.

    When I turn off my permalinks (they’re always set to/%postname%/) I can view the imported jobs when I click on ‘view’ in the jobs ‘Job Manager: Jobs List’ !! But, when I turn on my permalinks, I go back to the situation where the jobs aren’t viewable.

    This leads me to think that there may be a simpler solution to fix the issue I’m seeing. Any thoughts?

    Thread Starter Jonnyirish

    (@jonnyirish)

    Hi Thomas,

    Following some more research on this issue by comparing and contrasting posts that displayed versus posts that did not display (when view post is clicked), I’ve discovered something unusual with the one of the post meta.

    When a job is imported into jobman (using wp-all-import Pro), the job is added to the WP_POSTS table in the SQL Database with a POST_PARENT value = 0 (possibly from admin-jobs.php … approx line 575). So this is creating a permalink for the newly imported job in the form of http://example.com/the-name-of-the-job-here for each job when it’s imported.

    When I visit the SQL Database directly and I change the POST_PARENT value from 0 to 8 (will be a different value for different sites I expect) on a job record, the problem disappears when I revisit my WP installation.

    Would it be possible to (easily) update the plugin to address this issue?

    If not, you might be able to give me a few ideas on how I could workaround? Please not: My objective is to be able to import jobs into the plugin and not have to do any manual intervention once the jobs have imported into the JM plugin.

    Rgds,
    Jon

    Thread Starter Jonnyirish

    (@jonnyirish)

    Hi Thomas,

    Here’s my fix. It’s not pretty but it works…

    Since the plugin doesn’t strictly conform to custom-post types methodology, I had to update the POST_PARENT by accessing the database directly using $wpdb method. I did this from within functionality in the WP ALL IMPORT plugin.

    The WP_ALL_IMPORT plugin has a hook at ‘post_saved’.

    add_action('pmxi_saved_post', 'post_saved', 10, 1);
    function post_saved($id) {
    }

    So, I just hooked into that and performed a query to update the post_parent for each record that I was importing:

    add_action('pmxi_saved_post', 'post_saved', 10, 1);
    function post_saved($id) {
    global $wpdb;
    $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_parent = %d WHERE post_type = %s",8, 'jobman_job' ) );
    }

    I used the value 8 in the query because that’s the ID of my Job Manager base page. Other users would just need to insert their Base Page ID and it would work. The table names would be the same for all users.

    Hope this helps somebody.

    -Jon

    Thread Starter Jonnyirish

    (@jonnyirish)

    Hi Thomas,

    Here’s the solution packaged into an add-on plugin.

    -Jon

    Job Manager Add-on for WP All Import

    Plugin Author Thomas Townsend

    (@smb-dev)

    Jonny can you email me support At wp-jobmanger.com I want to get the low down on this in as concise a fashion as I can to see if this might be something we can integrate into a a future update ?

    Thanks

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Jobs added via import are set as 'archived'?’ is closed to new replies.