Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'bp_core_fetch_avatar'

Viewing 25 results - 151 through 175 (of 310 total)
  • Author
    Search Results
  • #165607
    funmi omoba
    Participant

    @megainfo, @shanebp, please what am I missing.

    I put the below code in my functions.php

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

    and this in my header.php

    <?php
    global $bp;
    if( !bp_get_user_has_avatar()) :
    ?>
            <div class="no-pic">
                <strong>Alert !</strong> You have no profile Pic, Clik here to add one now.
                <button class="close" data-dismiss="alert">×</button>
                </div>
    <?php
    endif;

    It work but the alert is not closing when i try to close it

    #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' ) );

    mikegarlick
    Participant

    If i have just the users username in a variable is it possible to get that users avatar?

    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() );

    #31907
    jeffthink
    Member

    Uploaded avatars on my site are going into their directory (`wp-content/uploads/avatars/`) successfully, but are not visible throughout the rest of the site. Wherever the avatar should appear, the default user photo shows up instead (`wp-content/themes/wp-framework/library/images/bp-avatar-user.jpg`).

    I’ve found where the avatar image is being generated (the `bp_core_fetch_avatar` fn in `wp-content/plugins/buddypress/bp-core/bp-core-avatars.php`) and what’s outputted there is correct. So somewhere from that method to the time it displays, Buddypress is deciding to show the default image instead. Permissions on the directory are 755 so that should be ok. Obviously, I’m either missing something (a `.htaccess`?) or my php configuration is not correct on the shared server? Any advice is much appreciated.

    Thanks,
    Jeff

    #31585
    Melindrea
    Participant

    On line 686 of bp-core-avatars.php, BuddyPress hooks into get_avatar to see if there is a locally-uploaded avatar. However, bp_core_fetch_avatar strips out (okay, technically just never puts them in) the standard classes (avatar-$size, photo). Is there a way to get those classes back without needing to hack the code?

    #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

    odiggy
    Participant

    Apologies for my previous attempt to post this in which I did not put my code in backticks – I’m now having my coffee…

    I’m using `bp_core_fetch_avatar(‘html=false&item_id=’.$bp->loggedin_user->id)`

    to fetch avatar urls but now it’s outputting html instead of just the url. Any ideas?

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

Viewing 25 results - 151 through 175 (of 310 total)
Skip to toolbar