BuddyDev

Search

[Resolved] default Profile Cover Image

  • Participant
    Level: Enlightened
    Posts: 32
    Gisela Zechner on #51792

    Hi Buddy-Dev Team,

    can you tell me, is there a possibility to set a profile image by default for every member. So that there is an image instead of the grey profile-header-image-background.

    Thanks in advance
    Gisela

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2934
    Ravi on #51794

    Hello Gisela,

    Thank you for posting. Yes, you can set an image as a default profile image for all the users who do not have uploaded any profile photo. I will share the code at the day end.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2934
    Ravi on #51798

    Hello Gisela,

    Please use the following code:

    
    add_filter( 'bp_core_default_avatar_user', function ( $avatar_url, $params ) {
    
    	$type = 'full' === $params['type'] ? 'full' : 'thumb';
    
    	if ( 'full' === $type ) {
    		// Recommended 150x150 resolution.
    		//$avatar_url = 'http://example.com/6944274-150x150.png';
    	} elseif ( 'thumb' === $type ) {
    		// Recommended 50x50 resolution.
    		$avatar_url = 'http://example.com/6944274-50x50.png';
    	}
    
    	return $avatar_url;
    }, 10, 2 );
    
    

    Please give it a try and let me know.

    Regards
    Ravi

  • Participant
    Level: Enlightened
    Posts: 32
    Gisela Zechner on #51799

    Hi Ravi,
    Thanks a lot – but I need more help
    Sorry – I assume my question was not exactly – The “profile-header-image-background” – I meant the “Cover-Image” How can I set a cover image by default for all members, if they don’t upload an own image.

    I have added the code, but where can I upload a default image for all members?
    Maybe I did not upload the code in the right file. Where should I add the code?

    Thanks in advance
    Gisela

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2934
    Ravi on #51803

    Hello Gisela,

    Sorry, I understood your requirement wrongly. Please use the following code:

    
    add_filter( 'bp_before_members_cover_image_settings_parse_args', function ( $settings ) {
    	// Use 1300x225 resolution.
    	$settings['default_cover'] = 'http://example.com/65dd8d5628062-bp-cover-image.jpeg';
    
    	return $settings;
    }, 20 );
    
    

    It may depend on your theme. Please give it a try and let me know if it works or not.

    Regards
    Ravi

  • Participant
    Level: Enlightened
    Posts: 32
    Gisela Zechner on #51809

    Hi Ravi,
    thank you! it works perfect.
    I have the theme AVADA

    Best wishes
    Gisela

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2934
    Ravi on #51817

    Hello Gisela,

    Thank you for the acknowledgement. I am glad that I could help.

    Regards
    Ravi

You must be logged in to reply to this topic.

This topic is: resolved