Replies
OK thanks Brajesh, I’ll bring it up with BuddyBoss.
Hi Brajesh
Is there any word on this? I would just like for the anonymity to work in selected groups, but for it to be optional in those selected groups.
Many thanks
NicolaHi Ravi, here you go:
/** ANONYMOUS GROUP FUNCTIONALITY*/ /** * Disable UI. */ add_filter( 'bp_anonymous_is_valid_screen', function ( $valid ) { if ( ! bp_is_group() ) { return $valid; } // Do not show ui on anonymous groups. $anonymous_groups = array( 43, 42 );// please change with the group ids. return in_array( bp_get_current_group_id(), $anonymous_groups ); } ); /** * Custom enable for certain groups. * * @param bool $is is enabled. * @param string $context current context. * @param int $context_id context id. */ function bpanonymous_custom_enable( $is, $context, $context_id ) { if ( 'group' !== $context ) { return $is; } $allowed_groups = array( 2 );// please change with the group ids. return in_array( $context_id, $allowed_groups ); } add_filter( 'bp_anonymous_activity_is_anonymous_comment', 'bpanonymous_custom_enable', 10, 3 ); add_filter( 'bp_anonymous_activity_is_maybe_anonymous_comment', 'bpanonymous_custom_enable', 10, 3 ); add_filter( 'bp_anonymous_activity_is_anonymous_post', 'bpanonymous_custom_enable', 10, 3 );
Hi Ravi
Unfortunately this didn’t seem to work – it removed the UI everywhere, and made the specified group anonymous only again
Thanks
NicolaHi Ravi
I tested this and unfortunately it doesn’t seem to work. I notice your comment in the code says “// Do not show ui on anonymous groups.”
However I /do/ want to show it on the anonymous groups, but only those I have specified to be anonymous. At the moment, this code removes the UI from the anonymous groups and shows it on the groups where anonymity is not enabled.
Thanks
NicolaHi
Sorry to bug you on this again 🙂 Could you tell me how to tweak the code again so that it’s only on the specific group but the UI is shown so that anonymity is optional? Feedback from users suggests this would be preferred.
Thanks!
NicHi Brajesh
Is there any update on this? I’m hoping to go live with my site next week.
Thanks
Nicola