BuddyDev

Search

Replies

  • Participant
    Level: Initiated
    Posts: 14
    Nicola Fern on #27922

    OK thanks Brajesh, I’ll bring it up with BuddyBoss.

  • Participant
    Level: Initiated
    Posts: 14
    Nicola Fern on #26232

    Thanks Brajesh, that seems to be working 🙂

    Nic

  • Participant
    Level: Initiated
    Posts: 14
    Nicola Fern on #26224

    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
    Nicola

  • Participant
    Level: Initiated
    Posts: 14
    Nicola Fern on #25229

    Hi, Is there any resolution to this?

    Thanks,
    nic

  • Participant
    Level: Initiated
    Posts: 14
    Nicola Fern on #25128

    Hi 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 );
    
  • Participant
    Level: Initiated
    Posts: 14
    Nicola Fern on #25058

    Hi Ravi

    Unfortunately this didn’t seem to work – it removed the UI everywhere, and made the specified group anonymous only again

    Thanks
    Nicola

  • Participant
    Level: Initiated
    Posts: 14
    Nicola Fern on #24448

    Hi 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
    Nicola

  • Participant
    Level: Initiated
    Posts: 14
    Nicola Fern on #24359

    Hi

    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!
    Nic

  • Participant
    Level: Initiated
    Posts: 14
    Nicola Fern on #23145

    Hi Brajesh

    Is there any update on this? I’m hoping to go live with my site next week.

    Thanks
    Nicola

  • Participant
    Level: Initiated
    Posts: 14
    Nicola Fern on #22716

    Excellent thanks so much 🙂

    Have a great day!

    Nic