andrejzito
Forum Replies Created
-
Forum: Plugins
In reply to: [JobBoardWP - Job Board Listings and Submissions] Adding jobs via APIall good, you can close this one ??
Forum: Plugins
In reply to: [JobBoardWP - Job Board Listings and Submissions] Adding jobs via APIYeah, sure. I didn’t find a way how to set all the meta fields to be update-able via API. So I tried the solution I use for other custom fields, after learning how the fields from your plugin are called. And it works fine now for me.
Here’s the snippet code:
function jb_job_meta_rest() { register_rest_field('jb-job', 'jb-application-contact', array( 'get_callback' => 'rest_get_jb_application_contact', 'update_callback' => 'rest_update_jb_application_contact' )); register_rest_field('jb-job', 'jb-location-type', array( 'get_callback' => 'rest_get_jb_location_type', 'update_callback' => 'rest_update_jb_location_type' )); register_rest_field('jb-job', 'jb-location', array( 'get_callback' => 'rest_get_jb_location', 'update_callback' => 'rest_update_jb_location' )); register_rest_field('jb-job', 'jb-company-name', array( 'get_callback' => 'rest_get_jb_company_name', 'update_callback' => 'rest_update_jb_company_name' )); register_rest_field('jb-job', 'jb-company-website', array( 'get_callback' => 'rest_get_jb_company_website', 'update_callback' => 'rest_update_jb_company_website' )); } add_action('rest_api_init', 'jb_job_meta_rest'); function rest_get_jb_application_contact($post, $field_name, $request) { $cf = get_post_meta( $post['id'], 'jb-application-contact', true ); $cf = !empty($cf) ? $cf : 0; return $cf; } function rest_update_jb_application_contact( $value, $post, $field_name ) { return update_post_meta( $post->ID, 'jb-application-contact', $value ); } function rest_get_jb_location_type($post, $field_name, $request) { $cf = get_post_meta( $post['id'], 'jb-location-type', true ); $cf = !empty($cf) ? $cf : 0; return $cf; } function rest_update_jb_location_type( $value, $post, $field_name ) { return update_post_meta( $post->ID, 'jb-location-type', $value ); } function rest_get_jb_location($post, $field_name, $request) { $cf = get_post_meta( $post['id'], 'jb-location', true ); $cf = !empty($cf) ? $cf : 0; return $cf; } function rest_update_jb_location( $value, $post, $field_name ) { return update_post_meta( $post->ID, 'jb-location', $value ); } function rest_get_jb_company_name($post, $field_name, $request) { $cf = get_post_meta( $post['id'], 'jb-company-name', true ); $cf = !empty($cf) ? $cf : 0; return $cf; } function rest_update_jb_company_name( $value, $post, $field_name ) { return update_post_meta( $post->ID, 'jb-company-name', $value ); } function rest_get_jb_company_website($post, $field_name, $request) { $cf = get_post_meta( $post['id'], 'jb-company-website', true ); $cf = !empty($cf) ? $cf : 0; return $cf; } function rest_update_jb_company_website( $value, $post, $field_name ) { return update_post_meta( $post->ID, 'jb-company-website', $value ); }
I’m sure there’s a better way to implement it, but it gets the job done for me.
Forum: Plugins
In reply to: [JobBoardWP - Job Board Listings and Submissions] Adding jobs via APIthanks, @nsinelnikov – that actually worked! Now I just need to google how to update the fields, but I should be able to do that.
Forum: Plugins
In reply to: [JobBoardWP - Job Board Listings and Submissions] Adding jobs via APIHi @nsinelnikov,
I did a GET on one of our jobs (https://localizationacademy.com/wp-json/wp/v2/jb-job/11860).
It returned 200 with some data, see screenshot (from Male.com).
The problem is that all the job data is not registered with the API (except for the Job type). So I can’t read/write it.
When I made my own custom type before (to represent Certificates), I registered all the custom fields used in that post type so I can get & update them.
So the question is how to register the Job Data from your jb-job post type? I assume what we see in the admin UI are just labels, but to register the fields, we may need to use something different? E.g. instead of “Company name”, it’s “company_name” or something like that.
I hope I make some sense lol, not very experienced in this area. Thanks
hi @nsinelnikov
sorry for the late reply. I updated to the latest version today and added the snippet (without checking for the page, disabled it everywhere). It works fine.
Thanks for your help!
cheers
hi @nsinelnikov
actually the one from your ZIP is under “jobboardwp-master” folder and it works fine… so I should rename it?
hi @nsinelnikov ,
I haven’t tried this since I’m not an expert on these modifications. I just kept the folder deleted and that works ?? will this hook need to be added in future releases or are you going to “fix” the issue? Assuming it’s an issue in your view?
Hi @nsinelnikov,
I installed your version today and it works fine, thanks!
What I did is I installed it, deactivated the “official” one, activated the version from you. Is this what I should have done? Can I delete the official version? What will have with the next official update, will it know to update “your” version? Right now I have 2 plugins with the same name.
best regards,
AndrejFor now I simply deleted the whole
\common\libs\jquery-ui
folder and that seems to do the trickhi @nsinelnikov
definitely not – which is why I missed it at first when I tried your plugin. I only touched the pages created by the plugin.
cheers
Hi @nsinelnikov
I’d like to open this because I have the same question. I’m the Administrator on our WP and I can access the backend Job Board just fine. I’d like my colleague with the Author role to access it as well.
I am using User Role Editor and I added pretty much all capabilities that seem related to your plugin to the role. However the user still can’t access it. He gets “Sorry, you are not allowed to access this page.” message.
Here’s the role overview in the User Role Editor: https://drive.google.com/file/d/1G7HOqDHdO-x5xxlYSMKnELvi9xh6Ncf3/view?usp=drivesdk
What are we missing?
hi @nsinelnikov,
I enabled the “Jobs” Post Type in Elementor, thanks for the tip. However, I still can’t select that post type in Template Display Conditions https://drive.google.com/file/d/19VzPqrE8fF4EkZyTBeos6EH7mmg3HK26/view?usp=drivesdk. I do have Elementor Pro btw.
Do you know of other people who were able to make it work with Elementor? And by that I mean setting up a template for single job.
Otherwise, I guess I’ll have to customize the PHP which I haven’t done yet ??
I checked now and I don’t see a way in Elementor to update the “WordPress native post template” – you can only create Elementor templates.
Which then can’t be used in your plugin.
Also even if the “Job” is a CPT, I can’t even select it in Elementor under Display conditions (which basically say for which posts a template should be used). I see in the list my other CPT that I created using CPT UI plugin.
(on that note, I also can’t see the “Job” CPT under CPT UI).
The only thing that worked for me is to set the styles globally under Elementor’s Custom CSS. This way I can style it to my taste, but if I wanted to add some new elements, I think I’d have to it through https://docs.jobboardwp.com/article/1570-templates-structure?