How to get capabilities of post author
-
Hello, I need to get the capabilities created by groups plugin that are assigned to the author of the post (that is a user belonging to a group with custom capability).
I’ve seen the class Groups_User_Capability, and then I thought that I could use the Read object of this class, but in the xx_groups_user_capability table there are no any rows, so, ?when did you add the user_id and capability_id relation inside it? ?How can I retrieve all the ggroups and all the capabilites related to a user?
I know that I can do it wiht a custom select like this:
“SELECT user_id, caps.group_id, caps.capability_id, capability FROM mom_groups_user_group as groups inner join mom_groups_group_capability as caps on groups.group_id = caps.group_id inner join mom_groups_capability as cap on caps.capability_id = cap.capability_id where user_id = $current_author_user_id order by user_id”
But, I wonder that there is a better way to do this.
Thanks in advance!
- The topic ‘How to get capabilities of post author’ is closed to new replies.