[buddypress-trac] [BuddyPress Trac] #5121: Review and improve capabilities checks
buddypress-trac
noreply at wordpress.org
Fri Jun 19 00:19:32 UTC 2015
#5121: Review and improve capabilities checks
------------------------------------+------------------------------
Reporter: ericlewis | Owner: johnjamesjacoby
Type: enhancement | Status: accepted
Priority: normal | Milestone: Future Release
Component: API - Roles/Capability | Version:
Severity: normal | Resolution:
Keywords: dev-feedback |
------------------------------------+------------------------------
Comment (by r-a-y):
Nice work so far, thebrandonallen.
One thing I dislike in `5121.01.groups.patch` is needing to hardcode
`bp_get_root_blog_id()` everywhere when using `bp_current_user_can()`.
attachment:6501.02.patch:ticket:6501 should fix this.
Then, you can omit the `bp_get_root_blog_id()` call:
{{{
$can = bp_current_user_can(
'edit_group',
array( 'group_id' => $args['item_id'], )
);
}}}
And `bp_current_user_can()` will automatically fallback to using the BP
root blog ID.
To set a custom blog ID, you can do something like this:
{{{
$can = bp_current_user_can(
'edit_group',
array( 'blog_id' => 999, 'group_id' => $args['item_id'], )
);
}}}
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5121#comment:23>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list