Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'bp_core_fetch_avatar'

Viewing 25 results - 276 through 300 (of 310 total)
  • Author
    Search Results
  • 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

    #81290
    Anna Ladoshkina
    Participant

    @justbishop I also use the subdirectories – so filters should be OK in this case
    but probably you have some custom avatar upload path or constant BP_ROOT_BLOG is not defined in your installation?
    another possible reason – the function that fetch avatars for members blogs does not use bp_core_fetch_avatar() but some other mechanism

    #12044
    _
    Participant

    Hi everyone!

    I coded two widgets, one to list the most active blogs on the website home, and another to show up a profile on blogs.

    The weird thing is that using the same method for both widgets, they display different avatars. In my blog home I got the right avatar, but on blog profiles sidebar widget I get a gravatar “smiling square” generated one, not the one uploaded via Buddypress.

    The method (exactly the same in both widgets) is something like:
    —-
    global $blog_id;
    $user = get_blog_owner ($blog_id) // function to not get site admin users
    echo get avatar ($user->ID, 96); // bp_core_fetch_avatar(‘item_id=’.$user->ID) does not work, either
    —-

    Hope someone can help me on this.
    Thanks in advance.

    #79670
    r-a-y
    Keymaster

    Your pastie link doesn’t work.

    This is working for me:
    $myslug = 'my-test-group';
    if ( bp_has_groups('type=single-group&slug='.$myslug) )

    For some reason, you have to add the type as “single-group” as well.

    If you’re just trying to get the group avatar of one group… just use bp_group_avatar() (view the params in bp-groups-templatetags.php) or bp_core_fetch_avatar() (view params in bp-core-avatars.php).

    #11735
    kiwipearls
    Participant

    I use latest Buddypress on my Latest WordPress MU site but get this error on a member blog:

    Code:
    Warning: Missing argument 5 for bp_core_fetch_avatar_filter() in /senilityguild.com/public_html/wp-content/plugins/buddypress/bp-core/bp-core-avatars.php on line 345

    Avatars work great on the main blog, but anyone whom creates a blog gets this error. I can’t figure it out.

    I look forward to hearing from you.

    tinabeans
    Member

    Nevermind, I googled for that function and found the SVN repo where that function is defined: http://bp-dev.org/phpxref/nav.html?_functions/index.html

    The params it takes are:

    $defaults = array(
    ‘item_id’ => false,
    ‘object’ => ‘user’, // user OR group OR blog OR custom type (if you use filters)
    ‘type’ => ‘thumb’,
    ‘avatar_dir’ => ‘avatars’,
    ‘width’ => false,
    ‘height’ => false,
    ‘class’ => ‘avatar’,
    ‘id’ => false,
    ‘alt’ => __( ‘Avatar Image’, ‘buddypress’ ),
    );

    … and the params can be fed into bp_core_fetch_avatar() in the form of “name=value&name=value” pairs as a string.

    Hope this helps someone else who is having the same issue. =)

    tinabeans
    Member

    YOU ARE AMAZING! You know, you just redeemed my whole afternoon of work. Hooray =) I owe you a beer for that one!

    Well… here’s the postscript. It all comes back to one thing I’ve been frustrated with: why is there no good documentation on BP or BBpress template tags? I had to search the code repo to find a hint that bp_core_get_avatar() was deprecated in favor of bp_core_fetch_avatar(), and after that still didn’t know that I had to put “item_id=” before the ID in the argument string. Not sure how I would have figured that one out on my own, given my apparent lack of PHP reading skills.

    If someone knows a secret source of well-documented template tags, do let me know. All I’ve found so far is https://codex.buddypress.org/developer-discussions/buddypress-template-tags/ for Buddypress (which doesn’t even have bp_core_fetch_avatar() listed). Bummer.

    Okay, I do have one last question for you: what other params does bp_core_fetch_avatar() take, and how can I find out? for instance, can I specify a different size of avatar?

    r-a-y
    Keymaster

    @tinabeans – just tested the following snippet:

    echo bp_core_fetch_avatar( 'item_id='.get_post_author_id() );

    This is working for me on a deep-integrated external bbPress install. Let me know if this works for you.

    tinabeans
    Member

    I know there have been a million and one posts/questions about this. The trouble is, there is a lot of conflicting instructions… and it is scattered all over the place. I feel like I am very close, but cannot for the life of me get this to work…

    So far, I’ve successfully done the WordPress “deep integration.” I tested this by putting some random Buddypress tags in BBpress template files. They worked fine. Here’s where I’m running into some trouble:

    I am trying to display the exact same avatar that appears in Buddypress for a particular user in BBPress as well. I tested the following template tags on my profile.php (in my BBpress theme):

    bp_member_avatar(); no result (blank)
    bp_core_fetch_avatar(userid); -> no result (blank)
    bp_core_get_avatar(userid); -> function undefined
    get_avatar(userid); -> this shows the wordpress avatar, not the buddypress one

    Help. Which is the correct tag to use? I need to be able to display an avatar based on user id. That is all. Surely that’s not impossible?

    If there are no existing tags that will do this, can someone just tell me how to do a database query? I found this post http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/where-are-the-avatars/ but don’t know where to go from there…

    Thanks in advance!

    Running: WP MU 2.9.2, Buddypress 1.2.3, and BBPress 1.0.2

    #72050

    In reply to: WP-FB connect profile.

    joshmac
    Participant

    Ok, this is what I’ve come up with so far in order to get the user’s facebook profile pic. However, they disappear when you log in. If anyone is willing to add to this to give it the finishing touch it needs or can tell me what to add that would be great.

    add_action('wpfb_login', 'bp_jfb_get_avatar');

    function bp_jfb_get_avatar($avatar, $id_or_email='') {
    global $comment; $id_or_email;

    if(is_object($comment)) {
    $user_id = $comment->user_id;
    }

    if (is_object($id_or_email)) {
    $user_id = $id_or_email->user_id;
    }

    if (is_array($id_or_email)) {
    if ($id_or_email['object']=='user') {
    $user_id = $id_or_email['item_id'];
    }
    }

    if (get_usermeta($user_id, 'facebook_uid')) {
    $user_info = get_userdata($user_id);
    $jfb_suffix = '';

    if ( $id_or_email['width'] ) {
    $jfb_size = $id_or_email['width'];
    if( $jfb_size < 32 ) {
    $jfb_suffix = 'm';
    } else if ( $jfb_suffix < 64 ) {
    $jfb_suffix = 'n';
    } else {
    $jfb_suffix = 'b';
    }
    } else if ( 'full' == $id_or_email['type'] ) {
    $jfb_size = BP_AVATAR_FULL_WIDTH;
    $jfb_suffix = 'b';
    } else if ( 'thumb' == $id_or_email['type'] ) {
    $jfb_size = BP_AVATAR_THUMB_WIDTH;
    $jfb_suffix = 'n';
    }
    $avatar = '<fb:profile-pic uid="'.$user_info->facebook_uid.'" facebook-logo="true" size="'.$jfb_size.'" width="'.$jfb_size.'" linked="true" class="avatar"></fb:profile-pic>';
    return $avatar;

    } else {
    return $avatar;
    }

    }
    add_filter( 'bp_core_fetch_avatar', 'bp_jfb_get_avatar',10,4);

    This code should go in a bp-custom.php file and uploaded to the mu-plugins directory.

    #71717
    rich! @ etiviti
    Participant

    what redirect chain is that?

    only thing i see in

    function bp_core_fetch_avatar( $args = '' ) {

    which might slow down the process is checking for

    if ( file_exists( $avatar_folder_dir ) ) {

    if you have disabled avatar uploads for members.

    #71615
    jivany
    Participant

    What if you removed the existing bp_core_fetch_avatar_filter from get_avatar and then created your own copy that passed ‘no_grav’=>true into the bp_core_fetch_avatar function?

    I think this should kill the attempt to use Gravatar to fetch an avatar. I’m assuming that bp_core_fetch_avatar isn’t being called directly anywhere. If you do find anywhere that does, it should probably have a ticket raised against it.

    #71610
    oberstet
    Participant

    thanks for helping.

    @r-a-y

    i’ve already hacked bp_core_fetch_avatar() as described in https://buddypress.org/forums/topic/how-to-disable-gravatar-completely

    however, a quick grep for gravatar.com over all wp/bb reveals more places. i am a total wwp/bb/php idiot and have no aspirations to become even mildy involved with the codebase. i was looking for a on-place “checkbox solution”.

    @DJPaul

    ah, ok;) it’s ok to have such commerically motivated “defaults” … in the end its a pretty impressing piece of tool and its nice to share anyway. on the other hand, it would be nice to have a big “this is a private site” switch which turns off this, and other things (like the dashboard fetching stuff from outside … i “disabled” that one using a firewall rule;)

    #71606
    r-a-y
    Keymaster

    This isn’t hard at all.

    Apply a filter to:

    bp_gravatar_url

    Return a url to a default image.

    [EDIT]

    Just noticed that bp_gravatar_url only changes the domain… the params are still added at the end of the URL.

    Might try applying a filter to:

    bp_core_fetch_avatar

    Write a function to see if “gravatar.com” exists in the image URL, if so, return a default image.

    #70945

    In reply to: error codes with 1.2

    kiwipearls
    Participant

    I too am getting this error, not on my main blog, but just one of my user blogs. I thought it could have been the theme, but my personal blog uses the same theme as this user.

    I have ust moved my site over to a new domain, everthing is working great on the main blog. but on my user blogs I am running into a problem with comments – they have an error…

    Warning: Missing argument 5 for bp_core_fetch_avatar_filter() in senilityguild.com/public_html/wp-content/plugins/buddypress/bp-core/bp-core-avatars.php on line 345

    The user blog with comment post is: http://senilityguild.com/ledsoul/2010/03/14/new-senilily-banner/

    And my personal blog is(using same theme): http://senilityguild.com/kiwipearls/2010/03/maggotyanne/

    And the main blog is http://senilityguild.com

    So what has broken on this users theme? And what can I do to fix this? Wondering if I should just import that users db over again? (as i had to import the 3 user blogs separately to the main blog, as I think the main blog was a little bit corrupted as the old site had lots of problems)

    Using most recent Buddypress 1.2.3 ?(get my numbers mixed up)and MU 2.9.2

    #70322
    3sixty
    Participant

    re: forum index

    etiviti (rich!), I spiffed up the forum index by adding Group/Forum avatars beside the forum title/description (see code below)

    Question: can you think of an easy way to include a link to the last active post, say, in a final column? I looked at the code last night didn’t get that far.

    Add Avatar to BP Forum Extras – Forum Index

    Under:

    <td class=”num td-title”>

    Add:

    <div class=”item-avatar”>

    <?php $width=50;$height=50;$type=’thumb’; echo bp_core_fetch_avatar( array( ‘item_id’ => $listing->id, ‘object’ => ‘group’, ‘type’ => $type, ‘avatar_dir’ => ‘group-avatars’, ‘width’ => $width, ‘height’ => $height ) ) ?>

    </div>

    #64421
    r-a-y
    Keymaster

    Look into the bp_core_fetch_avatar() function in bp-core/bp-core-avatars.php.

    Sounds good to me. Not sure if there’s a better way performance-wise.

    #8903
    cotfbstone
    Member

    So I have a custom theme for wordpress 9.1 and I was looking forward to BuddyPress 1.2 for a long itme. I downloaded it, followed theinstructions to make my theme compatable but I found that there were a few issues.

    1) My default avatar system is Gravatar, and even allowing users to upload their own avatars got me this annoying GIANT error code above every avatar – [phpBB Debug] PHP Notice: in file /home/clanfan/public_html/wp-content/plugins/buddypress/bp-core/bp-core-avatars.php on line 345: Missing argument 5 for bp_core_fetch_avatar_filter()

    2) It also does not allow you to register for the site for some reason.

    3) Once a group is created, the option to create a new group disappears.

    I need a dynamic theme like the one I have until I can make a new one, so a) are there any fixes for these issues anyone knows about cause they have them too or b) is there a great place to get buddypress themes?

    #60421
    Mike Pratt
    Participant

    @djpaul don’t worry, I don’t think he’ll do it :-)

    @bowe Here is an example of what’s in 1.2 right now (@Andy – is this what you were talking about?)

    from single.php

    <div class=”author-box”>

    <?php echo get_avatar( get_the_author_email(), ’50’ ); ?>

    <p><?php printf( __( ‘by %s’, ‘buddypress’ ), bp_core_get_userlink( $post->post_author ) ) ?></p>

    </div>

    So in the same code block we get the WP based avatar while getting the BP based Name. Hmm. Not sure why but I am going to use either bp_loggedin_user_avatar() or bp_member_avatar() instead, or possibly bp_core_fetch_avatar() feeding in the id via bp_core_fetch_avatar($post->post_author) but I am just flying by the seat of my pants and have not tried it yet.

    I do know this. We know who the post author is. We know he has a username. That username is the same in WP or BP, so we can get his BP avatar and other info via that route. The rest is theming.

    #60217
    Brajesh Singh
    Participant

    The code for fetching avatar resides in buddypress/bp-core/bp-core-avatar.php

    checkout this function there

    bp_core_fetch_avatar

    There are several filters there and you can use those filters to manipulate the things better.

Viewing 25 results - 276 through 300 (of 310 total)
Skip to toolbar