{"id":95242,"date":"2012-08-27T17:20:59","date_gmt":"2012-08-27T21:20:59","guid":{"rendered":"http:\/\/wpmu.org\/?p=95242"},"modified":"2013-04-15T15:48:49","modified_gmt":"2013-04-15T19:48:49","slug":"how-to-change-the-default-buddypress-avatar-sizes","status":"publish","type":"post","link":"https:\/\/wpmudev.com\/blog\/how-to-change-the-default-buddypress-avatar-sizes\/","title":{"rendered":"How to Change the Default BuddyPress Avatar Sizes"},"content":{"rendered":"<p>If you want to totally customize your BuddyPress community, at some point you&#8217;ll probably be interested in changing the default avatar sizes. BuddyPress avatars are nicely sized for the default theme, but your custom theme might benefit from sizing up or down from there.<\/p>\n<p>The two most often used default avatars are the thumbnail and the full size, which are 50px and 150px respectively. They basically look like this in the default theme:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-95294\" title=\"default-avatar\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2012\/08\/default-avatar1.png\" alt=\"Post image\" aria-hidden=\"true\" width=\"729\" height=\"491\" \/><\/p>\n<p>The BuddyPress codex has a list of the avatar settings that can be easily changed using <a title=\"BuddyPress internal configuration settings\" href=\"http:\/\/codex.buddypress.org\/extending-buddypress\/changing-internal-configuration-settings\/\" rel=\"noopener\" target=\"_blank\">internal configuration settings<\/a>:<\/p>\n<p>{code type=php}<br \/>\ndefine ( &#8216;BP_AVATAR_THUMB_WIDTH&#8217;, 50 );<br \/>\ndefine ( &#8216;BP_AVATAR_THUMB_HEIGHT&#8217;, 50 );<br \/>\ndefine ( &#8216;BP_AVATAR_FULL_WIDTH&#8217;, 150 );<br \/>\ndefine ( &#8216;BP_AVATAR_FULL_HEIGHT&#8217;, 150 );<\/p>\n<p>Open up <a title=\"bp-custom.php file\" href=\"http:\/\/codex.buddypress.org\/extending-buddypress\/bp-custom-php\/\" rel=\"noopener\" target=\"_blank\">bp-custom.php<\/a> and add this code to change the avatars. Adjust the numbers to achieve your preferred height and width. (This is measured in pixels.) If you don&#8217;t have a bp-custom.php file set up yet, it&#8217;s very easy. Create a blank file, name it <em>bp-custom.php<\/em> and pop this in there:<\/p>\n<p>{code type=php}<br \/>\n&lt;?php<br \/>\n\/\/ hacks and mods will go here<\/p>\n<p>?&gt;<\/p>\n<p>Make sure to place this file in the <strong>wp-content\/plugins<\/strong> directory.<\/p>\n<p>Here&#8217;s an example of the default theme with the avatar sizes changed to 70px thumbnails and 200px full size:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-95282\" title=\"bigger-avatars\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2012\/08\/bigger-avatars.png\" alt=\"Post image\" aria-hidden=\"true\" width=\"813\" height=\"536\" \/><\/p>\n<p>That&#8217;s very easy to do by simply updating those numbers in your bp-custom.php file. Play around with it until you get the sizes that you like.<\/p>\n<p>Additional defines you can set include the maximum width of the original avatar uploaded, the maximum file size of the original uploaded avatar, the image URL for the default avatar when a user hasn&#8217;t uploaded one, as well as the URL for the thumbnail of the default avatar:<\/p>\n<p>{code type=php}<br \/>\ndefine ( &#8216;BP_AVATAR_ORIGINAL_MAX_WIDTH&#8217;, 640 );<br \/>\ndefine ( &#8216;BP_AVATAR_ORIGINAL_MAX_FILESIZE&#8217;, $max_in_kb );<br \/>\ndefine ( &#8216;BP_AVATAR_DEFAULT&#8217;, $img_url );<br \/>\ndefine ( &#8216;BP_AVATAR_DEFAULT_THUMB&#8217;, $img_url );<\/p>\n<p>These settings can be very helpful if you don&#8217;t want users uploading massive high resolution images as avatars. A file size limit is quite common with many popular social networks, even if is an inconvenience for users to have to resize their photo to something smaller.<\/p>\n<p>If you have any problems or questions in resizing avatars, get in touch with us in the comments or via <a title=\"WPMU.org on Twitter\" href=\"https:\/\/twitter.com\/wpmuorg\" rel=\"noopener\" target=\"_blank\">@wpmuorg<\/a> on Twitter. We&#8217;d be happy to help you get your new avatar sizes working.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Changing the default BuddyPress avatar sizes is very easy. Check out our step-by-step tutorial.<\/p>\n","protected":false},"author":4099,"featured_media":95292,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"blog_reading_time":"","wds_primary_category":0,"wds_primary_tutorials_categories":0,"footnotes":""},"categories":[235],"tags":[80],"tutorials_categories":[],"class_list":["post-95242","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-misc","tag-avatars"],"_links":{"self":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/95242","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/users\/4099"}],"replies":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/comments?post=95242"}],"version-history":[{"count":1,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/95242\/revisions"}],"predecessor-version":[{"id":216680,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/95242\/revisions\/216680"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media\/95292"}],"wp:attachment":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media?parent=95242"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/categories?post=95242"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tags?post=95242"},{"taxonomy":"tutorials_categories","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tutorials_categories?post=95242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}