[buddypress-trac] [BuddyPress Trac] #8423: About the filter: bp_nouveau_current_user_can

buddypress-trac noreply at wordpress.org
Wed Jan 13 08:04:46 UTC 2021


#8423: About the filter: bp_nouveau_current_user_can
--------------------------+-----------------------------
 Reporter:  dunhakdis     |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Core          |    Version:  7.1.0
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 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
 <?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!

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/8423>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list