WordPress.org

Ready to get started?Download WordPress

Forums

Role Scoper
[resolved] Custom post type without WP Schema support (16 posts)

  1. jli
    Member
    Posted 4 years ago #

    The feature list says:

    Supports custom Post Types and Taxonomies (when defined using WP schema by a plugin such as Custom Post Type UI)

    Is there a way to get the "regular" hardcoded custom post types working with Role Scoper ?

    I don't like the idea of having to rely on a plugin to create my custom post types.

    Thanks,
    John.

    http://wordpress.org/extend/plugins/role-scoper/

  2. kevinB
    Member
    Plugin Author

    Posted 4 years ago #

    I am referring to "regular" custom post types. The only reason I mentioned a plugin is that WP does not currently provide the UI to create/edit custom types, and a lot of people wouldn't know how to hardcode their own definitions.

  3. jli
    Member
    Posted 4 years ago #

    Well then there is a bug with hardcoded custom post types.

    In the Realm pannel -> Object Scope, I can see my hardcoded custom post types in the list of available items.
    But if i check the checkbox in front of one of them and save, my selection is not saved.

    I did the test with a custom post types created with Custom post types UI and it's working.

    Any hint ?
    Don't hesitate to ask if you want more infos to debug ;-)

  4. kevinB
    Member
    Plugin Author

    Posted 4 years ago #

    Make sure you register your post types early on the init action:

    function my_post_types() {
      register_post_type( .... );
    }
    
    add_action( 'init', 'my_post_types', 1 );

    That should help but I've been working on custom types / taxonomies support today and did discover a number of other glitches. Will let you know when I have another version stabilized.

  5. jli
    Member
    Posted 4 years ago #

    Hey Kevin,

    I'm a step further now, I can save my selection in the object scope settings and my custom post types appear in the roles and restrictions panels.

    Now that I can access my CPT in roles and restictions, I don't see any entry in the role table of each CPT.

    See this image : http://screencast.com/t/MzcxZGQ1Z

    Maybe I'm missing something in the config or maybe it's the glitches you mentioned earlier ;-)

    Anyway thanks for the support!

  6. kevinB
    Member
    Plugin Author

    Posted 4 years ago #

    I just pushed a 1.2.8.beta up to wordpress.org. Let me know if your custom type roles can now be assigned once they are activated in Roles < Options > Realm.

    There may still be other glitches with custom post types in that code base. Let me know if any of them are killers and maybe I can backport more code from my version 1.3 development. In general, I've found that with custom post types here to stay, requiring WP 3.0 is my only sane approach to manageable code. So RS 1.3 will introduce that requirement along with code that's optimized for it.

  7. Helen Hou-Sandi
    WordPress Dev
    Posted 4 years ago #

    I'm having the same issue with not being able to save my checkbox selection in front of a custom post type. jli - did you do anything specific to get it working?

  8. kevinB
    Member
    Plugin Author

    Posted 4 years ago #

    See the comment above about registering post types on the init action. Find the equivalent add_action( 'init' code in your theme or plugin and make sure that line ends with , 1 );

  9. Helen Hou-Sandi
    WordPress Dev
    Posted 4 years ago #

    I did make sure to set the priority to 1, but still not working for me. Any other reason it wouldn't save the checkbox selection?

  10. jli
    Member
    Posted 3 years ago #

    @helenyhou: here is a sample of my code

    add_action('init', 'hotel_register',1);
    
    	function hotel_register(){
    		$args = array(
    			'label' => __('Hotels'),
    			'singular_label' => __('Hotel'),
    			'public' => true,
    			'hierarchical' => false,
    			'rewrite' => true,
    			'supports' => array('title', 'editor', 'revisions', 'author', 'thumbnail'),
    			);
    		register_post_type( 'hotel' , $args );
    	}

    I only added the priority one as Kevin stated.

    @KevinB: I still had no time to check the beta's deeply but i'll report any glitches if i found some ;-)

  11. Helen Hou-Sandi
    WordPress Dev
    Posted 3 years ago #

    Well, I did some more investigating and it looks like no options under Realm save for me, although options under other tabs are. I will try deactivating other plugins to see if there is a conflict out there and report back. Where/how are these options saved?

    Update: Tried deactivating all plugins and removing all functions except initializing the custom post type, but options were still not saved. This is crucial to our site development - any other ideas?

  12. kevinB
    Member
    Plugin Author

    Posted 3 years ago #

    What RS version are you running?

    What WP version? Multisite?

    Can you post your type registration function or let me know what plugin is registering it for you?

    The Realm options are saved in submittee.php - function update_page_otype_options

  13. kevinB
    Member
    Plugin Author

    Posted 3 years ago #

    Never mind answering those last questions.

    I confirmed that those options don't save correctly under WP 3.0 Multisite when they are configured as site_wide options.

    Can you confirm this is fixed in Role Scoper 1.2.8 Beta 4 ?

  14. Helen Hou-Sandi
    WordPress Dev
    Posted 3 years ago #

    Yes, this is fixed for site_wide options in beta 4! This is great - thank you so much.

    Now, when I set a user to have a role (i.e. be an editor) for a specific post of a custom type (a faculty member, in my case), the custom post type does not show in the admin menu, although the user can indeed update the post itself when the URL for the post to edit is navigated to. If I set the user to only be an editor for a page, however, the page menu does show up. Is there something I need to set in order for the custom post type admin menu to appear?

  15. kevinB
    Member
    Plugin Author

    Posted 3 years ago #

    Okay, I've also confirmed the failure to display a custom post type menu based on object role assignment. This is now fixed in Role Scoper 1.2.8 Beta 5, which is in the process of uploading to wordpress.org right now.

  16. Helen Hou-Sandi
    WordPress Dev
    Posted 3 years ago #

    You are really and truly fantastic. As far as I can tell for the moment, everything I need is working perfectly! Your plugin is the backbone of justification for my current WP-as-CMS project, and I can't thank you enough for the work that you do. I'll keep an eye out for any other funky occurrences, but for now, thank you!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic