Search Results for 'bp_core_fetch_avatar'
-
AuthorSearch Results
-
May 26, 2011 at 10:44 pm #113150LawrenceParticipant
@djpaul: Thanks Paul, I would really appreciate any thoughts and feedback when its out, as I can imagine the coding will be a little hazy in places. Should be fairly easy to understand though.
May 26, 2011 at 10:25 pm #113149Paul Wong-GibbsKeymasterHey, looks like a novel approach — I’ll have a play when you get the plugin out
May 26, 2011 at 10:03 pm #113148LawrenceParticipantGood news all… I’ve finally got this working as intended, and I’m currently in the process of packing it all together in to a plugin for release to the community over the next few days. Just creating a small webpage where people can download it, and I’ll hopefully have an online user guide.
Screenshot:
http://www.obscuresounds.com/obscureavatar-beta.jpgFor now it works like this:
1. designers can create transparent png “parts” of an avatar divided in to 3 sections (body, face, head).
2. the plugin can differentiate between male and female by parsing in a string (m, or f), so again designers can create gender specific avatars based on needs.
3. users who upload avatars via BP will bypass obscureavatars, and the plugin will only use gravatar as a last resort for groups, and blogs.
4. it works for both wordpress, and buddypress.Essentially it sets out to do what I’ve wanted – to make the avatars a bit easier to work with for designers. Although I mainly develop backend stuff I love UI design, and one thing I’ve noticed is that pretty much all wordpress projects either use gravatars tacky generated content, or the dull wordpress avatar. Not only that but they fail to facilitate basic gender styles, which is essential for social network propagation now-days.
I want to continue developing this in to something more sophisticated (I’m thinking it would be cool if designers could zip their parts in to packs, so that people can interchange them in an instant), but I will only be able to do this based on its popularity and support.
May 11, 2011 at 7:17 am #112060In reply to: How to print out an Avatar from a user ID
jamz86MemberIf you’re trying to pull just the avatar from within a loop, this shows how to do that:
http://wpmu.org/how-to-create-a-gallery-of-members-avatars-in-buddypress/
If you’re trying to pull up someone’s avatar simply by ID, use bp_core_fetch_avatar() like this:
`
<?php
global $bp;
$the_avatar = $bp->displayed_user->id; //you’d put in whatever function you’re using to get the ID here, assign it to a variable
echo bp_core_fetch_avatar( ‘item_id=’.$the_avatar );
?>
`Look up bp_core_fetch_avatar() as there are a lot more options than this. For example, do you want a thumbnail or full sized image? There is a way to specify. Hope that helps!!
May 10, 2011 at 8:19 pm #112002In reply to: Impossible to get avatars in a custom AJAX search?
Boone GorgesKeymasterExactly what is your AJAX returning? Is the first part (span.searchheading) coming through OK?
You might try (just for the heck of it) switching your argument structure to an array, something like this:
echo bp_core_fetch_avatar( array( 'item_id' => $row ) );
Theoretically, it shouldn’t matter, but sometimes it does.
If you’re still having troubles, start dropping var_dump() statements into bp_core_fetch_avatar() itself. You can find that function in bp-core/bp-core-avatars.php.
April 29, 2011 at 1:15 am #111285In reply to: How to disable Gravatar completely?
Brandon AllenParticipantYou can easily change the default avatar in your dashboard under BuddyPress > General Settings. The reason it doesn’t use the WordPress avatar setting is because BuddyPress is designed to be it’s own site with it’s own settings. If you want to disable gravatar support completely you can set no_grav to true in your theme’s bp_core_fetch_avatar function calls. This will be made even easier when 1.3 is released.
April 28, 2011 at 6:41 am #111228In reply to: Avatars Original Max not bein saved?
r-a-yKeymasterBP_AVATAR_ORIGINAL_MAX_WIDTH is used during the initial upload. However, during the cropping phrase, this original image is deleted.
It would be possible to do what you’re asking, but it would entail hooking into the avatar cropping process (so the original image isn’t removed) and filtering bp_core_fetch_avatar() to grab this original image when you want to call it.
April 19, 2011 at 10:27 pm #110582In reply to: Woke Up Mysteriously with a Fatal Error
BigjimmysiscoMemberHmm… ok thanks. I copied the file from that template and pasted it in my file. Looks like it fixed that error but now i got another one!!
`Fatal error: Call to undefined function: bp_core_fetch_avatar( $args = ” ) in /home/***/****/****/bp-core/bp-core-avatars.php on line 60`
April 8, 2011 at 6:16 pm #109837HenryMemberHope you do well with this, I would also be interested in using this.
I’m sure many others would too!
April 8, 2011 at 4:51 pm #109831tiki16ParticipantHi I am looking to utilise something like this. Any progress?
thanksApril 6, 2011 at 6:20 pm #109684In reply to: [RESOLVED(ish)] Update avatar automagically
r-a-yKeymasterCheck out the “bp_core_mysteryman_src” and “bp_core_fetch_avatar” filters located in /bp-core/bp-core-avatars.php.
This article details a little bit of how to do it:
http://wpmu.org/how-to-add-a-custom-default-avatar-for-buddypress-members-and-groups/March 29, 2011 at 1:59 pm #109040LawrenceParticipantThanks guys… sorry for taking such a long time to update on this. Ended up having to work on some other projects. I’ve managed to get the custom avatar generator to function okay now, and have a live project that uses it (http://school.ocdaction.org.uk/), but I need to tidy up the code a little. At the moment I’m having to plug the wordpress avatar function (get_avatar) and use that for my rendering duties. What I’d like to happen is for the bp dev team to make their bp_core_fetch_avatar pluggable, as it doesnt really have much scope for extending in its current state. Maybe I’m wrong, but if someone has more knowledge of how to alter bp_core_fetch_avatar for my needs then that would be awesome. I did think of filtering, but one aspect of bp_core_fetch_avatar I don’t particulary see the need of is that it pushes the final img url through http://www.gravatar.com, which in my opinion is a wasted resource, as this plugin would only read directly off the parts folder when it generates an avatar, and then loads from a cache dir.
Welcome any thoughts on this.
March 29, 2011 at 9:35 am #109018In reply to: headers already sent error in ajax.php
amittrehanMemberthank you mercime for replying. its the ajax.php that is the problem. this is the error that i get
‘Warning: Cannot modify header information – headers already sent by (output started at /…./public_html/chill/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/ajax.php:553) in /…./public_html/chill/wp-content/plugins/buddypress/bp-messages.php on line 556’. i have already checked the above link.
line 553 in ajax.php is this below line code:
‘echo bp_core_fetch_avatar(array(‘item_id’ =>$user_id,’type’=>’thumb’,’width’=>15,’height’ =>15)).’ ’.bp_core_get_user_displayname($user_id).’(‘.$username.’)’;
} ‘regards
amitMarch 19, 2011 at 7:45 pm #108266March 14, 2011 at 11:26 pm #107799In reply to: Recent Post plugin
r-a-yKeymaster@rogerwhitson – In response to this, you add the bp_core_fetch_avatar() function in your recent post loop.
It would look something like this:
` $user_id ) ); ?>`
I’m guessing that the recent posts loop is a widget; you’d have to add the code above into the widget’s code somewhere.
You would also have to pass the $user_id properly in the loop.
March 12, 2011 at 9:09 am #107606In reply to: Is it possible to get only the avatar-url ?
xavieremersonMemberhi
here is the solution for getting the avatar image url
bp_core_fetch_avatar(array(‘item_id’ => $other_user, ‘type’ => ‘thumb’, ‘width’ => 32, ‘height’ => 32, ‘class’ => ‘friend-avatar’,’html’=>false));html = false
March 7, 2011 at 8:28 pm #107109In reply to: How do I add a menu item on the profile page?
VirtualiParticipantWait… do you mean a subnav? Like for instance, under profile, the subtabs are “Edit Profile, and Change Cignature?”
Could be done, wrap the bp_core_new_subnav_item call in a function which is hooked on xprofile_setup_nav action;
`/* Add the subnav items */
bp_core_new_subnav_item( array( ‘name’ => __( ‘My Friends’, ‘buddypress’ ), ‘slug’ => ‘my-friends’, ‘parent_url’ => $friends_link, ‘parent_slug’ => $bp->friends->slug, ‘screen_function’ => ‘friends_screen_my_friends’, ‘position’ => 10, ‘item_css_id’ => ‘friends-my-friends’ ) );
bp_core_new_subnav_item( array( ‘name’ => sprintf( __( ‘Requests (%d)‘, ‘buddypress’ ), bp_friend_get_total_requests_count() ), ‘slug’ => ‘requests’, ‘parent_url’ => $friends_link, ‘parent_slug’ => $bp->friends->slug, ‘screen_function’ => ‘friends_screen_requests’, ‘position’ => 20, ‘user_has_access’ => bp_is_my_profile() ) );if ( $bp->current_component == $bp->friends->slug ) {
if ( bp_is_my_profile() ) {
$bp->bp_options_title = __( ‘My Friends’, ‘buddypress’ );
} else {
$bp->bp_options_avatar = bp_core_fetch_avatar( array( ‘item_id’ => $bp->displayed_user->id, ‘type’ => ‘thumb’ ) );
$bp->bp_options_title = $bp->displayed_user->fullname;
}`There ya go, 2 in one!
March 5, 2011 at 3:56 am #106871In reply to: [resolved] display member avatar giving his id
r-a-yKeymasterThat’s the WP version of grabbing the avatar.
You can also try the BuddyPress way:
`echo bp_core_fetch_avatar( array( ‘item_id’ => $id, ‘width’ => $width, ‘height’ => $height ) );`A list of full parameters can be found by looking at the source:
https://trac.buddypress.org/browser/tags/1.2.8/bp-core/bp-core-avatars.php#L50March 2, 2011 at 2:13 pm #106667CamParticipantI am a complete newbie when it comes to this. I tried to utilize the funciton you created above and it results in an error: Unexpected return.
I imagine I am missing something obvious but here is my code:
`function my_blog_avatar_1( $old_avatar ) {
bp_core_fetch_avatar( array( ‘item_id’ => ‘1’, ‘type’ => $type, ‘alt’ => $alt, ‘width’ => $width, ‘height’ => $height, ‘class’ => $class ) ) // Do some stuff to get the avatar you want, then
return $new_avatar;
}
add_filter( ‘bp_get_blog_avatar_1?, ‘my_blog_avatar_1’ );`Thanks in advance for your help.
February 24, 2011 at 8:50 pm #106174In reply to: Recent Post plugin
r-a-yKeymasterPass the user id as the “item_id” parameter in bp_core_fetch_avatar().
This function is located in /bp-core/bp-core-avatars.php.
January 7, 2011 at 2:56 pm #102141David BissetParticipantWas there any progress on this? I was interested in the same thing, whether if it’s code or an actual plugin.
Thanks!
December 31, 2010 at 3:43 pm #101581Boone GorgesKeymasterYou will have te create a custom function, either in your theme’s functions.php or in plugins/bp-custom.php, that filters the output of that function and replaces it with the avatar of your choice. Eg, if your blog_id is 5,
‘function my_blog_avatar( $old_avatar ) {
// Do some stuff to get the avatar you want, then
return $new_avatar;
}
add_filter( ‘bp_get_blog_avatar_5’, ‘my_blog_avatar’ );`The ‘do some stuff’ part will depend highly on your setup. If by ‘the associated group’ you mean that you are using bp-groupblog, then you will likely have to do some direct queries of the groupmeta database table to find the group that is associated with a particular blog (I don’t think that the plugin stores that info in a place that is easily accessible by blog_id). Then you will use some permutation of bp_core_fetch_avatar() to pull up the avatar for that group_id.
Good luck!
December 29, 2010 at 6:57 pm #101490In reply to: How to disable Gravatar completely?
scabadaskaMemberHi @BuddyPresser,
I would like to add to Javier’s @arques post above. His method does work but it’s missing the initial sign-up screen where gravatar is being pulled. I also rewrote his path a bit. This should do the trick for killing all Gravatar calls. If someone has more time than I it would be great to have this in plugin form. Here is the code:
`
function bp_remove_gravatar ($image, $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir) {$default = get_stylesheet_directory_uri() .’/_inc/images/bp_default_avatar.jpg’;
if( $image && strpos( $image, “gravatar.com” ) ){
return ‘‘;
} else {
return $image;}
}
add_filter(‘bp_core_fetch_avatar’, ‘bp_remove_gravatar’, 1, 9 );function remove_gravatar ($avatar, $id_or_email, $size, $default, $alt) {
$default = get_stylesheet_directory_uri() .’/_inc/images/bp_default_avatar.jpg’;
return ““;
}add_filter(‘get_avatar’, ‘remove_gravatar’, 1, 5);
function bp_remove_signup_gravatar ($image) {
$default = get_stylesheet_directory_uri() .’/_inc/images/bp_default_avatar.jpg’;
if( $image && strpos( $image, “gravatar.com” ) ){
return ‘‘;
} else {
return $image;
}}
add_filter(‘bp_get_signup_avatar’, ‘bp_remove_signup_gravatar’, 1, 1 );
`The image that I am referencing doesn’t have to be a JPG. The size is 150×150. You may have to adjust the file name and/or path to your liking.
Thanks @arques for the initial code!
November 12, 2010 at 2:59 am #98097In reply to: User/Group avatar URL *without* IMG tag
r-a-yKeymasterIf you need to stay on BP 1.2.4, you could probably just copy the part of the bp_core_fetch_avatar() function that adds support for the ‘html’ parameter… but I’d strongly suggest upgrading when you have the chance.
See the codex article on upgrading:
https://codex.buddypress.org/buddypress-site-administration/upgrading-buddypress/November 11, 2010 at 10:32 pm #98083In reply to: User/Group avatar URL *without* IMG tag
r-a-yKeymasterTry this:
`bp_core_fetch_avatar( ‘html=false’ );`Be sure to check out the full parameters for the function in bp-core-avatars.php.
-
AuthorSearch Results