Search Results for 'bp_core_fetch_avatar'
-
AuthorSearch Results
-
April 30, 2012 at 6:23 am #133729
In reply to: Using BuddyPress Avatars with wp_list_comments()
Paul Wong-GibbsKeymasterWordPress’ get_avatar() should work fine. For post/page comments, I would actually suggest using get_avatar() instead of bp_core_fetch_avatar() so that your site doesn’t break if you decide to turn off or stop using BuddyPress.
April 30, 2012 at 12:38 am #133725In reply to: Using BuddyPress Avatars with wp_list_comments()
r-a-yKeymasterHi,
In your comments template, you should try using the BP avatar function:
`
if ( function_exists( ‘bp_core_fetch_avatar’ ) ) :
echo bp_core_fetch_avatar( array(
‘item_id’ => THE_USER_ID,
‘type’ => ‘full’,
‘width’ => 75,
‘height’ => 75
));
endif;
`April 7, 2012 at 8:33 pm #132635In reply to: Full BP Avatar URL
shanebpModeratorTry this:
`
global $post; // probably don’t need this
$author_id=$post->post_author;$avatar = bp_core_fetch_avatar( array( ‘item_id’ => $author_id, ‘type’ => ‘full’ ) );
echo $avatar;
`If you want to specify the height / width you can do this:
`
$avatar = bp_core_fetch_avatar( array( ‘item_id’ => $author_id, ‘type’ => ‘full’, ‘height’=>105,’width’=>105 ) );
`February 8, 2012 at 1:17 am #129437In reply to: Cannot Log Out After uploading bp-custom.php
daveC87MemberThe custom Functions I added area as follows: (When I delete the bp-custom.php everything works fine again)
// Setups up Type=Full avatar pics for BP-post author
function bp_custompost_author_avatar() {
global $post;if ( function_exists(‘bp_core_fetch_avatar’) ) {
echo apply_filters( ‘bp_post_author_avatar’, bp_core_fetch_avatar( array( ‘item_id’ => $post->post_author, ‘type’ => ‘full’, ‘width’ => ’70’, ‘height’ => ’70’ ) ) );
} else if ( function_exists(‘get_avatar’) ) {
get_avatar();
}
}// Changes order for member profile menu items
function bbg_change_profile_tab_order() {
global $bp;$bp->bp_nav = 20;
$bp->bp_nav = 30;
$bp->bp_nav = 40;
$bp->bp_nav = 50;
$bp->bp_nav = 60;
$bp->bp_nav = 70;
$bp->bp_nav = 80;$bp->bp_nav = false;
$bp->bp_nav = false;}
add_action( ‘bp_setup_nav’, ‘bbg_change_profile_tab_order’, 999 );*/// Setup the navigation
// Props to http://wordpress.stackexchange.com/questions/16223/add-buddypress-profile-menu-item for helping me figure this out
// and http://themekraft.com/customize-profile-and-group-menus-in-buddypress/
function my_setup_nav() {
global $bp;bp_core_new_nav_item( array(
‘name’ => __( ‘my adventure list’, ‘buddypress’ ),
‘slug’ => ‘my-adventure-list’,
‘position’ => 10,
‘screen_function’ => ‘my_adventure_list_link’,
‘show_for_displayed_user’ => true,
‘default_subnav_slug’ => ‘my-adventure-list’,
‘item_css_id’ => ‘my-adventure-list’
) );
}add_action( ‘bp_setup_nav’, ‘my_setup_nav’, 1000 );
function my_adventure_list_title() {
echo ‘My Adventure List’;
}function my_adventure_list_content() {
?>
<?php
}function my_adventure_list_link () {
add_action( ‘bp_template_title’, ‘my_adventure_list_title’ );
add_action( ‘bp_template_content’, ‘my_adventure_list_content’ );
bp_core_load_template( apply_filters( ‘bp_core_template_plugin’, ‘members/single/my-adventure-list’ ) );
}?>
February 7, 2012 at 12:29 am #129389In reply to: How do I insert the big avatar?
dgodotMemberThanks, mercime, but I’m not sure I understand. I’m not trying to change the size of avatars in the comments section, but rather in the sidebar for a multi-user buddypress site.
I see that in your code you’re using bp_core_fetch_avatar(). That function seems to produce the same output as get_avatar() for me — which is the avatar thumbnail scaled to whatever size I specify. Am I missing something?
February 4, 2012 at 7:51 am #129238In reply to: Changing default individual & group avatars
r-a-yKeymasterThat’s old, old code.
Use something like this to change the default group avatar:
`
// turn gravatars off
add_filter( ‘bp_core_fetch_avatar_no_grav’, ‘__return_true’ );// change the default group avatar
function ray_change_group_avatar_default() {
return ‘URL TO GROUP DEFAULT AVATAR’;
}
add_filter( ‘bp_core_default_avatar_group’, ‘ray_change_group_avatar_default’ );`Untested! This only works with gravatars turned off.
January 13, 2012 at 7:26 am #127926In reply to: Conditional Avatars
r-a-yKeymasterSince you’re using:
`add_filter( ‘bp_core_fetch_avatar_no_grav’, ‘__return_true’ );`You can also define your mystery man image with:
http://pastebin.com/AST92STzFor LINKTOYOURIMAGE.gif, try making it a transparent GIF. That’s probably the best you can do at the moment.
—
Also, a ticket was just brought up to add CSS classes to avatars:
https://buddypress.trac.wordpress.org/ticket/3922Keep an eye on that one.
January 12, 2012 at 9:05 pm #127885In reply to: Conditional Avatars
InHouseMemberIs there a filter I can add to bp-customs.php that will skip the mystery man?
`add_filter( ‘bp_core_default_avatar_no_grav’, ‘__return_true’ );`I’m already using the one that skips the Gravatar.
`add_filter( ‘bp_core_fetch_avatar_no_grav’, ‘__return_true’ );`Any ideas? My last resort would be to hack bp-core-avatars.php but I don’t want to do anything preventing upgrading of course.
January 10, 2012 at 11:45 pm #127778In reply to: [Resolved] Featured Group Widget
drummergirlParticipantFound what I needed…
$avatar = bp_core_fetch_avatar( array( ‘item_id’ => ‘4’, ‘object’ => ‘group’, ‘type’ => ‘full’, ‘avatar_dir’ => ‘group-avatars’, ‘alt’ => $alt, ‘css_id’ => $id, ‘class’ => $class, ‘width’ => $width, ‘height’ => $height ) );
January 9, 2012 at 7:42 pm #127703Towfiq I.MemberNever mind, got it. Had to write a custom function:
`function bp_custompost_author_avatar() {
global $post;if ( function_exists(‘bp_core_fetch_avatar’) ) {
echo apply_filters( ‘bp_post_author_avatar’, bp_core_fetch_avatar( array( ‘item_id’ => $post->post_author, ‘type’ => ‘full’ ) ) );
} else if ( function_exists(‘get_avatar’) ) {
get_avatar();
}
}
`December 20, 2011 at 2:57 pm #126661modemlooperModeratorIf it’s a members page use bp_core_fetch_avatar()
November 28, 2011 at 9:17 am #125126In reply to: User Avatar Hook
Paul Wong-GibbsKeymasterTake a look at BP’s bp_core_fetch_avatar_filter() function.
November 28, 2011 at 1:26 am #125115In reply to: Getting the BP post author avatar outside of loop.
r-a-yKeymasterYou shouldn’t use the members loop if you don’t need it.
A more efficient call is using bp_core_fetch_avatar() and setting the parameters there. (Make sure you use a function_exists() call if you use this approach.)
You can alternatively filter get_avatar() as well using bp_core_fetch_avatar() as well.
November 24, 2011 at 4:46 pm #124958julien760Memberhello,
I try to do the same thing. I want to display a specific picture following the gender of the members.
I use add_filter and the picture of the profil is the good one but all others pictures from sidebar, for example, are the same…
Have you finally find a solution for this issue ?
Thanks in advance,
My test 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() .’/images/bp_default_avatar.gif’;
if( $image && strpos( $image, “gravatar.com” ) ){
if ( bp_get_profile_field_data( ‘field=Gender’ ) == ‘Female’ ) {
$default = get_stylesheet_directory_uri() .’/images/def_f_avatar.gif’;
return ‘‘;
}
if ( bp_get_profile_field_data( ‘field=Gender’ ) == ‘Male’ ) {
$default = get_stylesheet_directory_uri() .’/images/def_m_avatar.gif’;
return ‘‘;
}
else {
return $image;
}
} else {
return $image;
}
}
add_filter(‘bp_core_fetch_avatar’, ‘bp_remove_gravatar’, 1, 9 );October 21, 2011 at 3:05 am #123242In reply to: Displaying User Avatar with activity
logixzMember@modemlooper understood, I was thinking that since that SQL queries pulls the userid I could somehow tie in bp_core_fetch_avatar into the equation?
September 7, 2011 at 11:12 pm #119714In reply to: Need some suggestions on this…
modemlooperModeratorFound the avatar filters but not sure how to change it to display the associated group avatar.
$object = apply_filters( ‘bp_get_activity_avatar_object_’ . $current_activity_item->component, ‘user’ );
return apply_filters( ‘bp_get_activity_avatar’, bp_core_fetch_avatar( array( ‘item_id’ => $item_id, ‘object’ => $object, ‘type’ => $type, ‘alt’ => $alt, ‘class’ => $class, ‘width’ => $width, ‘height’ => $height, ’email’ => $email ) ) );
EDIT: seems just changing user to groups will get the image.
August 28, 2011 at 4:10 am #119169In reply to: Getting group avatar, outside of loop.
dyerringtonMemberSolution: Getting the URL with bp_core_fetch_avatar() and using the option ‘html’ => false to get group images by URL rather then a whole image tag.
IE:
`
$avatar_options = array ( ‘item_id’ => ‘1’, ‘object’ => ‘group’, ‘type’ => ‘full’, ‘avatar_dir’ => ‘group-avatars’, ‘alt’ => ‘Group avatar’, ‘css_id’ => 1234, ‘class’ => ‘avatar’, ‘width’ => 50, ‘height’ => 50, ‘html’ => false );$result = bp_core_fetch_avatar($avatar_options);
`Looking at this particular code makes me nervous about performance. Is it necessary to read from the database and the filesystem to get this type of resource? I sure hope there’s some caching going on somewhere.
August 27, 2011 at 5:36 pm #119149In reply to: Getting group avatar, outside of loop.
dyerringtonMemberAlright, drilling down a bit further, in bp-groups/bp-grouptemplatetags.php, around line 279, there’s our bp_get_group_avatar() method.
`
function bp_get_group_avatar( $args = ” ) {
global $bp, $groups_template;$defaults = array(
‘type’ => ‘full’,
‘width’ => false,
‘height’ => false,
‘class’ => ‘avatar’,
‘id’ => false,
‘alt’ => __( ‘Group avatar’, ‘buddypress’ )
);$r = wp_parse_args( $args, $defaults );
extract( $r, EXTR_SKIP );
var_dump(‘buddypress group_avatar_call’, bp_core_fetch_avatar( array( ‘item_id’ => $groups_template->group->id, ‘object’ => ‘group’, ‘type’ => $type, ‘avatar_dir’ => ‘group-avatars’, ‘alt’ => $alt, ‘css_id’ => $id, ‘class’ => $class, ‘width’ => $width, ‘height’ => $height )) );
/* Fetch the avatar from the folder, if not provide backwards compat. */
if ( !$avatar = bp_core_fetch_avatar( array( ‘item_id’ => $groups_template->group->id, ‘object’ => ‘group’, ‘type’ => $type, ‘avatar_dir’ => ‘group-avatars’, ‘alt’ => $alt, ‘css_id’ => $id, ‘class’ => $class, ‘width’ => $width, ‘height’ => $height ) ) )
$avatar = ‘group->avatar_thumb ) . ‘” class=”avatar” alt=”‘ . esc_attr( $groups_template->group->name ) . ‘” />’;return apply_filters( ‘bp_get_group_avatar’, $avatar );
}
`So I’ve var dumped the parameters that are used for bp_core_fetch_avatar() when it’s called from the default group landing page, then var_export($args, true) and copied that output directly to my own code and surprisingly, I get the same result as before, a blank img tag. So, this leads me to believe that this method is not meant to be used in the way I am using it.
As I find a better solution, I will follow up in case this is useful to someone else.
August 22, 2011 at 8:52 pm #118867In reply to: Caching the response of fetch_avatar
gordyrMemberCode:<?php $member_id = bp_core_get_userid( ‘{{comment_by}}’ ) ?><a href="<?php echo bp_core_get_user_domain( $member_id ) ?>" title="<?php echo bp_core_get_user_displayname( $member ) ?>"><?php echo bp_core_fetch_avatar ( array( ‘item_id’ => $member_id, ‘type’ => ‘thumb’ ) ) ?></a>
August 8, 2011 at 2:24 am #117959In reply to: Avatar Upload Problem During Registration
rbbp22MemberMe again.
I would like to edit the above posts, but this forum is not allowing me to do so. Clicking “Edit” gets me to “page not found.”
Anyway. I take back that it’s necessary to add a hidden field.
I think the change that is needed is
the last line in the function
bp_get_signup_avatar_dir_value()
in bp-core-templatetags.phpchange
return apply_filters( ‘bp_get_signup_avatar_dir_value’, $bp->signup->avatar_dir );
to
return apply_filters( ‘bp_get_signup_avatar_dir_value’, $signup_avatar_dir );However, I note that if the registrant uploads more than one avatar (i.e. replaces their avatar) during the registration process the avatar displayed will be the first one uploaded.
Look at the function bp_core_fetch_avatar() in bp-core-avatars.php
This is called in the function bp_get_signup_avatar in bp-core-templatetags.php.
The problem is that if the user uploads more than one avatar the old ones are not deleted.
bp_core_fetch_avatar() seems to get the first on uploaded and this is the one that is displayed when the register.php template runs even if newer avatars have been uploaded during the registration process.
July 28, 2011 at 10:12 pm #117123@mercimeParticipantReferencing your trac ticket https://buddypress.trac.wordpress.org/ticket/3405
June 18, 2011 at 2:47 am #114752ramprakavMemberthere is a problem in that avatar so i cant upload my avatar
June 17, 2011 at 9:46 pm #114732sidjagsMemberhello everyone.. found a solution to this.. so thought i’d share it here too.. (i’m posting this in all the different threads out there about the same topic)
If you want a custom set of pics to replace the default buddypress avatars and be assigned by random to members… here goes:
sid
June 11, 2011 at 9:07 pm #114373sidjagsMemberany progress? would love to see whats been done and test it out to see if we can use it… really looking forward to this.
May 26, 2011 at 11:31 pm #113151David BissetParticipantThis is cool, i’ve been monitoring this off and on – glad to see you come through! Happy to test this one out.
-
AuthorSearch Results