Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to change the activity avatar size


  • ajay25
    Participant

    @ajay25

    Hi,

    I have gone through around 10 topics on this issue and all of them have given the solution of changing the avatar size. But, I am looking forward for changing the avatar size that is seen in the activity and comments.

    I created bp_custom.php file and tried the below mentioned code but it was of no use. Please help me.

    <?php
    define ( 'BP_AVATAR_THUMB_WIDTH', 80 );
    define ( 'BP_AVATAR_THUMB_HEIGHT', 80 );
    define ( 'BP_AVATAR_ORIGINAL_MAX_WIDTH', 640 );
    define ( 'BP_ACTIVITY-AVATAR_THUMB_WIDTH', 80 );
    define ( 'BP_ACTIVITY-AVATAR_THUMB_HEIGHT', 80 );
    ?>

    I also tried using the code as mentioned below in CSS but of no use.

    div.activity-avatar img.avatar {
    height: 40px;
    width: 40px;
    }

    Note: I am using the default theme of buddypress

Viewing 12 replies - 1 through 12 (of 12 total)

  • danbp
    Moderator

    @danbp

    Note: I am using the default theme of buddypress.

    Weird ! Have you tried with Twenty Fifteen ?

    First, read here:

    Customizing BuddyPress Avatars

    Try to add the define to your child-theme functions.php, instead of bp-custom.

    Spare bandwidth… define ( 'BP_AVATAR_ORIGINAL_MAX_WIDTH', 640 ); Are you sure you want to allow such a big size for a picture who use as max full width a default size of only 150 px ? 😉


    ajay25
    Participant

    @ajay25

    Hi Danbp,

    Thank you for the reply.

    Yes, I went through the document that you have suggested and only after that I did as mentioned above by me.

    In the document, it is mentioned as below.

    “BuddyPress allows for changing the default avatar sizes using a constant. These constants are set up in /bp-core/bp-core-avatars.php. If you want to change their values, you will need to create and/or edit your bp-custom.php file. Here are the available options:

    define ( ‘BP_AVATAR_THUMB_WIDTH’, 50 );
    define ( ‘BP_AVATAR_THUMB_HEIGHT’, 50 );
    define ( ‘BP_AVATAR_FULL_WIDTH’, 150 );
    define ( ‘BP_AVATAR_FULL_HEIGHT’, 150 );
    define ( ‘BP_AVATAR_ORIGINAL_MAX_WIDTH’, 640 );
    define ( ‘BP_AVATAR_ORIGINAL_MAX_FILESIZE’, $max_in_kb );”

    But this only changes the avatar but not the avatar that is in the activity stream.


    danbp
    Moderator

    @danbp

    When you override CSS, use !important to get the new rule to work. Cibling the ID is also a good practice in this case.

    #buddypress div.activity-avatar img.avatar {
    height: 40px!important;
    width: 40px!important;
    }

    ajay25
    Participant

    @ajay25

    Hi,

    As per the link that you shared, I created a child theme and a style.css in it.

    I used the code as mentioned above but it didn’t work. Unable to know where I am making a mistake.


    ajay25
    Participant

    @ajay25

    Hi,

    Please ignore the previous message.

    1) I created a new child theme and created a style.css and function.php.
    2) In function.php, I used the below code. It changed the size of the profile pic but not the size of the profile pic in the activity stream

    define ( 'BP_AVATAR_THUMB_WIDTH', 80 );
    define ( 'BP_AVATAR_THUMB_HEIGHT', 80 );
    define ( 'BP_AVATAR_FULL_WIDTH', 175 );
    define ( 'BP_AVATAR_FULL_HEIGHT', 175 );
    define ( 'BP_AVATAR_ORIGINAL_MAX_WIDTH', 300 );

    danbp
    Moderator

    @danbp

    Use the CSS for this, as said previously.


    ajay25
    Participant

    @ajay25

    Hi,

    I added the above mentioned code in the style.css of my child theme an the result is negative.

    Code that I added to the style.css is as mentioned below.

    #buddypress div.activity-avatar img.avatar {
    height: 80px!important;
    width: 80px!important;
    }

    I checked the same in “twentyfifteen” theme and the issue is the same.


    danbp
    Moderator

    @danbp

    Remove the defines from bp-custom or functions.php and use only the CSS.
    CSS was successfully tested on twenty thirteen.
    Use also F5 to refresh your screen.


    ajay25
    Participant

    @ajay25

    Hi,

    Completely deleted the functions.php from child theme and bp-custom.php from the plugins folder. Used only the below mentioned code in style.css file which is located in the child theme. Unable to know where I am doing the mistake. There was no change after I did this.

    /*
    Theme Name: My Theme
    Theme URI: http://example.org/themes/dusk/
    Description:
    Version: 1.0
    Author: Admin
    Author URI:
    Template: bp-default
    Tags: buddypress, two-column, grey, dark
    */
    #buddypress div.activity-avatar img.avatar {
    height: 80px!important;
    width: 80px!important;
    }

    ajay25
    Participant

    @ajay25

    Hi,

    Addition to the above post, please find the screen shots

    null


    danbp
    Moderator

    @danbp

    The mistake comes from you ! You probably confused bp-legacy and bp-default. You must use the id’s and classes used by bp-default theme, not thoose comming from buddypress legacy templates.

    BP-default was designed to be used by BP < 1.7/1.9. Now, BP can be used with any theme…

    When you check for CSS names, read the page source (right click on browser screen > show source).

    First screenshot is the whats-new form. You highlighted the CSS and can see that it has nothing to do with the css rule you try to apply to activity avatar.
    The div there is called whats-new-avatar and the class is photo.

    Code source is in bp-default/activity/post-form.php

    Try
    div#whats-new-avatar .photo {}

    Idem for the second screenshot. It’s the activity page of bp-default theme, which use different names as the actual buddypress template.

    Bp-default theme is building a list for activities. Means you’re in a ul/li serrie. Avatars are somewhere inside a li.
    You have to try something like

    ul#activity-stream .photo {}

    All concerned templates are in bp-default/activity/

    Can’t help you more as i stopped to use bp-default since a few years now. Simply keep in mind that you’re working on an old theme which has not much to do with the way BP is currently handling with themes.

    Codex contains some old reference to bp-default if you have other issue with that theme.

    Keep your eyes open and have a nice day. 🙂


    ajay25
    Participant

    @ajay25

    Thank you for the suggestion danbp and for taking some time from your busy schedule. I’ll surely try to find some other theme. If you have any idea of the free themes, please do let me know.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘How to change the activity avatar size’ is closed to new replies.
Skip to toolbar