Role Scoper
How to add my existing custom post types to the role scoper (14 posts)

  1. prionkor
    Posted 4 years ago #

    Hi, i have some post types that i want to use with the role scoper. But the posts are not showing in the plugin. I want to know is there any hack to integrate the post types to role scoper?

    I have installed the plugin custom post type ui. but after that i the panel for the custom post showing but with errors says:

    Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/content/88/7124988/html/wp-content/plugins/role-scoper/admin/role_definition.php on line 204
    Warning: Invalid argument supplied for foreach() in /home/content/88/7124988/html/wp-content/plugins/role-scoper/admin/role_definition.php on line 221

    it might be because how the plugin connecting to the post types. Let me know if you have any tips.


  2. Kevin Behrens
    Plugin Author

    Posted 4 years ago #

    I just installed the current version of Custom Post Type UI and don't see this error. Can you give me more configuration details, including any advanced settings in your custom post type definition and any customization of role definitions?

    What URI causes the warning?

  3. prionkor
    Posted 4 years ago #

    Hi, thanks for reply. My problem is not with custom post type ui. my problem is i created some custom post type by coding it. When i installed the role scooper plugin the custom post type is not showing in role scooper but showing the error i describe.

    So, i thought. some thing i might have to change in my code to integrate the post types to role scooper.

    here how i defined a post type:

    * Code for event listings */
    add_action('init', 'register_event_listing');
    add_action("admin_init", "event_option_init");
    add_action('save_post', 'save_event_options');
    function register_event_listing(){
    	$labels = array(
    		'name' => _x('Events', 'post type general name'),
    		'singular_name' => _x('Event', 'post type singular name'),
    		'add_new' => _x('Add New', 'Event'),
    		'add_new_item' => __('Add New Event'),
    		'edit_item' => __('Edit Event'),
    		'new_item' => __('New Event'),
    		'view_item' => __('View Event'),
    		'search_items' => __('Search Events'),
    		'not_found' =>  __('No Events found'),
    		'not_found_in_trash' => __('No Events found in Trash'),
    		'parent_item_colon' => ''
    	$args = array(
       	    'labels' => $labels,
            'public' => true,
            'publicly_queryable' => true,
            'show_ui' => true,
            'query_var' => true,
            'rewrite' => true,
            'capability_type' => 'post',
            'hierarchical' => false,
           'menu_position' => 5,
    	   'taxonomies' => array('post_tag', 'events'),
           'supports' => array('title', 'editor', 'thumbnail', 'revisions')
      register_post_type('event', $args);
    function event_option_init(){
    	add_meta_box("event-meta", "Event Options", "write_event_options", "event", "normal", "high");
    function write_event_options(){
    code for event options
  4. Kevin Behrens
    Plugin Author

    Posted 4 years ago #

    Try changing your init action registration to:

    add_action('init', 'register_event_listing', 1 );

    You can find further explanation at the "problems with types/taxonomies" link in Roles > Options > Realm tab > "Post Type Usage"

  5. prionkor
    Posted 4 years ago #

    Hi, thanks it worked :) What is the 1 really means?

    Thank you vary much :)

  6. Kevin Behrens
    Plugin Author

    Posted 4 years ago #

    It is the execution priority argument. A low number forces your registration function to execute before Role Scoper initializes.

  7. prionkor
    Posted 4 years ago #

    Thanks! great learning :)

  8. prionkor
    Posted 4 years ago #

    Sorry, i had to open the thread again. It is rather a simple question so i thought it will be better to ask it here rather than creating a new one.

    My events are now listed successfully. What i want now is making a role group which can only add, publish, edit their own events.

    So, i first go to Roles -> event (name of custom post type) then in the section Select Users or Groups to Modify i select the group or user i want to change the role. Then assign it to event contributor

    After that i modified the rs role definition from role -> option The roles i selected is : delete, delete private, delete published, publish, edit, edit published, edit private, upload files

    But the add new events is not showing in dashboard.. you can check this here:

    Go to http://citystir.com/wp-admin

    login: designdons
    pass: testit

  9. Kevin Behrens
    Plugin Author

    Posted 4 years ago #

    Do you have any Restrictions set for Events? If so you will need to remove them or assign designdons a corresponding taxonomy or object role.

    Otherwise please try this:

    a) Turn on Roles > Options > Advanced tab > User Profile > "Display User Roles". Then login in as designdons and make sure Event Contributor is listed as an additional General Role.

    b) Go back to Roles > Options > RS Role Defs and set the capabilities back to defaults. Give Event Author the upload_files capability if necessary. Give designdons a General Role of Event Author instead of Event Contributor.

  10. prionkor
    Posted 4 years ago #

    Did not worked with a and b.. There is no restrictions set for events.

    But it worked this way Roles > general > events roles active the event author for designdons. But i also showing some additional options in dashboard.

    Please check it and let me know if it is safe?

  11. prionkor
    Posted 4 years ago #

    Nop!! now i can create both post and event :(

  12. Kevin Behrens
    Plugin Author

    Posted 4 years ago #

    I'm not seeing a Posts menu or "Add New Post" UI if I repeat that configuration with a CPT plugin such as GD Custom. Can you try that so we know if the issue is something with your CPT registration?

    What RS version are you running?

  13. prionkor
    Posted 4 years ago #

    check the top right dropdown menu. It says new posts. when you click it, it will take you to the new-post page :(

    Also if you click tools -> press this you will taken to another new-post page where also you can post.

    My RS Version 1.3.21

    Let me know if you are seeing the same and confirm I will try this again via GD custom then.

  14. Kevin Behrens
    Plugin Author

    Posted 4 years ago #

    Yes, I see it in your sample site but don't know how to reproduce the symptom on my own.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Role Scoper
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic