Skip to content

Instantly share code, notes, and snippets.

View mikejolley's full-sized avatar

Mike Jolley mikejolley

View GitHub Profile
// Hook into user_has_cap filter. This assumes you have setup resumes to require the capability 'has_active_job_package'
add_filter( 'user_has_cap', 'has_active_job_package_capability_check', 10, 3 );
/**
* has_active_job_package_capability_check()
*
* Filter on the current_user_can() function.
*
* @param array $allcaps All the capabilities of the user
* @param array $cap [0] Required capability
@mikejolley
mikejolley / gist:f20343cbaa3a530cc8ee
Created February 13, 2015 22:44
WP Job Manager Resumes & WC Paid Listings - Variation to https://gist.github.com/mikejolley/9668782 which also keeps access active as long as the user has an active job listing as well.
// Hook into user_has_cap filter. This assumes you have setup resumes to require the capability 'has_active_job_package'
add_filter( 'user_has_cap', 'has_active_job_package_capability_check', 10, 3 );
/**
* has_active_job_package_capability_check()
*
* Filter on the current_user_can() function.
*
* @param array $allcaps All the capabilities of the user
* @param array $cap [0] Required capability
@mikejolley
mikejolley / gist:bf70a6cbe0610d4b3528
Created February 13, 2015 19:05
WP Job Manager Resumes & WooCommerce Subscriptions - If resumes require a 'has_active_subscription' capability, limit access to only those with an active subscription.
// Hook into user_has_cap filter. This assumes you have setup resumes to require the capability 'has_active_subscription'
add_filter( 'user_has_cap', 'has_active_subscription_capability_check', 10, 3 );
/**
* has_active_subscription_capability_check()
*
* Filter on the current_user_can() function.
*
* @param array $allcaps All the capabilities of the user
* @param array $cap [0] Required capability
@mikejolley
mikejolley / gist:5e1b6fd8cbfe68276dfe
Created February 11, 2015 19:13
Remove Google Map Link
add_filter( 'the_job_location_map_link', 'custom_the_job_location_map_link' );
function custom_the_job_location_map_link( $link ) {
return strip_tags( $link );
}
@mikejolley
mikejolley / gist:6fa9a4fd6f78745d6e08
Created February 10, 2015 19:57
Applications - Change who gets the email
add_filter( 'create_job_application_notification_recipient', 'custom_create_job_application_notification_recipient', 10, 3 );
function custom_create_job_application_notification_recipient( $send_to, $job_id, $application_id ) {
// change $send_to here
return $send_to;
}
@mikejolley
mikejolley / gist:30180e3f090f7d29f9ed
Created February 7, 2015 08:40
Change bookmarks login link
/** Code goes in theme functions.php **/
add_filter( 'job_manager_bookmark_form_login_url', 'custom_job_manager_bookmark_form_login_url' );
function custom_job_manager_bookmark_form_login_url() {
return 'http://someurl.com';
}
@mikejolley
mikejolley / gist:42b3ab3667c1bb9f00af
Created January 31, 2015 17:16
Applications - Remove a status
add_filter( 'job_application_statuses', 'add_new_job_application_status' );
function add_new_job_application_status( $statuses ) {
unset( $statuses['offer'] ); // Other statuses include new, hired, archived and interviewed
return $statuses;
}
@mikejolley
mikejolley / gist:185531c5061bc28b5e37
Last active November 29, 2017 18:15
Applications - Add a new status
add_filter( 'job_application_statuses', 'add_new_job_application_status' );
function add_new_job_application_status( $statuses ) {
$statuses['example'] = _x( 'Example', 'job_application', 'wp-job-manager-applications' );
$statuses['another_example'] = _x( 'Another Example', 'job_application', 'wp-job-manager-applications' );
$statuses['a_third_example'] = _x( 'A Third Example', 'job_application', 'wp-job-manager-applications' );
return $statuses;
}
add_filter( 'job_manager_indeed_get_jobs_args', 'custom_job_manager_indeed_get_jobs_args' );
function custom_job_manager_indeed_get_jobs_args( $args ) {
$args['sort'] = 'date';
return $args;
}
@mikejolley
mikejolley / gist:bcb1d47f50aea6f2c0d9
Last active February 12, 2020 10:55
WP Job Manager - Make Job Location a required field
add_filter( 'submit_job_form_fields', 'make_location_field_required' );
function make_location_field_required( $fields ) {
$fields['job']['job_location']['required'] = true;
return $fields;
}