Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)

  • Abhishek Saini
    Participant

    @abhishek6394

    @andrew_long15 , you can simply add this to remove the invites tab from all the groups.

    add_filter( ‘bp_groups_user_can_send_invites’, ‘__return_false’ );


    Abhishek Saini
    Participant

    @abhishek6394

    @Kokiri
    Please change this function name “custom_bp_avatar_activity” and keep it unique and please remember this also that this will create a new activity So, you will get two activity for single profile uploads.

    // Add action to show new avatar in activity stream
    function bp_generate_custom_avatar_activity($user_id, $args) {
    // Get the user data
    $user = get_userdata($user_id);
    $user_link = bp_core_get_userlink($user_id);
    
    // Create the activity entry
    bp_activity_add(array(
    ‘user_id’ => $user_id,
    ‘action’ => sprintf(__(‘ % s has updated their avatar newly.’, ‘buddypress’), $user_link),
    ‘component’ => ‘profile’,
    ‘type’ => ‘new_avatar’,
    ‘item_id’ => $user_id,
    ));
    }
    add_action(‘bp_members_avatar_uploaded’, ‘bp_generate_custom_avatar_activity’, 10, 2);
    

    Abhishek Saini
    Participant

    @abhishek6394

    If you want to hide currunt loggedin user from member directory you can easily use this code snippet.
    `function buddyx_exclude_users( $args ) {
    if ( is_admin() && ! defined( ‘DOING_AJAX’ ) ) {
    return $args;
    }

    $excluded = isset( $args[‘exclude’] ) ? $args[‘exclude’] : array();

    if ( ! is_array( $excluded ) ) {
    $excluded = explode( ‘,’, $excluded );
    }
    $user_id = bp_loggedin_user_id();

    $user_ids = array(‘user_id’ => $user_id); // user ids to exclude.

    $excluded = array_merge( $excluded, $user_ids );

    $args[‘exclude’] = $excluded;

    return $args;
    }

    add_filter( ‘bp_after_has_members_parse_args’, ‘buddyx_exclude_users’ );


    Abhishek Saini
    Participant

    @abhishek6394

    Buddypress by default provide the creating activity on profile uploads.

    https://prnt.sc/qg-NDzJP9nll

    If you want to add your custom activity as you have given in your code snippet you can use it like this because hook is deprecated.

    // Add action to show new avatar in activity stream
    function custom_bp_avatar_activity($user_id, $args) {
    // Get the user data
    $user = get_userdata($user_id);
    $user_link = bp_core_get_userlink($user_id);

    // Create the activity entry
    bp_activity_add(array(
    ‘user_id’ => $user_id,
    ‘action’ => sprintf(__(‘ % s has updated their avatar newly.’, ‘buddypress’), $user_link),
    ‘component’ => ‘profile’,
    ‘type’ => ‘new_avatar’,
    ‘item_id’ => $user_id,
    ));
    }
    add_action(‘bp_members_avatar_uploaded’, ‘custom_bp_avatar_activity’, 10, 2);

    https://prnt.sc/DHAc_eWrYJY7


    Abhishek Saini
    Participant

    @abhishek6394


    https://prnt.sc/GdVvz9bqfmdM
    First Go to appearance section click on widgets and remove all widgets from the ” Members Directory Right Sidebar “.
    It will remove all widgets from member directory

Viewing 5 replies - 1 through 5 (of 5 total)
Skip to toolbar