how to I change the default avatar guy?

Home Forums Cera – Intranet & Community Theme Popular Features Member Directory how to I change the default avatar guy?

This topic contains 13 replies, has 3 voices, and was last updated by  Andrea 1 month ago.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #12628

    meee
    Participant
    • 22 Posts
    @2tara

    how to I change the default avatar guy? If I go to setting – discussions they all show the same picture. I would like to get rid of crea default avatar.

    #12630

    Andrea
    Participant
    • 108 Posts
    @youfriend

    Hi @2tara

    Ive used the child theme for change the avatars on cera-child\assets\images\avatars

    I think is the better solution without plugins and codes

    #12679

    Olivier
    Moderator
    • 1750 Posts
    @themosaurusrex
    Themosaurus Support

    Hi @2tara,

    We are aware of this limitation with the default avatars and we’re planning on addressing this by making it editable in the Customizer.

    @youfriend is correct, this is the easiest way to do it. If you wish to know more about child themes, please also read the following post:

    Creating a Child Theme

    Otherwise, if you wish to use code to change this, simply add the following snippet to your website:

    /**
      * Changing the default Cera avatars.
      */
    if ( function_exists( 'buddypress' ) ) {
       if ( ! class_exists( 'Youzer' ) ) {
          define( 'BP_AVATAR_DEFAULT',            'YOURWEBSITE/SOME-DIRECTORIES/user-avatar.png' );
          define( 'BP_AVATAR_DEFAULT_THUMB',      'YOURWEBSITE/SOME-DIRECTORIES/user-avatar-thumb.png' );
       }
    }

    To add this code snippet to your site, we recommend that you use a the Code Snippets plugin (https://wordpress.org/plugins/code-snippets/). If you have never activated this plugin, please read the following post:

    Adding Custom PHP Without Changing Your Child Theme

    Please also note that we don’t provide any theme customization. So, you shouldn’t expect other snippets from us unless it’s to fix an issue stemming from our own codebase. We always try our best to help theme users whenever we can and only provide code snippets out of courtesy to prevent them from waiting for the next update.

    Regards,

    #12682

    Andrea
    Participant
    • 108 Posts
    @youfriend

    wow, i didn’t know Code Snippets plugin its amazing. Ty

    #12704

    Olivier
    Moderator
    • 1750 Posts
    @themosaurusrex
    Themosaurus Support

    You’re welcome @youfriend! This is an awesome plugin if do not wish to build a child theme for minor changes. I’m glad to read that this recommendation might help you!

    #13170

    Andrea
    Participant
    • 108 Posts
    @youfriend

    Hey @themosaurusrex

    this code for default avatar profile work fine, and now i use code snippet instead childtheme. Wat about code for groups avatar default?

    #13217

    Olivier
    Moderator
    • 1750 Posts
    @themosaurusrex
    Themosaurus Support

    @youfriend Could you try to add the following snippet please?

    if ( function_exists( 'buddypress' ) ) {
    	/**
    	 * Change the default BP group avatar image.
    	 *
    	 * @param  string $avatar The URL for the default BP group avatar image.
    	 * @param  array $params The array of params for the default BP group avatar image.
    	 *
    	 * @return string         The updated URL for the BP group avatar image.
    	 */
    	function cera_custom_change_default_avatar_group( $avatar, $params ) {
    		$avatar = 'YOURWEBSITE/SOME-DIRECTORIES/user-group.png';
    		return $avatar;
    	}
    	add_filter( 'bp_core_default_avatar_group', 'cera_custom_change_default_avatar_group', 10, 2 );
    }

    Thank you.

    #13222

    Andrea
    Participant
    • 108 Posts
    @youfriend

    Not work 🙁

    Also BP_AVATAR_DEFAULT_THUMB have an issue on “widget members” load and when im try to navigate pages on members directory.

    #13249

    Olivier
    Moderator
    • 1750 Posts
    @themosaurusrex
    Themosaurus Support

    @youfriend I’m sorry, the code priority was way too high and thus the code was running before theme. Could replace the snippet from https://support.themosaurus.com/forums/topic/how-to-i-change-the-default-avatar-guy/#post-13217

    With the following:

    if ( function_exists( 'buddypress' ) ) {
    	/**
    	 * Change the default BP group avatar image.
    	 *
    	 * @param  string $avatar The URL for the default BP group avatar image.
    	 * @param  array $params The array of params for the default BP group avatar image.
    	 *
    	 * @return string         The updated URL for the BP group avatar image.
    	 */
    	function cera_custom_change_default_avatar_group( $avatar, $params ) {
    		$avatar = 'https://www.gravatar.com/avatar/?d=mp&s=72';
    		return $avatar;
    	}
    	add_filter( 'bp_core_default_avatar_group', 'cera_custom_change_default_avatar_group', 1000, 2 );
    }

    It do the trick. (Please see attached.)

    #13250

    Olivier
    Moderator
    • 1750 Posts
    @themosaurusrex
    Themosaurus Support

    @youfriend Could post a screenshot of your widgets please? This change is the same as those made by Grimlock for BuddyPress, it should work in both cases. Thank you.

    #13266

    Andrea
    Participant
    • 108 Posts
    @youfriend

    awwnn 😀 , now the code work perfectly for groups. TY

    As you can see from the screens, when there is a loading process from page navigation, the avatar set to the code does not work in members directory page.
    Same on widget members.

    #13306

    Olivier
    Moderator
    • 1750 Posts
    @themosaurusrex
    Themosaurus Support

    @youfriend Thank you very much for your precious feedback. My understanding is that BuddyPress is bypassing our snippet each time it uses AJAX to load new data from your server.

    We will investigate further to find from where this issue is coming from.

    We will be back to you ASAP.

    Thank you for your patience.

    #14309

    Olivier
    Moderator
    • 1750 Posts
    @themosaurusrex
    Themosaurus Support

    Just for know if possible, or i’ll back with child-theme. My users asked me why this strange avatar appear sometimes 🤣

    @youfriend Very sorry about this. I’m glad to read that they’re keeping their sense of humor. 😀

    This should be solved very soon(ish). Grimlock for BuddyPress v 1.3.5 will be release next week. This has been included in the task list for v 1.3.6.

    Hopefully, you won’t wait for too long now.

    #14314

    Andrea
    Participant
    • 108 Posts
    @youfriend

    Cool! <3 I’m Lovin’ It

Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.