[wp-hackers] Custom Role and Custom Post Types
info at swordstudios.net
Sun Feb 13 14:21:03 UTC 2011
I just ran this function to define the new role:
//CUSTOM ROLE INFO
add_role( 'sr_webdesigner', 'Web Designer' );
// get the the role object
//$role_object = get_role( 'sr_webdesigner' );
// add $cap capability to this role object
//$role_object->add_cap( 'edit_posts' );
I've been looking into "unset" $submenu for Add New but I can't find the
right submenu item and I'm not sure yet if that will prevent someone from
manually navigating to /post-new.php
On Sun, Feb 13, 2011 at 9:15 AM, Steve Taylor <steve at sltaylor.co.uk> wrote:
> You probably need to pay attention to the capabilities-related
> argument of register_post_type:
> I don't know how you're creating the new role - I used Justin
> Tadlock's Members plugin, which also allows customization of the
> role's capabilities. In tandem with the above arguments, I've been
> able to do this kind of thing.
> As for creating the new post on registration, yeah, I think you're on
> the right track with the new registration hook.
> Steve Taylor
> On 13 February 2011 13:42, SWORD Studios <info at swordstudios.net> wrote:
> > Thanks in advance for any help I get with this.
> > I've defined a new role in wordpress called Designer.
> > I've create a custom post type called Profile.
> > Designer needs to have 1 ability and that's to edit a Profile post.
> > I need to accomplish the following
> > - Create a custom Role called "Designer" - DONE
> > - I need to limit the capabilities of the Designer to ONLY edit their
> > Profile post. I do not want them to be able to "Add Posts" of any type
> > because each Designer is only allowed one Profile Post
> > - On registration of a "designer" a custom post "Profile" is created
> > published automatically with the new Designer set as the author
> > - The title of this new Profile will be the name of the Designer set by
> > the designer upon registration
> > Problems I'm having
> > - It's easy enough to limit the capabilities of the new role to only
> > "edit posts" but that actually gives them access to the entire "Posts"
> > panel which include "add new"
> > - How do I define that they can ONLY edit a Custom Post Type rather
> > a simple Post
> > - How do I auto create a custom post type upon registration of a new
> > user? I figure I can grab the hook that is used for a new user
> > and just add the post to the database manually. If this is the best
> way of
> > doing it, I can don't need help with this.
> > Jesse Friedman
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers