Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'bp_core_fetch_avatar'

Viewing 25 results - 101 through 125 (of 246 total)
  • Author
    Search Results
  • #174707
    mattg123
    Participant

    @pjbursnall , I wouldn’t say that it is pretty easy here

    <?php global $current_user;
    		get_currentuserinfo();
    		$display = $current_user->display_name;
    		$login = $current_user->user_login;
    		$userid = $current_user->ID;
                    $home = get_home_url();
    ?>

    add that above your custom drop-down then its pretty simple just echo out the username, url etc <li class="li-fourth"><a href="<?php echo $home . '/members/' . $login . '/activity/mentions'; ?>">Mentions</a></li>

    EDIT –

    Oh the other bit you’d have to google for is the avatar but here
    <?php echo bp_core_fetch_avatar( array('item_id' => $userid, 'type' => 'full', 'width' => 100,'height' => 100));?>
    You’ll want to adjust the width/height accordingly

    #170843
    aleciri83
    Participant

    add_filter('bp_core_fetch_avatar_no_grav', '__return_true');

    #170656
    Hugo Ashmore
    Participant

    to get the authors BP account url you could try:

    bp_core_get_user_domain( get_the_author_meta( ‘ID’ )

    In the same vein you should be able to grab the BP avatar:

    bp_core_fetch_avatar( array(‘item_id’ => get_the_author_meta( ‘ID’ )

    #170090
    Hugo Ashmore
    Participant

    Please do not advise the editing of core files this is poor practise and never recommended.

    You describe the default args there, the correct means of changing those is when using bp_core_fetch_avatar() to pass it an array of values.

    In templates adjust the various avatar calls using similar principle

    mathieu.urstein
    Participant

    @modemlooper

    thank you the problem was the quotes 😉

    modemlooper
    Moderator
    <?php
    $userid = bp_loggedin_user_id();
    $avatarurl = bp_core_fetch_avatar( array( ‘item_id’ => $userid, ‘html’ => false ) );
    echo $avatarurl;
    ?>

    rewrite the quote marks, if you cut and paste it can have funky formatting. If you want to display the avatar instead of getting link:

    <?php
    $userid = bp_loggedin_user_id();
    echo bp_core_fetch_avatar( array( ‘item_id’ => $userid) );
    ?>
    mathieu.urstein
    Participant

    thank you @modemlooper

    I did :

    $userid = bp_loggedin_user_id();
    $avatarurl = bp_core_fetch_avatar( array( ‘item_id’ => $userid, ‘html’ => false ) );

    But the problem is still the same,
    what did I do wrong?

    Thanks.

    modemlooper
    Moderator

    $id = //pass the id of a user
    bp_core_fetch_avatar( array( ‘item_id’ => $id, ‘html’ => false ) );

    If you are not on a user page then you must tell it what id of the avatar to get.

    bp_displayed_user_id
    bp_loggedin_user_id

    #166817
    mattg123
    Participant

    @applegateian, henries code should work, but as you’ve experienced it won’t change the current size of the avatars. I also believe bp has thumbnail avatars and “full” the smaller “thumbnail” the ones wordpress uses is 50px and the larger(which can be grabbed with bp_core_fetch_avatar) are 150px by 150px.

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

    That will display the “full” avatar.

    #166754
    Henry
    Member

    BuddyPress seems to attempt to filter get_avatar() – see bp_core_fetch_avatar_filter(). I did bring this issue up a while ago at WordPress Trac but the call was closed.

    https://core.trac.wordpress.org/ticket/24596

    Wonder if anyone thinks it’s worthy of a BP Trac ticket?

    #166723
    applegateian
    Participant

    Ah ok thanks, this code doesn’t seem to return anything, can you help me with the error?

     <a href="/community/members/<?php echo get_the_author_meta('user_login') ?>"> <?php echo bp_core_fetch_avatar ( get_the_author_meta('user_email'), $size = '192' ); ?>
    </a>
    #166683
    mattg123
    Participant

    You’re using wordpress’s get_avatar, bp_core_fetch_avatar is what you’re looking for

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

    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.

Viewing 25 results - 101 through 125 (of 246 total)
Skip to toolbar