Opened 6 years ago
Closed 5 years ago
#8423 closed defect (bug) (worksforme)
About the filter: bp_nouveau_current_user_can
| Reported by: | dunhakdis | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Core | Version: | 7.1.0 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
Hi everyone, I'm not sure how if this is a bug or this is how it intended to work but I'm confuse with how bp_nouveau_current_user_can filter works.
<?php // return is being overwritten by the the next filter. Returns true instead of false. add_filter("bp_nouveau_current_user_can", function( $is_loggedin, $cap, $uid ){ if ( $cap === "publish_activity" ) { return false; } return $is_loggedin; }, 20, 3); // overwiting previous filter. add_filter("bp_nouveau_current_user_can", function( $is_loggedin, $cap, $uid ){ if ( $cap === "comment_activity" ) { return true; } return $is_loggedin; }, 20, 3);
When on activity stream, the previous filter is being overwritten regardless of $cap.
Thanks!
Change History (1)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
It works as expected for me. Using the above filter a user cannot publish new activities but can comment existing ones.