-
-
Save dexit/acb2cc71ca3f2da4f9589614f4c163c4 to your computer and use it in GitHub Desktop.
Add editor role to WPJM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Add Editor to WPJM Management | |
Plugin URI: http://wpjobmanager.com | |
Description: Custom plugin to add the editor to WPJM. | |
Version: 0.1 | |
Author: Brandon Kraft | |
Author URI: https://kraft.im/ | |
*/ | |
wpjm_hack_add_user_roles(); | |
function wpjm_hack_add_user_roles() { | |
global $wp_roles; | |
if ( class_exists( 'WP_Roles' ) && ! isset( $wp_roles ) ) { | |
$wp_roles = new WP_Roles(); | |
} | |
if ( is_object( $wp_roles ) ) { | |
$capabilities = wpjm_hack_get_core_capabilities(); | |
foreach ( $capabilities as $cap_group ) { | |
foreach ( $cap_group as $cap ) { | |
$wp_roles->add_cap( 'editor', $cap ); | |
} | |
} | |
} | |
} | |
/** | |
* Get capabilities | |
* @return array | |
*/ | |
function wpjm_hack_get_core_capabilities() { | |
return array( | |
'core' => array( | |
'manage_job_listings', | |
'manage_resumes' | |
), | |
'job_listing' => array( | |
"edit_job_listing", | |
"read_job_listing", | |
"delete_job_listing", | |
"edit_job_listings", | |
"edit_others_job_listings", | |
"publish_job_listings", | |
"read_private_job_listings", | |
"delete_job_listings", | |
"delete_private_job_listings", | |
"delete_published_job_listings", | |
"delete_others_job_listings", | |
"edit_private_job_listings", | |
"edit_published_job_listings", | |
"manage_job_listing_terms", | |
"edit_job_listing_terms", | |
"delete_job_listing_terms", | |
"assign_job_listing_terms" | |
) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment