Guest User

weird

a guest
Sep 14th, 2015
113
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /*
  3. Plugin Name: Custom Code for CLIENT
  4. Description: Site specific code changes for CLIENT Website
  5. */
  6. /* Start Adding Functions Below this Line */
  7.  
  8. // Job Creator Role
  9.  
  10. function add_career_management_role() {
  11.  add_role('career_manager',
  12.             'Career Manager',
  13.             array(
  14.                 'read' => true,
  15.                 'edit_posts' => false,
  16.                 'delete_posts' => false,
  17.                 'publish_posts' => false,
  18.                 'upload_files' => true,
  19.             )
  20.         );
  21.    }
  22.    register_activation_hook( __FILE__, 'add_career_management_role' );
  23.  
  24.  
  25. // Our custom post type function
  26. function create_posttype() {
  27.  
  28.     register_post_type( 'career',
  29.     // CPT Options
  30.         array(
  31.             'labels' => array(
  32.                 'name' => __( 'Careers' ),
  33.                 'singular_name' => __( 'Career' )
  34.             ),
  35.             'public' => true,
  36.             'show_ui' => true,
  37.             'has_archive' => true,
  38.             'rewrite' => array('slug' => 'jobposting'),
  39.             'capability_type'     => array('career','careers'),
  40.             'map_meta_cap'        => true,         
  41.         )
  42.     );
  43. }
  44. // Hooking up our function to theme setup
  45. add_action( 'init', 'create_posttype' );
  46.  
  47.  
  48. // Add career role-based functionality
  49.  
  50.     add_action('admin_init','career_add_role_caps',999);
  51.     function career_add_role_caps() {
  52.  
  53.         // Add the roles you'd like to administer the custom post types
  54.         $roles = array('editor','administrator','career_manager');
  55.        
  56.         // Loop through each role and assign capabilities
  57.         foreach($roles as $the_role) {
  58.  
  59.              $role = get_role($the_role);
  60.            
  61.                  $role->add_cap( 'read' );
  62.                  $role->add_cap( 'read_career');
  63.                  $role->add_cap( 'read_private_careers' );
  64.                  $role->add_cap( 'edit_career' );
  65.                  $role->add_cap( 'edit_careers' );
  66.                  $role->add_cap( 'edit_others_careers' );
  67.                  $role->add_cap( 'edit_published_careers' );
  68.                  $role->add_cap( 'publish_careers' );
  69.                  $role->add_cap( 'delete_others_careers' );
  70.                  $role->add_cap( 'delete_private_careers' );
  71.                  $role->add_cap( 'delete_published_careers' );
  72.        
  73.         }
  74.     }
  75.  
  76. /* Stop Adding Functions Below this Line */
  77. ?>
RAW Paste Data