Allow Admin to Edit Jobs Easily
Just spent some time figuring out how to make this work, so I thought I'd share it with everyone. Basically we're going to add an "edit" link on every job, only when you're logged in as Admin. This will take you to the "Edit Job" page that job-listers see, which I think is easier for editing jobs than using the
WP-Admin panel.
Step 1: Enable Admin to edit listings
First, we have to make it so that Admin has permission to edit any job listing. To do this, we'll modify tpl-edit-job.php.
In
tpl-edit-job.php, on line 42, change:
PHP Code:
if (get_current_user_id() == $job_details->post_author) :
to:
PHP Code:
if (get_current_user_id() == $job_details->post_author || current_user_can('manage_options')) :
Step 2: Insert Edit Link
This will place an "Edit" link on each job listing. Feel free to style this link however you want to, and place it wherever on the page you find it most convenient, since you're the only one who will see it.
Edit
single-job_listing.php, and place the following code wherever you want:
PHP Code:
<?php if ( current_user_can('manage_options') ) : ?>
<p style="font-size: 16px; margin: 10px 0;">Admin: <a href="<?php echo add_query_arg('edit', $post->ID, get_permalink(get_option('jr_edit_job_page_id'))); ?>"><?php _e('Edit','appthemes'); ?></a></p>
<?php endif; ?>
And that's it! You should now be able to quickly edit any job quickly, in case one of your job-listers makes a mistake. Note that after you click "save job", the script will redirect you to your dashboard without any confirmation, but the job will save correctly.
Also note that if you're going to make changes to core theme files, you should do so through a child theme, so you don't have to redo the changes every time jobroller is updated. Child themes have been well documented elsewhere on the appthemes website.