Forum Replies Created

Viewing 15 replies - 16 through 30 (of 35 total)
  • Thread Starter teracomp

    (@teracomp)

    Where is that setting?

    Look at Template Overrides: https://wpjobmanager.com/document/template-overrides/
    You can then edit the job-submit.php file as desired.

    If you don’t want company fields at all, you can disable them on the dashboard, though you probably still have to edit the job-submit.php file a bit.

    Thread Starter teracomp

    (@teracomp)

    Mike,
    I know you’ve been at this for quite a while, but for those that are new to WordPress customization, this is truly BRILLIANT! Really fantastic!

    Just in case someone else wants to allow their logged in users to duplicate jobs, I’ve included my solution here. I’m sure my code could be cleaned up, but here’s what I put in my functions.php file:

    /**
     * add method to duplicate a job posting
     */
    function duplicate_job( $job ) {
    	$job_id = absint( $_REQUEST['job_id'] );
    	$job    = get_post( $job_id );  // probably should try/catch this
    
    	$dup_id = $job->ID;
    	$dup = $job;
    	unset( $dup->ID );
    	unset( $dup->post_name );
    	$dup_meta = get_post_meta( $dup_id );
    	$dup->post_title = $job->post_title.' copy';
    	$new_post_id = wp_insert_post( $dup );
    	foreach( $dup_meta as $key=>$val ) {
    		add_post_meta($new_post_id, $key, $val[0] );
    	}
    
    	$mytype =  wp_get_post_terms( $dup_id, 'job_listing_type' );
    	$mytypeid = array( $mytype[0]->term_id ); // we only have one type per job
    
    	$myrole = wp_get_post_terms( $dup_id, 'job_listing_category' );
    	$myroleid = array( $myrole[0]->term_id ); // we only have one category per job
    
    	$mystates = wp_get_post_terms( $dup_id, 'state' );
    	$arstates = array();
    	foreach( $mystates as $s ) {
    		array_push( $arstates, $s->term_id );
    	}
    
    	$myapply = wp_get_post_terms( $dup_id, 'appoption' );
    	$arapply = array();
    	foreach( $myapply as $a ) {
    		array_push( $arapply	, $a->term_id );
    	}
    
    	wp_set_post_terms( $new_post_id, $mytypeid, 'job_listing_type' );
    	wp_set_post_terms( $new_post_id, $myroleid, 'job_listing_category' );
    	wp_set_post_terms( $new_post_id, $arstates, 'state' );
    	wp_set_post_terms( $new_post_id, $arapply, 'appoption' );
    }
    add_action( 'job_manager_job_dashboard_do_action_duplicate', 'duplicate_job' );
    Thread Starter teracomp

    (@teracomp)

    Another rookie mistake. It didn’t dawn on my that I was really trying to update custom taxonomies until I wrote the last post. Here’s the fix:

    $mystates = wp_get_post_terms( $dup_id, 'state' );
    $arstates = array();
    foreach( $mystates as $s ) {
        array_push( $arstates, $s->term_id );
    }
    
    $myapply = wp_get_post_terms( $dup_id, 'appoption' );
    $arapply = array();
    foreach( $myapply as $a ) {
        array_push( $arapply, $a->term_id );
    }

    With arrays properly filled, simply:

    wp_set_post_terms( $new_post_id, $arstates, 'state' );
    wp_set_post_terms( $new_post_id, $arapply, 'appoption' );

    Now, back to my original question, how do I do this without messing up the class-wp-job-manager-shortcodes.php class?

    Thread Starter teracomp

    (@teracomp)

    Added a few lines after the foreach to get the type and category:

    $mytype =  wp_get_post_terms( $dup_id, 'job_listing_type' );
    $mytypeid = array( $mytype[0]->term_id );
    
    $myrole = wp_get_post_terms( $dup_id, 'job_listing_category' );
    $myroleid = array( $myrole[0]->term_id );
    
    wp_set_post_terms( $new_post_id, $mytypeid, 'job_listing_type' );
    wp_set_post_terms( $new_post_id, $myroleid, 'job_listing_category' );

    That works.

    Current issue I’m having is with how the taxonomy-multiselect-dropdown post_meta is stored.

    Two issues:
    1) the string for _job_state looks like: a:2:{i:0;i:18;i:1;i:49;} as an example. Obviously, this is an array of 2 elements, I get that, but when it’s added (add_post_meta), it gets encapsulated with s:##””; so it becomes something like: s:24:”a:2:{i:0;i:18;i:1;i:49;}”;

    2) even if I modify it directly on the MySql side, it isn’t recognized by job-submit.php. In other words, if I remove the encapsulation and leave the string intact, it doesn’t get parsed into the multiselect field.

    The same issue with a taxonomy checklist I have for _how_to_apply.

    How do you store and retrieve the multiselect values?

    So close!

    Thread Starter teracomp

    (@teracomp)

    Ok…here’s how I made this work.

    In my template copy of job-dashboard.php I added the line:
    $actions['duplicate'] = array( 'label' => __( 'Duplicate', 'wp-job-manager' ), 'nonce' => true );

    Now Duplicate is an option on my job dashboard.

    In class-wp-job-manager-shortcodes.php I added:

    switch ( $action ) {
        case 'duplicate' :
            $this->duplicate_job( $job );
    	break;

    along with the function to execute

    public function duplicate_job( $job ) {
        $dup_id = $job->ID;
        $dup = $job;
        unset( $dup->ID );
        unset( $dup->post_name );
        $dup_meta = get_post_meta( $dup_id );
        $dup->post_title = $job->post_title.' copy';
        $new_post_id = wp_insert_post( $dup );
        foreach( $dup_meta as $key=>$val ) {
            add_post_meta($new_post_id, $key, $val[0] );
        }
    }

    I still need to add job_type and job_category, but this is a 95% solution.

    Here’s the problem, I’ve embedded code in your shortcode class. I’m still figuring out WordPress-eeze, so please point me to a resource that would show me how to put this code in my own class or functions.php so I don’t break compatibility with your most excellent plugin!

    btw — I did submit a PR on globalizing the class-wp-job-manager.shortcodes.php (12 days ago).

    Thread Starter teracomp

    (@teracomp)

    ok. i’ll take it on…another “high priority” task on my list.

    thanks for the prompt reply!

    d

    Thread Starter teracomp

    (@teracomp)

    Maybe so, but it is a request for me to implement. Can you point me to the right location to make this update?

    Thread Starter teracomp

    (@teracomp)

    Thanks Mike, I saw that, but the meta from WP Job Manager Field Editor was not prefilled for my custom company fields. So…once again…back at WP Job Manager Field Editor (do you guys collaborate?).

    It’s such an excellent add-on for your plugin and I assumed it would work the same by default. There are two options that have to be set to auto-populate company fields on the Populate tab of the field editor:

    1. populate_enable and
    2. populate_save.

    I think this will lead to an acceptable solution as long as I can show company information on its own form. That’s on me to sort out…shouldn’t be a problem.

    For what it’s worth, I think it would be better to have a [company_profile] page that is separate from the [job_submit] page. Much easier to manage my profile in one place, but I understand the concept of being able to edit company info per position. This method will give me the best of both worlds: default info and ability to customize company info per position. Nice! That’s the direction I’m heading.

    I really appreciate how you invest so much time responding to users…thanks!

    Hmmm…perhaps using the %s in Say What isn’t such a good idea! Looks like the dynamic text no longer works as it should.

    See if this works for you (rather simple):
    Original String: Jobs
    Text Domain: wp-job-manager
    Text context: (leave blank)
    Replacement string: Opportunities

    That seems to work on my dev site and gives you the dynamic text like I’m sure you require.

    Override the form-fields for wp-editor-field.php by adding it to your theme. See: https://wpjobmanager.com/document/template-overrides/

    On line #15 of wp-editor-field.php, add whatever TinyMce options you desire, e.g.:

    'toolbar1' =>  'formatselect,|,bold,italic,|,bullist,numlist,|,indent,outdent,|,link,unlink,|,undo,redo,fontselect,fontsizeselect',

    I use the formatselect option to show basic h1, h2, … tags for my users, but you can add whatever you desire. Check TinyMCE for options (perhaps https://www.tinymce.com/wiki.php/TinyMCE3x:Buttons/controls is useful)

    Using Say What, here are the settings that work:

    Original String: Showing all %s
    Text Domain: wp-job-manager
    Text context: (leave blank)
    Replacement string: Showing all Opportunities

    The string is built in class-wp-job-manager-ajax.php, but you shouldn’t change that code, just use the settings above.

    I tested this on my site and it works.

    Thread Starter teracomp

    (@teracomp)

    I am using WP Job Manager Field Editor to add lots of fields.

    On my test site, I deactivated WPJMFE and posted a job. No “array” in the post.
    I reactivated the Field Editor plugin and -array- shows up.

    Sorry for the trouble…appears to be in WP Job Manager Field Editor. I’ll ping Myles. ??

    The most efficient method is to use the Say What plugin: https://www.ads-software.com/plugins/say-what/

    For example, the text “Reset” shows up on the search results whenever a filter is applied. Since I’d rather be more explicit, I use Say What to change the text from “Reset” to “Clear Filters”

    Once you get the plugin installed and activated, look on the dashboard for Tools…Text Changes. The text-domain for this change is wp-job-manager.

    Hope that helps!

    Thread Starter teracomp

    (@teracomp)

    Thanks for the direction. This is a fundamental requirement, so I will be working to solve this in the next day or so.

Viewing 15 replies - 16 through 30 (of 35 total)