Last active
December 12, 2015 01:58
-
-
Save chriszarate/4694791 to your computer and use it in GitHub Desktop.
BuddyPress 1.6 custom site avatars.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
BuddyPress 1.6 custom site avatars. | |
Add to (or create) /wp-content/plugins/bp-custom.php. | |
Or place in theme's functions.php. | |
*/ | |
/* | |
Use a specific user's avatar for a site. | |
Replace SITEID with the id of the site (find via Network Admin > Sites). | |
Replace USERID (x3) with the id of a user whose avatar you want to use (find via Network Admin > Users). | |
*/ | |
add_filter('bp_get_blog_avatar_SITEID', 'my_avatar_user_USERID'); | |
function my_avatar_user_USERID () { | |
echo bp_core_fetch_avatar ( | |
array( | |
'item_id' => USERID, | |
'type' => 'thumb', | |
'alt' => 'SOME ALT TEXT', | |
'width' => 40, | |
'height' => 40, | |
'class' => 'avatar' | |
) | |
); | |
} | |
/* | |
You can also just return the HTML of any ole image. HACK! | |
*/ | |
add_filter('bp_get_blog_avatar_SITEID', 'my_avatar_SITEID'); | |
function my_avatar_SITEID () { | |
echo '<img src="http://mysite.com/path/to/avatar.jpg" alt="SOME ALT TEXT" class="avatar" width="40" height="40" />'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment