BuddyDev

Search

Replies

  • Participant
    Level: Guru
    Posts: 907

    Thanks Ravi

    I hope this can be resolved soonest as new members on my site arent uploading new profile photos

    Regards

  • Participant
    Level: Guru
    Posts: 907

    Hello Ravi

    The code did not work, the code you provided removed the profile photos I set for the member types. I dont want the custom profile photos to be removed but I want the saved membertype profile photo to be compatible and work along side the buddypress profile completion plugin.

  • Participant
    Level: Guru
    Posts: 907

    Gentle reminder sir thanks

  • Participant
    Level: Guru
    Posts: 907
    Tosin on in reply to: Sticky Members in BuddyPress #51321

    I really love this idea and its also been on my mind for long now, since I didnt know if this was possible I just decided to stick with the buddypress featured members plugin.

    I would be awesome if there is an option to also make featured members sticky

  • Participant
    Level: Guru
    Posts: 907
    Tosin on in reply to: [Resolved] Getting started / hide the @username #51318

    Hi apologies for the confusion I meant (Disable
    Activity Streams) feature. The @username feature is enabled when the Activity Streams feature is enabled

  • Participant
    Level: Guru
    Posts: 907
    Tosin on in reply to: [Resolved] Getting started / hide the @username #51308

    There are various options depending if you want to partially diasable @mentions or completely disable it.

    1.

    add_filter( 'bp_activity_do_mentions', '__return_false' );

    2. Removes mentions pane from profile activity (doesn’t remove mention functionality)

    
     function remove_mention_nav() {
    global $bp;
    bp_core_remove_subnav_item( $bp->activity->slug, 'mentions' );
    }
    add_action( 'bp_setup_nav', 'remove_mention_nav', 15 ); 
    

    3.Just hide with css

    
     /* Hide username in BuddyPress profile header */
    #item-header .username {
        display: none;
    } 
    

    4. Just disable public message feature in buddypress settings

  • Participant
    Level: Guru
    Posts: 907
    Tosin on in reply to: [Resolved] Getting started / hide the @username #51305

    Hi

    Regarding the security issue I think you don’t need to hide the username, you can disable login by username and enable login by only email. Email addresses arent publicly displayed there by improving login security. I was able to achieve this with the code below.

     // Function to log in with email instead of username
    function use_email_for_login($user, $username, $password) {
        if (!empty($username) && !empty($password)) {
            // Check if the entered username is an email
            if (is_email($username)) {
                // Get the user by email
                $user = get_user_by('email', $username);
                if (!$user) {
                    // Email not found, return an error
                    return new WP_Error('invalid_email', __('Invalid email or password.'));
                } else {
                    // Authenticate the user with the retrieved username
                    $username = $user->user_login;
                    $user = wp_authenticate_username_password(null, $username, $password);
                    if (is_wp_error($user)) {
                        // Authentication failed, return an error
                        return new WP_Error('invalid_login', __('Invalid email or password.'));
                    }
                }
            } else {
                // If the entered username is not an email, return an error
                return new WP_Error('invalid_email_format', __('Invalid email or password.'));
            }
        }
        return $user;
    }
    add_filter('authenticate', 'use_email_for_login', 20, 3); 
  • Participant
    Level: Guru
    Posts: 907

    Thank you Ravi,

    This code below worked for me

     function custom_modify_visibility_levels($allowed_visibilities) {
        // Add a new visibility level for 'My Followers'
        if (function_exists('bp_follow_is_following')) {
            $allowed_visibilities['followers'] = array(
                'id'    => 'followers',
                'label' => __('My Followers', 'buddypress')
            );
        }
    
        return $allowed_visibilities;
    }
    add_filter('bp_xprofile_get_visibility_levels', 'custom_modify_visibility_levels');
    
    // Adjust visibility based on followers
    function custom_get_hidden_visibility_types_for_user($hidden_levels, $displayed_user_id, $current_user_id) {
        if ($displayed_user_id != $current_user_id && !bp_follow_is_following(array('leader_id' => $displayed_user_id, 'follower_id' => $current_user_id)) && !is_super_admin()) {
            $hidden_levels[] = 'followers'; // Hide profile field with 'My Followers' visibility level for the user
        }
        return $hidden_levels;
    }
    add_filter('bp_xprofile_get_hidden_field_types_for_user', 'custom_get_hidden_visibility_types_for_user', 10, 3); 
  • Participant
    Level: Guru
    Posts: 907

    Thanks Ravi

    The code worked perfectly

  • Participant
    Level: Guru
    Posts: 907
    Tosin on in reply to: [Resolved] Buddyblog pro and buddypress 12.0.0 beta 1 #51214

    This is now resolved it was a caching issue

    Thanks