Skip to:
Content
Pages
Categories
Search
Top
Bottom

Changing avatar size?

  • @mrgiblets

    Participant

    I’m trying to change the avatar size in members-loop.php

    After about an hour I managed to find that bp_member_avatar() is being defined in bp-members-template.php

    Luckily in that file there is a nice list of all the things that you can do with it :

    @type string $alt Default: 'Profile picture of [user name]'.
    	 *     @type string $class Default: 'avatar'.
    	 *     @type string $type Default: 'thumb'.
    	 *     @type int|bool $width Default: false.
    	 *     @type int|bool $height Default: false.
    	 *     @type bool $id Currently unused.
    	 *     @type bool $no_grav Default: false.

    But absolutely no example of how to formulate these arguments at all. (again!)

    I’ve tried all of the below and nothing works :

    bp_member_avatar(75,75);
    bp_member_avatar('75','75');
    bp_member_avatar("75","75");
    bp_member_avatar($height="75", $width="75");
    bp_member_avatar($height='75', $width='75');
    bp_member_avatar($height=75, $width=75);

    I’ve also tried changing the class and some other things using similar methods and I can’t get anything working at all.

    Could somebody please shed some light on how the arguments are supposed to be passed please?

Viewing 3 replies - 1 through 3 (of 3 total)
  • @mrgiblets

    Participant

    Ok just found this, I think this will achieve the same thing in a different way :

    Customizing BuddyPress Avatars

    But I’d still like to be able to give the members page avatars a different class, so instead of it rendering img.avatar it would output img.ml_avatar for example.

    Any ideas how to pass that new class arg here?

    @mrgiblets

    Participant

    Ok found out how to pass a new class :

    bp_member_avatar($args = 'class="mynewclass"');

    But still can’t work out how to set the size via the args?

    @henrywright

    Moderator

    Hi @mrgiblets

    The avatar sizes are set via constants that you can override.

    Check out this article for more info: https://codex.buddypress.org/themes/guides/customizing-buddypress-avatars/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Changing avatar size?’ is closed to new replies.
Skip to toolbar