Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'bp_core_fetch_avatar'

Viewing 25 results - 176 through 200 (of 258 total)
  • Author
    Search Results
  • Lawrence
    Participant

    @djpaul: Thanks Paul, I would really appreciate any thoughts and feedback when its out, as I can imagine the coding will be a little hazy in places. Should be fairly easy to understand though.

    Paul Wong-Gibbs
    Keymaster

    Hey, looks like a novel approach — I’ll have a play when you get the plugin out

    Lawrence
    Participant

    Good news all… I’ve finally got this working as intended, and I’m currently in the process of packing it all together in to a plugin for release to the community over the next few days. Just creating a small webpage where people can download it, and I’ll hopefully have an online user guide.

    Screenshot:
    http://www.obscuresounds.com/obscureavatar-beta.jpg

    For now it works like this:

    1. designers can create transparent png “parts” of an avatar divided in to 3 sections (body, face, head).
    2. the plugin can differentiate between male and female by parsing in a string (m, or f), so again designers can create gender specific avatars based on needs.
    3. users who upload avatars via BP will bypass obscureavatars, and the plugin will only use gravatar as a last resort for groups, and blogs.
    4. it works for both wordpress, and buddypress.

    Essentially it sets out to do what I’ve wanted – to make the avatars a bit easier to work with for designers. Although I mainly develop backend stuff I love UI design, and one thing I’ve noticed is that pretty much all wordpress projects either use gravatars tacky generated content, or the dull wordpress avatar. Not only that but they fail to facilitate basic gender styles, which is essential for social network propagation now-days.

    I want to continue developing this in to something more sophisticated (I’m thinking it would be cool if designers could zip their parts in to packs, so that people can interchange them in an instant), but I will only be able to do this based on its popularity and support.

    #112060
    jamz86
    Member

    If you’re trying to pull just the avatar from within a loop, this shows how to do that:

    http://wpmu.org/how-to-create-a-gallery-of-members-avatars-in-buddypress/

    If you’re trying to pull up someone’s avatar simply by ID, use bp_core_fetch_avatar() like this:

    `
    <?php
    global $bp;
    $the_avatar = $bp->displayed_user->id; //you’d put in whatever function you’re using to get the ID here, assign it to a variable
    echo bp_core_fetch_avatar( ‘item_id=’.$the_avatar );
    ?>
    `

    Look up bp_core_fetch_avatar() as there are a lot more options than this. For example, do you want a thumbnail or full sized image? There is a way to specify. Hope that helps!!

    #112002
    Boone Gorges
    Keymaster

    Exactly what is your AJAX returning? Is the first part (span.searchheading) coming through OK?

    You might try (just for the heck of it) switching your argument structure to an array, something like this:
    echo bp_core_fetch_avatar( array( 'item_id' => $row ) );

    Theoretically, it shouldn’t matter, but sometimes it does.

    If you’re still having troubles, start dropping var_dump() statements into bp_core_fetch_avatar() itself. You can find that function in bp-core/bp-core-avatars.php.

    #111285
    Brandon Allen
    Participant

    You can easily change the default avatar in your dashboard under BuddyPress > General Settings. The reason it doesn’t use the WordPress avatar setting is because BuddyPress is designed to be it’s own site with it’s own settings. If you want to disable gravatar support completely you can set no_grav to true in your theme’s bp_core_fetch_avatar function calls. This will be made even easier when 1.3 is released.

    #111228
    r-a-y
    Keymaster

    BP_AVATAR_ORIGINAL_MAX_WIDTH is used during the initial upload. However, during the cropping phrase, this original image is deleted.

    It would be possible to do what you’re asking, but it would entail hooking into the avatar cropping process (so the original image isn’t removed) and filtering bp_core_fetch_avatar() to grab this original image when you want to call it.

    #110582

    Hmm… ok thanks. I copied the file from that template and pasted it in my file. Looks like it fixed that error but now i got another one!! :(

    `Fatal error: Call to undefined function: bp_core_fetch_avatar( $args = ” ) in /home/***/****/****/bp-core/bp-core-avatars.php on line 60`

    Henry
    Member

    Hope you do well with this, I would also be interested in using this.

    I’m sure many others would too!

    tiki16
    Participant

    Hi I am looking to utilise something like this. Any progress?
    thanks

    #109684
    r-a-y
    Keymaster

    Check out the “bp_core_mysteryman_src” and “bp_core_fetch_avatar” filters located in /bp-core/bp-core-avatars.php.

    This article details a little bit of how to do it:
    http://wpmu.org/how-to-add-a-custom-default-avatar-for-buddypress-members-and-groups/

    Lawrence
    Participant

    @Reezo, @Dimensionmedia:

    Thanks guys… sorry for taking such a long time to update on this. Ended up having to work on some other projects. I’ve managed to get the custom avatar generator to function okay now, and have a live project that uses it (http://school.ocdaction.org.uk/), but I need to tidy up the code a little. At the moment I’m having to plug the wordpress avatar function (get_avatar) and use that for my rendering duties. What I’d like to happen is for the bp dev team to make their bp_core_fetch_avatar pluggable, as it doesnt really have much scope for extending in its current state. Maybe I’m wrong, but if someone has more knowledge of how to alter bp_core_fetch_avatar for my needs then that would be awesome. I did think of filtering, but one aspect of bp_core_fetch_avatar I don’t particulary see the need of is that it pushes the final img url through http://www.gravatar.com, which in my opinion is a wasted resource, as this plugin would only read directly off the parts folder when it generates an avatar, and then loads from a cache dir.

    Welcome any thoughts on this.

    #109018
    amittrehan
    Member

    thank you mercime for replying. its the ajax.php that is the problem. this is the error that i get

    ‘Warning: Cannot modify header information – headers already sent by (output started at /…./public_html/chill/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/ajax.php:553) in /…./public_html/chill/wp-content/plugins/buddypress/bp-messages.php on line 556’. i have already checked the above link.

    line 553 in ajax.php is this below line code:

    ‘echo bp_core_fetch_avatar(array(‘item_id’ =>$user_id,’type’=>’thumb’,’width’=>15,’height’ =>15)).’ ’.bp_core_get_user_displayname($user_id).’(‘.$username.’)’;
    } ‘

    regards
    amit

    Reezo
    Participant

    @grimbog: This is interesting. Hope to hear good news soon.

    #107799

    In reply to: Recent Post plugin

    r-a-y
    Keymaster

    @rogerwhitson – In response to this, you add the bp_core_fetch_avatar() function in your recent post loop.

    It would look something like this:

    ` $user_id ) ); ?>`

    I’m guessing that the recent posts loop is a widget; you’d have to add the code above into the widget’s code somewhere.

    You would also have to pass the $user_id properly in the loop.

    #107606

    hi
    here is the solution for getting the avatar image url
    bp_core_fetch_avatar(array(‘item_id’ => $other_user, ‘type’ => ‘thumb’, ‘width’ => 32, ‘height’ => 32, ‘class’ => ‘friend-avatar’,’html’=>false));

    html = false

    #107109
    Virtuali
    Participant

    Wait… do you mean a subnav? Like for instance, under profile, the subtabs are “Edit Profile, and Change Cignature?”

    Could be done, wrap the bp_core_new_subnav_item call in a function which is hooked on xprofile_setup_nav action;

    `/* Add the subnav items */
    bp_core_new_subnav_item( array( ‘name’ => __( ‘My Friends’, ‘buddypress’ ), ‘slug’ => ‘my-friends’, ‘parent_url’ => $friends_link, ‘parent_slug’ => $bp->friends->slug, ‘screen_function’ => ‘friends_screen_my_friends’, ‘position’ => 10, ‘item_css_id’ => ‘friends-my-friends’ ) );
    bp_core_new_subnav_item( array( ‘name’ => sprintf( __( ‘Requests (%d)‘, ‘buddypress’ ), bp_friend_get_total_requests_count() ), ‘slug’ => ‘requests’, ‘parent_url’ => $friends_link, ‘parent_slug’ => $bp->friends->slug, ‘screen_function’ => ‘friends_screen_requests’, ‘position’ => 20, ‘user_has_access’ => bp_is_my_profile() ) );

    if ( $bp->current_component == $bp->friends->slug ) {
    if ( bp_is_my_profile() ) {
    $bp->bp_options_title = __( ‘My Friends’, ‘buddypress’ );
    } else {
    $bp->bp_options_avatar = bp_core_fetch_avatar( array( ‘item_id’ => $bp->displayed_user->id, ‘type’ => ‘thumb’ ) );
    $bp->bp_options_title = $bp->displayed_user->fullname;
    }`

    There ya go, 2 in one! ;)

    #106871
    r-a-y
    Keymaster

    That’s the WP version of grabbing the avatar.

    You can also try the BuddyPress way:
    `echo bp_core_fetch_avatar( array( ‘item_id’ => $id, ‘width’ => $width, ‘height’ => $height ) );`

    A list of full parameters can be found by looking at the source:
    https://trac.buddypress.org/browser/tags/1.2.8/bp-core/bp-core-avatars.php#L50

    Cam
    Participant

    @boonebgorges

    I am a complete newbie when it comes to this. I tried to utilize the funciton you created above and it results in an error: Unexpected return.

    I imagine I am missing something obvious but here is my code:
    `function my_blog_avatar_1( $old_avatar ) {
    bp_core_fetch_avatar( array( ‘item_id’ => ‘1’, ‘type’ => $type, ‘alt’ => $alt, ‘width’ => $width, ‘height’ => $height, ‘class’ => $class ) ) // Do some stuff to get the avatar you want, then
    return $new_avatar;
    }
    add_filter( ‘bp_get_blog_avatar_1?, ‘my_blog_avatar_1’ );`

    Thanks in advance for your help.

    #106174

    In reply to: Recent Post plugin

    r-a-y
    Keymaster

    Pass the user id as the “item_id” parameter in bp_core_fetch_avatar().

    This function is located in /bp-core/bp-core-avatars.php.

    David Bisset
    Participant

    @grimbog

    Was there any progress on this? I was interested in the same thing, whether if it’s code or an actual plugin.

    Thanks!

    #101581
    Boone Gorges
    Keymaster

    You will have te create a custom function, either in your theme’s functions.php or in plugins/bp-custom.php, that filters the output of that function and replaces it with the avatar of your choice. Eg, if your blog_id is 5,
    ‘function my_blog_avatar( $old_avatar ) {
    // Do some stuff to get the avatar you want, then
    return $new_avatar;
    }
    add_filter( ‘bp_get_blog_avatar_5’, ‘my_blog_avatar’ );`

    The ‘do some stuff’ part will depend highly on your setup. If by ‘the associated group’ you mean that you are using bp-groupblog, then you will likely have to do some direct queries of the groupmeta database table to find the group that is associated with a particular blog (I don’t think that the plugin stores that info in a place that is easily accessible by blog_id). Then you will use some permutation of bp_core_fetch_avatar() to pull up the avatar for that group_id.

    Good luck!

    #101490
    scabadaska
    Member

    Hi @BuddyPresser,

    I would like to add to Javier’s @arques post above. His method does work but it’s missing the initial sign-up screen where gravatar is being pulled. I also rewrote his path a bit. This should do the trick for killing all Gravatar calls. If someone has more time than I it would be great to have this in plugin form. Here is the code:

    `
    function bp_remove_gravatar ($image, $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir) {

    $default = get_stylesheet_directory_uri() .’/_inc/images/bp_default_avatar.jpg’;

    if( $image && strpos( $image, “gravatar.com” ) ){

    return ‘avatar‘;
    } else {
    return $image;

    }

    }
    add_filter(‘bp_core_fetch_avatar’, ‘bp_remove_gravatar’, 1, 9 );

    function remove_gravatar ($avatar, $id_or_email, $size, $default, $alt) {

    $default = get_stylesheet_directory_uri() .’/_inc/images/bp_default_avatar.jpg’;
    return “{$alt}“;
    }

    add_filter(‘get_avatar’, ‘remove_gravatar’, 1, 5);

    function bp_remove_signup_gravatar ($image) {

    $default = get_stylesheet_directory_uri() .’/_inc/images/bp_default_avatar.jpg’;

    if( $image && strpos( $image, “gravatar.com” ) ){

    return ‘avatar‘;
    } else {
    return $image;
    }

    }
    add_filter(‘bp_get_signup_avatar’, ‘bp_remove_signup_gravatar’, 1, 1 );
    `

    The image that I am referencing doesn’t have to be a JPG. The size is 150×150. You may have to adjust the file name and/or path to your liking.

    Thanks @arques for the initial code!

    #98097
    r-a-y
    Keymaster

    If you need to stay on BP 1.2.4, you could probably just copy the part of the bp_core_fetch_avatar() function that adds support for the ‘html’ parameter… but I’d strongly suggest upgrading when you have the chance.

    See the codex article on upgrading:
    https://codex.buddypress.org/buddypress-site-administration/upgrading-buddypress/

    #98083
    r-a-y
    Keymaster

    Try this:
    `bp_core_fetch_avatar( ‘html=false’ );`

    Be sure to check out the full parameters for the function in bp-core-avatars.php.

Viewing 25 results - 176 through 200 (of 258 total)
Skip to toolbar