How to Size an Avatar in BuddyPress

BuddyPress is "social networking in a box," as it allows you to create your own Facebook-like network with a few clicks. You can have your own Avatar, or small picture, that appears on all of your posts. You can change the size of a BuddyPress Avatar with a simple PHP custom code. Changing the size allows you to change the look and feel of your BuddyPress site.

Instructions

  1. PHP Customization

    • 1

      Create a new "bp-custom.php" file that has the new sizes you want your Avatar to appear in.

    • 2

      Go to your WordPress files and click on the "wp-content/plugins" directory.

    • 3

      Open the current Avatar code by going to your cPanel in your hosting site. Look for the "bp-core-avatars.php" file. Copy the code and paste it into a text document.

    • 4

      Look at the current code and change the width and height to your specifications. The code will look something like this:

      "if ( !defined('BP_AVATAR_THUMB_WIDTH'))

      define('BP_AVATAR_THUMB_WIDTH', 50);

      "if ( !defined('BP_AVATAR_THUMB_HEIGHT'))

      define('BP_AVATAR_THUMB_HEIGHT', 50);

      The default for the Avatar thumbnail is 50 by 50 pixels. Where "50" appears in the example above is where you want to change it to your sizing.

    • 5

      Change the full-size avatar by following the same step. The full-size avatar code will look like this:

      "if ( !defined('BP_AVATAR_FULL_WIDTH'))

      define('BP_AVATAR_FULL_WIDTH', 150);

      "if ( !defined('BP_AVATAR_FULL_HEIGHT'))

      define('BP_AVATAR_THUMB_HEIGHT', 150);

      The default for the full avatar size is 150 by 150 pixels.

    • 6

      Save the code document as "bp-custom.php" and upload it to the "wp-content/plugins" directory in your cPanel.

    Test Sizing

    • 7

      Upload a new avatar using BuddyPress with the new size parameters.

    • 8

      Save the new avatar in BuddyPress.

    • 9

      Load your preferred browser and see if the new sizes are registering.

Tips & Warnings

  • You can change the default sizes in "bp-core-avatars.php," but if you want to quickly revert back to the original sizes, just create a new custom sizing code.

  • Do not delete the original "bp-core-avatars.php" file. Always keep a backup.

Related Searches:

References

Comments

Related Ads

Featured