Skip to:

Opened 3 years ago

Closed 3 years ago

#8423 closed defect (bug) (worksforme)

About the filter: bp_nouveau_current_user_can

Reported by: dunhakdis's profile dunhakdis Owned by:
Milestone: Priority: normal
Severity: normal Version: 7.1.0
Component: Core 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.

// 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.


Change History (1)

#1 @imath
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

It works as expected for me. Using the above filter a user cannot publish new activities but can comment existing ones.

Note: See TracTickets for help on using tickets.