Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'bp_core_fetch_avatar'

Viewing 25 results - 126 through 150 (of 258 total)
  • Author
    Search Results
  • #163466
    robgha01
    Participant

    Thancks that solved it! 😀

    if ( $sl_options['show_avatar'] ) 	
    				{
    					if( function_exists('bp_core_fetch_avatar') )
    					{
    						echo bp_core_fetch_avatar( array( 'item_id' => $current_user->ID, 'type' => 'full' ) );
    					}
    					else
    					{
    						echo get_avatar( $current_user->ID, $sl_options['avatar_size'] );
    					}
    				}
    #163456
    shanebp
    Moderator

    In that plugin, you need to replace

    echo get_avatar( $current_user->ID, $sl_options['avatar_size'] );

    with this:

    echo bp_core_fetch_avatar( array( 'item_id' => $current_user->ID, 'type' => 'full' ) );

    Slava Abakumov
    Moderator

    @grimbog
    Is there any ETA when it will be ready for testing?

    Lawrence
    Participant

    @knaveenchand, @casualmagic

    Just seen some activity on this… again, really sorry that things have been on a bit of a pause, but luckily I still have all the code and a basic website so I’ll review everything again with the latest version of wordpress and buddypress and see if I can get this thing published at long last!

    #151687
    modemlooper
    Moderator
    Norm
    Participant

    Would love to test this. I’ve got a site for kids and could see this being a really fun feature.

    knaveenchand
    Participant

    Interestingly, buddypress default theme does not accept avatar from social networks when used with WordPress Social Login plugin. I wish I could provide a random avatar for such cases where buddypress does not accept the avatar provided by social networks.

    There ain’t any active plugins that can produce random avatars. I believe that the plugin that @Lawrence talks will go a long way if it is in public domain. Hence, I request him to offer us some download links to his work. Thanks.

    knaveenchand
    Participant

    @Lawrence: have you been able to complete this plugin? Can you please provide a download link as I am interested to use this plugin. Thanks.

    #146194
    m1000
    Participant

    Yes, I have tried to crop avatar with and without CTL, SHIFT or Command key.

    Right now I have following settings in the bp-core-avatars.php

    For function bp_core_set_avatar_constants

    if ( !defined( 'BP_AVATAR_FULL_WIDTH' ) )
    define( 'BP_AVATAR_FULL_WIDTH', 215 );

    if ( !defined( 'BP_AVATAR_FULL_HEIGHT' ) )
    define( 'BP_AVATAR_FULL_HEIGHT', 135 );

    and for function bp_core_fetch_avatar:

    'width' => 150, // Custom width (int)
    'height' => 150, // Custom height (int)

    The result is I can’t make avatars 150x150px (problem with crop) – http://imm.io/NrNw

    Like I said, I want to have 215×135 (horizontal) group thumbnails so I modified bp_core_set_avatar_constants but unfortunately member avatars have also 215×135 while I want 150×150 size.

    #146003
    Tammie Lister
    Moderator

    Just to be clear, what you are trying to do is display like the user avatar and other details on the author page? You can’t just use member-header as that looks at the ‘current user’. In this case the author page doesn’t have the right information for those calls to work.

    What I’d suggest is you get the userid and use functions like these:

    bp_core_fetch_avatar( array( 'item_id'=>$userid, 'width'=>150));

    echo bp_core_get_username($userid);

    bp_last_activity( $userid );

    That way you’re creating the member-header yourself. You could even have a template part to do this and just call that in the right place.

    #143551
    modemlooper
    Moderator

    echo bp_core_fetch_avatar( ‘item_id=’.get_post_author_id() );

    #140351
    meg@info
    Participant

    this was work for me


    /**
    * 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;
    }

    thanks for answers.

    #140349
    meg@info
    Participant

    Hi,
    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;
    }
    #138846
    odiggy
    Participant

    Thanks Roger!

    #138837
    Paul Wong-Gibbs
    Keymaster

    Confirmed. Thanks for investigating.

    #138835
    Paul Wong-Gibbs
    Keymaster

    Ah hah. Hopefully we can get someone to test reversing that change on the Salutation theme; we may be on to a winner. Thanks Roger

    #138833
    Roger Coathup
    Participant

    I suspect that it is this ‘fix’ that has broken the functionality: https://buddypress.trac.wordpress.org/ticket/4215

    #138476
    Geordee
    Participant

    I 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.

    #136310
    modemlooper
    Moderator

    bp_displayed_user_avatar only works on a members profile page use bp_core_fetch_avatar

    not all functions work out of their components

    #134179
    meg@info
    Participant

    Thanks @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.

    #134167
    shanebp
    Moderator

    So 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;
    }
    `

    #134166
    meg@info
    Participant

    Here is my code

    http://pastebin.com/dCWN34qx

    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 :)

    #133945

    In reply to: link to avatar by id

    shanebp
    Moderator

    Why 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;
    `

    #133865
    adambundy
    Member

    I 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’);
    }`

    #133763
    craftcore
    Participant

    Thanks 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!

Viewing 25 results - 126 through 150 (of 258 total)
Skip to toolbar