This topic has 9 replies, 4 voices, and was last updated 9 years by Radu.

  • Author
  • #78832
     tmh23
    Participant

    Not sure if you can help with this or if its buddypress support. I would like to have a custom default profile load if members don’t upload a profile photo. Currently it is the ‘grey mystery man’. This gets lost on my maps using GeoMyWP. Where can I upload a new default avatar image to be used?

    Thanks,
    Troy

    #78919
     Radu
    Moderator

    Hi,

    Just use this function in kleo-child/functions.php

    COPY CODE
    
    //Custom avatar for no avatar user
    function myavatar_add_default_avatar( $url ){
    return 'http://www.socialagent.me/wp-content/uploads/2014/07/avatarDefault.png';
    }
    add_filter( 'bp_core_mysteryman_src', 'myavatar_add_default_avatar' );
    

    Replace http://www.socialagent.me/wp-content/uploads/2014/07/avatarDefault.png with your default avatar img url.

    Regards

    Radu

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #79032
     tmh23
    Participant

    Perfect! Thank you!!

    #122229
     lorndal
    Participant

    Hi,
    the script above works localhost very fine.
    But not in my online-community, I´m configurating separatly.

    A few weeks ago, i´ve changed the avatar options online.( Allow and Forbid personal avatar photos)
    At the moment it is set to:
    Profile Photo Uploads Allow registered members to upload avatars

    Online, the avatar is complete white.
    The Browser sais it would be an image and i can safe it:
    425ad04d0137b838ba1c40688324ffc6.png
    But this is no real image, when i open the file in photoshop its black and in the file-system its without content.

    Now I would like to know, where else I could make settings to the avatar, so that the “white” dissappear and the avatarDefault.png shows up?

    When I select Profile Photo in the backend, everything works fine. But when I delete the profile photo, the “white” shows up again.

    Many thanks
    Sandra

    #122287
     Radu
    Moderator

    Hi,

    My suggestion is to re-create a transparent photo with minimum 300x300px width and height or you can choose a default avatar placeholder like this : http://www.clker.com/cliparts/A/Y/O/m/o/N/placeholder-hi.png

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #125978
     lorndal
    Participant

    Hi,
    is it possible, to separate between member and group avatars with this script in the function.php, listed above?

    function myavatar_add_default_avatar( $url ){
    return ‘http://www.socialagent.me/wp-content/uploads/2014/07/avatarDefault.png’;
    }
    add_filter( ‘bp_core_mysteryman_src’, ‘myavatar_add_default_avatar’ );

    nice greetings Sandra

    #126084
     Radu
    Moderator

    You can check if is groups component like that

    COPY CODE
    
    function myavatar_add_default_avatar( $url ){
    
    	if ( bp_is_group_component() ) {
    
    	return 'http://www.socialagent.me/wp-content/uploads/2014/07/avatarDefault.png';
    	add_filter( 'bp_core_mysteryman_src', 'myavatar_add_default_avatar' );
    
    	}
    
    }
    

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #126160
     CarlenY
    Participant

    Is it possible to hide members from the directory if they don’t have an avatar yet?

    #126178
     lorndal
    Participant

    Hi Radu,
    this script is not working as it should.

    function myavatar_add_default_avatar( $url ){
    if ( bp_is_group_component() ) {
    return ‘https://www.mywebsite/community/wp-content/uploads/2016/06/default-avatar.jpg’;
    add_filter( ‘bp_core_mysteryman_src’, ‘myavatar_add_default_avatar’ );
    }}

    a total different avatar is loading:
    from: https://www.gravatar.com/avatar/9b570a6d2ea1bbd27909025157dc7a6b?s=50&r=g&d=mm

    and the script makes no differences between group and member avatars.
    What do I have to improve?
    thanks nice greetings Sandra

    #126212
     Radu
    Moderator

    Hi guys,

    @Carleny

    Follow this : https://buddypress.org/support/topic/show-only-members-with-avatars-on-member-loop/ and this https://buddypress.org/support/topic/hide-profiles-without-avatars/

    ———————


    @lorndal
    Follow this tutorial https://premium.wpmudev.org/blog/how-to-add-a-custom-default-avatar-for-buddypress-members-and-groups/ and remove the code from before.

    A plugin for group avatars : https://eu.wordpress.org/plugins/bp-default-group-avatar/

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 10 posts - 1 through 10 (of 10 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?