[wp-hackers] Custom Role and Custom Post Types

SWORD Studios 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:

> Jesse,
>
> You probably need to pay attention to the capabilities-related
> argument of register_post_type:
>
> http://codex.wordpress.org/Function_Reference/register_post_type#Arguments
>
> 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.
>
> cheers,
>
> 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
> and
> >   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"
> admin
> >   panel which include "add new"
> >   - How do I define that they can ONLY edit a Custom Post Type rather
> than
> >   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
> registration
> >   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
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list