Discussion:
[Bug?] Selecting tax terms associated to a cpt
Dino Termini
2014-07-31 15:00:10 UTC
Permalink
Hi list,

we have the following scenario: custom post type "tool" with a bunch of
taxonomies attached to it (type, location, etc). Nothing new under the sun.

Using Members [1], I created a new role that has access to tools only,
no pages, no posts. In the CPT definition, I set capability_type =
'tool', and assigned edit_tools, delete_tools, etc to the corresponding
role.

Now, when I log into the system as a Tool Editor, I can add a new tool,
but the sidebar taxonomy terms cannot be selected unless I add
'edit_posts' to the list of capabilities associated to Tool Editor.

Am I missing something? Is this a bug in WP?

Thanks,
Dino

[1] https://wordpress.org/plugins/members/
James Currie
2014-07-31 16:22:10 UTC
Permalink
Are you using a custom taxonomy for it via register_taxonomy?
(http://codex.wordpress.org/Function_Reference/register_taxonomy)

If so, just set the capabilities to match your custome ones, ie:

'capabilities' => array(
'manage_terms' =>'custom-capability',
'edit_terms' =>'custom-capability',
'delete_terms' =>'custom-capability',
'assign_terms' =>'custom-capability'
),


Jamie
www.wunderdojo.com

------ Original Message ------
From: "Dino Termini" <***@duechiacchiere.it>
To: wp-***@lists.automattic.com
Sent: 7/31/2014 8:00:10 AM
Subject: [wp-hackers] [Bug?] Selecting tax terms associated to a cpt
Post by Dino Termini
Hi list,
we have the following scenario: custom post type "tool" with a bunch of
taxonomies attached to it (type, location, etc). Nothing new under the sun.
Using Members [1], I created a new role that has access to tools only,
no pages, no posts. In the CPT definition, I set capability_type =
'tool', and assigned edit_tools, delete_tools, etc to the corresponding
role.
Now, when I log into the system as a Tool Editor, I can add a new tool,
but the sidebar taxonomy terms cannot be selected unless I add
'edit_posts' to the list of capabilities associated to Tool Editor.
Am I missing something? Is this a bug in WP?
Thanks,
Dino
[1] https://wordpress.org/plugins/members/
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Dino Termini
2014-07-31 17:03:20 UTC
Permalink
I am using CPT UI, which doesn't have that option. I guess I'll have to
use the 'manual' approach then :) Thanks!
Post by James Currie
Are you using a custom taxonomy for it via register_taxonomy?
(http://codex.wordpress.org/Function_Reference/register_taxonomy)
'capabilities' => array(
'manage_terms' =>'custom-capability',
'edit_terms' =>'custom-capability',
'delete_terms' =>'custom-capability',
'assign_terms' =>'custom-capability'
),
Jamie
www.wunderdojo.com
------ Original Message ------
Sent: 7/31/2014 8:00:10 AM
Subject: [wp-hackers] [Bug?] Selecting tax terms associated to a cpt
Post by Dino Termini
Hi list,
we have the following scenario: custom post type "tool" with a bunch
of taxonomies attached to it (type, location, etc). Nothing new under
the sun.
Using Members [1], I created a new role that has access to tools
only, no pages, no posts. In the CPT definition, I set
capability_type = 'tool', and assigned edit_tools, delete_tools, etc
to the corresponding role.
Now, when I log into the system as a Tool Editor, I can add a new
tool, but the sidebar taxonomy terms cannot be selected unless I add
'edit_posts' to the list of capabilities associated to Tool Editor.
Am I missing something? Is this a bug in WP?
Thanks,
Dino
[1] https://wordpress.org/plugins/members/
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
James Currie
2014-07-31 17:35:58 UTC
Permalink
If you want to just hook into the setup you've already got and change
the permissions you could look at registered_taxonomy
(http://codex.wordpress.org/Plugin_API/Action_Reference/registered_taxonomy)

Something like: add_action('registered_taxonomy', array($this,
'registered_taxonomy'), 10, 3);

Where $this is the class I'm calling add_action from and
registered_taxonomy is the method that is going to manipulate it. From
there you can modify the permissions to suit.

Jamie

------ Original Message ------
From: "Dino Termini" <***@duechiacchiere.it>
To: wp-***@lists.automattic.com
Sent: 7/31/2014 10:03:20 AM
Subject: Re: [wp-hackers] [Bug?] Selecting tax terms associated to a cpt
Post by Dino Termini
I am using CPT UI, which doesn't have that option. I guess I'll have to
use the 'manual' approach then :) Thanks!
Post by James Currie
Are you using a custom taxonomy for it via register_taxonomy?
(http://codex.wordpress.org/Function_Reference/register_taxonomy)
'capabilities' => array(
'manage_terms' =>'custom-capability',
'edit_terms' =>'custom-capability',
'delete_terms' =>'custom-capability',
'assign_terms' =>'custom-capability'
),
Jamie
www.wunderdojo.com
------ Original Message ------
Sent: 7/31/2014 8:00:10 AM
Subject: [wp-hackers] [Bug?] Selecting tax terms associated to a cpt
Post by Dino Termini
Hi list,
we have the following scenario: custom post type "tool" with a bunch
of taxonomies attached to it (type, location, etc). Nothing new under
the sun.
Using Members [1], I created a new role that has access to tools
only, no pages, no posts. In the CPT definition, I set
capability_type = 'tool', and assigned edit_tools, delete_tools, etc
to the corresponding role.
Now, when I log into the system as a Tool Editor, I can add a new
tool, but the sidebar taxonomy terms cannot be selected unless I add
'edit_posts' to the list of capabilities associated to Tool Editor.
Am I missing something? Is this a bug in WP?
Thanks,
Dino
[1] https://wordpress.org/plugins/members/
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Loading...