#6501 closed enhancement (fixed)
Allow additional arguments to be passed to bp_current_user_can()
Reported by: | thebrandonallen | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 2.4 | Priority: | normal |
Severity: | normal | Version: | 1.6 |
Component: | Core | Keywords: | has-patch |
Cc: |
Description
This brings bp_current_user_can()
in line with it's pals current_user_can_for_blog()
, current_user_can()
, and user_can()
.
This also helps pave the way for #5121.
Attachments (2)
Change History (9)
#2
@
9 years ago
02.patch
changes the second parameter for $blog_id
to an array. Older usage should be backward compatible.
This is mostly to address usage of bp_current_user_can()
in #5121.
#3
@
9 years ago
@r-a-y - Thanks for your patch. I was going to suggest the very same thing, in response to thebrandonallen's patch on #5121.
bp_current_user_can()
is still slightly different from current_user_can()
, because current_user_can()
can take a scalar as the item_id/third argument. So,
current_user_can( 'edit_post', $post_id );
vs
bp_current_user_can( 'edit_group', array( 'item_id' => $group_id ) ); // or 'group_id' or whatever
There's probably no way around this, since (a) some caps may require more than one item id, and (b) we need to provide backward compatibility for $blog_id
, but just thought I'd raise the point.
#4
@
9 years ago
bp_current_user_can() is still slightly different from current_user_can(), because current_user_can() can take a scalar as the item_id/third argument.
True, but I think the array format is easier to read for devs when coding the map_meta_caps portion. I think this beats WP core.
With WP, I don't think you can do multiple item ID checks, so that's another potential positive for BP.
Looks reasonable to me. Thanks for another patch, @thebrandonallen!