Revision: 51328
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 21, 2011 04:40 by tcelestino
Initial Code
add_role('monitor', 'Monitor', array( 'edit_monitoramento' => true, 'edit_monitoramentos' => true, 'edit_private_monitoramento' => true, 'edit_other_monitoramento' => true, 'read_monitoramento' => true, 'read_private_monitoramentos' => true, 'publish_monitoramentos' => true, 'delete_monitoramento' => true, 'delete_monitoramentos' => true, 'delete_others_monitoramentos' => true, 'delete_published_monitoramentos' => true, 'delete_private_monitoramentos' => true, 'edit_posts' => false )); $admin_role = get_role( 'administrator' ); $admin_role->add_cap( 'edit_monitoramentos' ); $admin_role->add_cap( 'edit_monitoramento' ); $admin_role->add_cap( 'edit_private_monitoramento' ); $admin_role->add_cap( 'publish_monitoramentos' ); $admin_role->add_cap( 'manage_tipo' ); $admin_role->add_cap( 'edit_tipo' ); $admin_role->add_cap( 'delete_tipo' ); $admin_role->add_cap( 'assign_tipo' ); $monitor_role = get_role( 'monitor' ); $monitor_role->add_cap( 'edit_monitoramentos' ); $monitor_role->add_cap( 'edit_monitoramento' ); $monitor_role->add_cap( 'edit_private_monitoramento'); $monitor_role->add_cap( 'publish_monitoramentos'); $monitor_role->add_cap( 'manage_tipo' ); $monitor_role->add_cap( 'edit_tipo' ); $monitor_role->add_cap( 'delete_tipo' ); $monitor_role->add_cap( 'assign_tipo' ); $monitor_role->remove_cap( 'manage_categories'); $monitor_role->remove_cap( 'edit_posts'); add_action('init', 'monitoramento_register'); function monitoramento_register() { $labels = array( 'name' => _x('Monitoramento', 'post type general name'), 'singular_name' => _x('Monitoramento', 'post type singular name'), 'add_new' => _x('Adicionar', 'monitoramento item'), 'add_new_item' => __('Adicionar novo'), 'edit_item' => __('Editar'), 'new_item' => __('Novo'), 'view_item' => __('Visualizar'), 'search_items' => __('Busca'), 'not_found' => __('Nada encontrado'), 'not_found_in_trash' => __('Nada encontrado na Lixeira'), 'parent_item_colon' => '' ); $args = array( 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'monitoramento'), // 'capability_type' => 'post', 'capabilities' => array( 'edit_post' => 'edit_monitoramento', 'edit_posts' => 'edit_monitoramentos', 'edit_private_posts' => 'edit_private_monitoramento', 'edit_others_posts' => 'edit_other_monitoramento', 'read_post' => 'read_monitoramento', 'read_private_posts' => 'read_private_monitoramentos', 'publish_posts' => 'publish_monitoramentos', 'delete_post' => 'delete_monitoramento', 'delete_posts' => 'delete_monitoramentos', 'delete_others_posts' => 'delete_others_monitoramentos', 'delete_published_posts' => 'delete_published_monitoramentos', 'delete_private_posts' => 'delete_private_monitoramentos' ), 'hierarchical' => false, 'menu_position' => 5, 'supports' => array('title', 'editor', 'excerpt', 'thumbnail') ); register_post_type('monitoramento' , $args); }; register_taxonomy("tipo", array("monitoramento"), array( "hierarchical" => true, "label" => "Tipo", "singular_label" => "Formato", "rewrite" => true, "all_items" => __('Todos'), "add_new_item" => __('Adicionar um novo'), 'capabilities' => array( 'manage_terms'=>'manage_tipo', 'edit_terms'=>'edit_tipo', 'delete_terms'=>'delete_tipo', 'assign_terms'=>'assign_tipo') ) );
Initial URL
Initial Description
Initial Title
Custom Post Type with Role Users
Initial Tags
php, wordpress
Initial Language
PHP