Search Results for 'bp_core_fetch_avatar'
-
AuthorSearch Results
-
August 27, 2012 at 10:02 am #140349
meg@info
ParticipantHi,
Check this
/**
* Check if the current user has an uploaded avatar
* @return boolean
*/
function current_user_has_avatar() {
global $bp;
if ( bp_core_fetch_avatar( array( 'item_id' => $bp->loggedin_user->id, 'no_grav' => true,'html'=> false ) ) != bp_core_avatar_default() )
return true;
return false;
}
August 8, 2012 at 4:51 pm #138846In reply to: bp_core_fetch_avatar issue after 1.6 update
odiggy
ParticipantThanks Roger!
August 8, 2012 at 3:39 pm #138837In reply to: bp_core_fetch_avatar issue after 1.6 update
Paul Wong-Gibbs
KeymasterConfirmed. Thanks for investigating.
August 8, 2012 at 3:31 pm #138835In reply to: bp_core_fetch_avatar issue after 1.6 update
Paul Wong-Gibbs
KeymasterAh hah. Hopefully we can get someone to test reversing that change on the Salutation theme; we may be on to a winner. Thanks Roger
August 8, 2012 at 3:12 pm #138833In reply to: bp_core_fetch_avatar issue after 1.6 update
Roger Coathup
ParticipantI suspect that it is this ‘fix’ that has broken the functionality: https://buddypress.trac.wordpress.org/ticket/4215
August 6, 2012 at 11:21 am #138476In reply to: BuddyPress 1.6 is now available
Geordee
ParticipantI had to make this fix after the update
In bp-core-avatars.php I commented out
`return apply_filters( ‘bp_core_fetch_avatar’, ‘<img src="' . `
onward and added
`return apply_filters( ‘bp_core_fetch_avatar_url’, $gravatar );`Also commented
`return apply_filters( ‘bp_core_fetch_avatar’, ‘<img src="' .`
and added
`return apply_filters( ‘bp_core_fetch_avatar_url’, $avatar_url );`Not sure whether this is correct or not, but my site works.
I do not see any other issue.
June 24, 2012 at 5:16 am #136310In reply to: bp_ functions in wordpress strict page
modemlooper
Moderatorbp_displayed_user_avatar only works on a members profile page use bp_core_fetch_avatar
not all functions work out of their components
May 8, 2012 at 6:10 pm #134179In reply to: How to check if member has avatar ?
meg@info
ParticipantThanks @shanebp for answer,
I wanted a clean solution (just function from buddyrpess) but
– .
Any way, here is my function, i used bp_core_avatar_default() to return the default avatar.
/**
* Check if the current user has an uploaded avatar
* @return boolean
*/
function current_user_has_avatar() {
global $bp;
if ( bp_core_fetch_avatar( array( 'item_id' => $bp->loggedin_user->id, 'no_grav' => true,'html'=> false ) ) != bp_core_avatar_default() )
return true;
return false;
}
Hope this help some one.
Closed.May 8, 2012 at 1:34 pm #134167In reply to: How to check if member has avatar ?
shanebp
ModeratorSo it will always be true due to the default avatar.
There might be an existing BP method to ignore both grav and default, but I don’t know what it is.
So you could string-check, something like this:
`
function user_has_avatar() {
global $bp;$avatar = bp_core_fetch_avatar( array( ‘item_id’ => $bp->loggedin_user->id, ‘no_grav’ => true, ‘html’=>false) );
$pos = strpos($avatar, ‘mystery-man’);
if ($pos === false) return true;return false;
}
`May 8, 2012 at 12:03 pm #134166In reply to: How to check if member has avatar ?
meg@info
ParticipantHere is my code
This my code in functions.php
function user_has_avatar() {
global $bp;
if ( !bp_core_fetch_avatar( array( 'item_id' => $bp->loggedin_user->id, 'no_grav' => true ) ) )
return false;
return true;
}
I try to check this in header.php,
// test one with bp_get_user_has_avatar function
global $bp;
if( !bp_get_user_has_avatar()) :
// echo html message warning
endif;
// test two with user_has_avatar function
if( !user_has_avatar() ) :
// echo html message warning
endif;
bp_core_fetch_avatar( array( ‘item_id’ => $bp->loggedin_user->id, ‘no_grav’ => true, ‘html’=>false )
return this string :http://localhost/wordpress-buddypulse/wp-content/plugins/buddypress/bp-core/images/mystery-man.jpg
and not false like describe in buddypress docs ( when no_grav is true function will return false if no avatar is added)
bp_get_user_has_avatar() is used in memberssingleprofilechange-avtar.php , mybe i need to call a funtion to load the data of current member or somthing like that…
Thanks advance @shanebp for help
May 3, 2012 at 11:49 pm #133945In reply to: link to avatar by id
shanebp
ModeratorWhy would you want to link to an avatar?
If you mean show their avatar as a link to their profile…
Then if you know what that person’s user_id is… say as $that_member_id`
$avatar=bp_core_fetch_avatar(array(“item_id”=>$that_member_id,”type”=>”thumb”,”height”=>32,”width”=>32));
$avatar_link = “” . $avatar . ““;
echo $avatar_link;
`May 2, 2012 at 4:24 pm #133865In reply to: How do I insert the big avatar?
adambundy
MemberI found a solution for this. Hope it helps someone. Note that I am fetching the value of $user_id earlier in my loop.
`if ( function_exists(‘bp_core_fetch_avatar’) ) {
echo apply_filters( ‘bp_post_author_avatar’, bp_core_fetch_avatar( array( ‘item_id’ => $user_id, ‘type’ => ‘full’, ‘width’ => 120, ‘height’ => 120 ) ) );
} else if ( function_exists(‘get_avatar’) ) {
get_avatar( $user_id, $size = ‘120’);
}`April 30, 2012 at 5:42 pm #133763In reply to: Using BuddyPress Avatars with wp_list_comments()
craftcore
ParticipantThanks for the tip, Paul! I have nice crisp avatars now; not a blurry pixel in sight!
Strangely, calling get_avatar() still resulted in blurry pics. When I used the bp_core_fetch_avatar function, it worked perfectly.
(See image of the results side by side: https://twitter.com/#!/pangepange/status/197016926789181441/photo/1/large )
The function didn’t work as is, but when I changed item_id to “$comment->user_id”, the avatars worked on my theme.
`<?php if ( function_exists( 'bp_core_fetch_avatar' ) ) :
echo bp_core_fetch_avatar( array(
‘item_id’ => $comment->user_id,
‘type’ => ‘full’,
‘width’ => 75,
‘height’ => 75
));
endif;
?>`Thanks so much for the help!
April 30, 2012 at 6:23 am #133729In reply to: Using BuddyPress Avatars with wp_list_comments()
Paul Wong-Gibbs
KeymasterWordPress’ 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-y
KeymasterHi,
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
shanebp
ModeratorTry 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
daveC87
MemberThe 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?
dgodot
MemberThanks, 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-y
KeymasterThat’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-y
KeymasterSince 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
InHouse
MemberIs 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
drummergirl
ParticipantFound 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. (Brave)
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 #126661modemlooper
ModeratorIf 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-Gibbs
KeymasterTake a look at BP’s bp_core_fetch_avatar_filter() function.
-
AuthorSearch Results