Tagged: bbpress
Hi Guys!
Is possible to disable the comment action until the users are become friends?
THANK YOU!!!
Hi Guys!
Is possible to disable the comment action until the users are become friends? I am using rtmedia.
THANK YOU!!!
Hi John,
Thank you for the question.Here is a sample code to do that.
add_filter( 'bp_activity_can_comment', function ( $can, $activity_type ) { // already protected, return. if ( ! $can ) { return $can; } $logged_user_id = get_current_user_id(); $activity_user_id = bp_get_activity_user_id(); // if not user's own activity, or not super admin // and the current user is not friends with the activity user, disable comment. if ( $logged_user_id != $activity_user_id && ! is_super_admin() && function_exists( 'friends_check_friendship' ) && ! friends_check_friendship( $logged_user_id, $activity_user_id ) ) { $can = false; } return $can; }, 20, 2 );
Please note that it will do it for all activities(including user’s activity on the group).
Also, It will not hide the comment reply button.Regards
BrajeshWow Brajesh! You are a rock!
I know you because of your picture from bbpress forum and I am feeling so lucky to have you here!
THANK YOU SO MUCH!
YOU ARE SUPER SUPER SUPER HELPFULL!
Hi John,
Thank you.It’s a pleasure. Thank you for the kind words.
Regards
Brajesh
The topic ‘ [Resolved] disable the comment action until the users are become friends’ is closed to new replies.