Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'bp_core_fetch_avatar'

Viewing 25 results - 251 through 275 (of 304 total)
#86824
techguy
Participant

So, I haven’t figured all of bp_core_fetch_avatar() out, but here’s some of the types:
type=thumb
type=full

Interestingly, the code I pasted in my previous post took the thumbnail image, but displayed it the size of the full (150×150 I think). So, it was pixelated and ugly. So, I changed it to type=full and it’s a nice 150×150 image.

If anyone else can explain the rest, this seems like some good content for the codex.

#86821
techguy
Participant

I’ve been trying to get it to pull various size group avatars and haven’t had much luck. Here’s the code I’m using:
$avatar = bp_core_fetch_avatar( array( ‘item_id’ => $group->id, ‘object’ => ‘group’, ‘type’ => $type, ‘avatar_dir’ => ‘group-avatars’, ‘alt’ => $alt, ‘css_id’ => $id, ‘class’ => $class, ‘width’ => $width, ‘height’ => $height ) );

Shouldn’t I just be able to pass the width and height values that I want? Am I only allowed to pass in certain width and height values? Seems like I could also pass in $type and that could give me the various sizes?

Also, this passes the full HTML for the image. Is there a way I could just get the URL of the image? I could rip it out of the HTML, but that’s kind of messy.

#86753
Brajesh Singh
Participant

@crashutah
That’s a good point. Incase we want different size for groups and members the only good way is to override the “bp_core_avatar_handle_crop” and may be in extreme case “bp_core_avatar_handle_upload” and that will give you enormous flexibility.
After overriding it, we can filter on “bp_core_fetch_avatar” and that will be all we need.

#86720
techguy
Participant

@sbrajesh It seems like the group avatar’s use this same code. How would you call the bp_core_fetch_avatar of varying sizes for groups by group id?

#86627
Brajesh Singh
Participant

well, The very first thing is
1. define the 2 size(bp allows only 3 sizes of avatar at this moment) using the constants BP_AVATAR_(THUMB/FULL/ORIGINAL_MAX)_HEIGHT and BP_AVATAR_(THUMB/FULL/ORIGINAL_MAX)_WIDTH if the original avatar sizes(50×50,150×150,450×450) does not fit your requirement.

Then use bp_core_fetch_avatar, it supports the width,height property and thumb type
You can fetch an avatar of different size using different width/height value but again, It will not crop, it will constrain the avar using the width/height property in the img tag. so i don’t think it will be of much use .

But if you want only 2 sizes of avatar, as you mentioned above, define one as Thumb,other as full and fetch thumb using “type=thumb” and the other using “type=anything other than thumb” in bp_core_fetch_avatar and it will work.

#85548
vsimovic
Member

Ok, i’ve managed to do it with:
global $bp;
bp_core_fetch_avatar( array( ‘item_id’ => $id, ‘type’ => ‘full’, ‘width’ => ’75’, ‘height’ => ’75’, ‘html’ => ‘false’ ) )

If somebody needs the same thing he can try this lines, maybe it will help. :)

#84211
defunct
Participant

Well,

I tried remove_action on the function I found that I want to customize, but it doesn’t work apparently because bp-custom.php is being loaded before bp-friends. I tried this in my theme’s functions.php as well, but it still does not work. What am I doing wrong?

/***
* Create custom functions for buddypress so updates do not override customizations
*/

function my_friends_setup_nav() {
global $bp;

/* Add ‘Friends’ to the main navigation */
bp_core_new_nav_item( array( ‘name’ => sprintf( __( ‘Friends (%d)2222′, ‘buddypress’ ), friends_get_total_friend_count() ), ‘slug’ => $bp->friends->slug, ‘position’ => 60, ‘screen_function’ => ‘friends_screen_my_friends’, ‘default_subnav_slug’ => ‘my-friends’, ‘item_css_id’ => $bp->friends->id ) );

$friends_link = $bp->loggedin_user->domain . $bp->friends->slug . ‘/’;

/* Add the subnav items to the friends nav item */
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’ => __( ‘Requests’, ‘buddypress’ ), ‘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;
}
}

do_action( ‘my_friends_setup_nav’);
}
remove_action( ‘bp_setup_nav’, ‘friends_setup_nav’);
add_action( ‘bp_setup_nav’, ‘my_friends_setup_nav’);

#83552

1.2.5 has an almost totally rewritten bp_core_fetch_avatar function that should fix these issues. Can you confirm that all files are up to date and try again?

#12879
dcase
Member

Wordpress 3.0/Buddypress 1.2.4.1

When I am on the root blog of my site, an uploaded avatar displays in the comments, as well as when I call get_avatar($user_id) or even bp_core_fetch_avatar($user_id). When I am on a non-root blog, the default avatar image display despite the existence of the user’s avatar. How do I make sure a user’s avatar displays consistently on all blogs?

Thanks.

#12800
Greg
Participant

I am upgrading a site to the new BP version and one thing that rocks is the fact that BP doesn’t go to the db to get the avatar filename. That makes it feasible to access the avatar efficiently in far more places.

One little issue I see though: the URL is built using the BP_AVATAR_URL constant, which in turn is defined using bp_core_avatar_url(), which in turn uses wp_upload_dir() as the base of the path. This means that when you are in a blog other than the primary blog, it goes to that blog’s upload directory for the avatar.

Is this “by design” so that users can have different avatars for different blogs?

I know that I can hook into the filter at the end of bp_core_fetch_avatar() to change the current behavior, but before I do that I want to make sure that BP does have multiple avatars for a user.

#82218

In reply to: Show specific avatar

Brandon Allen
Participant

The user_id argument doesn’t exist because there is no user_id argument. The argument that accepts a user id is the item_id argument as I stated above. Try this:

echo bp_core_fetch_avatar( array( ‘width’ => 30, ‘height’ => 30, ‘item_id’ => 1 ) );

If all you need is the thumbnail, then you don’t need the ‘type’ argument, as it defaults to thumbnail.

#82037

In reply to: Show specific avatar

LPH2005
Participant

Thank you. Since I’m not good with php, my interpretation doesn’t seem to work. This is the echo statement to get the avatar to show, however, I’m not sure that the user_id argument works. The area for this statement is blank.

echo bp_core_fetch_avatar(‘type=thumb&width=30&height=30&user_id=1’);

#82011

In reply to: Show specific avatar

Brandon Allen
Participant

Have a look at bp_core_fetch_avatar(). It accepts a number of arguments you’ll want to explore for your use case. The most important being $item_id, which in your case would be your user id number and that user id of your teacher.

#81347
Aditya Singh
Participant

Hi @r-a-y
Its again you to my rescue! :)
Thanks. Yeah I had looked up on Bp_core_fetch_avatar function in bp-core-avatars.php file, and that it has a parameter ‘object’ => with the comment that we can use it if we are using filter.

Its just that I could not figure out how to do it. Tried few things unsuccessfully.

Would it be possible for you to guide me here. Lets say I am uploading my avatars in the standard file-size in some folder in the format “grpavtr_(group_id).png”, then how do I do it…. Have been stuck with this problem (and one more) for a week now… :(
I am sure I would go out and have a beer once I’m done with this…. :D

Viewing 25 results - 251 through 275 (of 304 total)
Skip to toolbar