Search Results for 'bp_core_fetch_avatar'
-
Search Results
-
I have both Buddypress and bbpress installed. bbpres is using local wordpress avatars that registered users uploaded even before bbpress was installed. I want Buddypress to do the same – use these local avatars instead of its own. I have found this code on bbpress codex and internets:
add_filter('bp_core_fetch_avatar_no_grav', '__return_true');
I added this code to bp-custom.php, but it`s seems like this code is not working anymore? I really need to make Buddypress to use local avatars just like bbpress do, please help.
I apologize if this is something fairly easy but I’m a bit of a beginner when it comes to this stuff. I’m looking to display my Group Mod’s member types above their names on the group page I have created but all I can get is the id to show up which of course is not user friendly when it comes to reading it. I have pasted the code I have below if anyone could please help me with this. Thank You!
function bp_group_list_mods( $group = false ) { global $groups_template; if ( empty( $group ) ) { $group =& $groups_template->group; } if ( ! empty( $group->mods ) ) : ?> <ul id="group-mods"> <?php foreach( (array) $group->mods as $mod ) { ?> <li id="groupmods-list"><div class="item-avatar"> <a href="<?php echo bp_core_get_user_domain( $mod->user_id, $mod->user_nicename, $mod->user_login ) ?>" class="bp-tooltip" data-bp-tooltip="<?php printf( ('%s'), bp_core_get_user_displayname( $mod->user_id ) ); ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $mod->user_id, 'email' => $mod->user_email, 'alt' => sprintf( __( 'Profile picture of %s', 'buddypress' ) ) ) ) ?></a></div> <div class="item"> <div class="groupmod-type"><p><?php printf( ('%s'), bp_get_member_type( $mod->user_id) ); ?></p></div> <div class="groupmod-name"><p><?php printf( ('%s'), bp_core_get_user_displayname( $mod->user_id ) ); ?><p></div> </div> </li> <?php } ?> </ul>
<?php echo bp_core_fetch_avatar ( array( ‘item_id’ => $logged_user_id, ‘type’ => ‘full’, ‘html’ => TRUE )); ?>
But this is working with single wordpress siteHi,
I’ve tried to change the avatar in several ways, but everytime Buddypress comes on the way and overrides settings. My last try was to set up a random avatar for every user, looks slack but… It doesn’t work with Buddypress. Since you guys are BP specialists I thought you would be able to know how to fix this issue.
Custom code I tried is this :
https://ownyourbits.com/2017/01/31/custom-random-avatars-in-wordpress/#comment-2187Many thanks, you rock !
Topic: Using Local Profile Picture
Hello everyone.
I’ve been pulling my hair out trying to resolve this and I know it’s probably the most simply thing but that’s what I get for not having sufficient knowledge.
So my membership plugin creates a user and adds a profile picture to WordPress’ user directory. But I need this profile picture to sync with Buddypress. I’ve learned quite a bit in pursuit in finding a solution and I feel like I’m so close and that’s why I need the help on the last mile.
I was able to disable Buddypress’ attempts at finding a Gravatar for any given user using
add_filter('bp_core_fetch_avatar_no_grav', '__return_true');
. Worked great! Now, I’m staring at the “Mystery Man” and I know I need to usebp_core_fetch_avatar
to change it to the local avatar uploaded to WordPress. That’s where I’m stuck. I need a snippet of code where I can plugin in the directory for it find the user and attach the profile picture!Any guidance would be appreciated it!
Topic: Avatar Images to grey scale
I am trying to use the following code to turn user avatars to greyscale.
It has never worked, but I am not sure why. I can do it temporarily via CSS, just to show how it will look (that’s not an issue) but would prefer the actual avatars to be greyscale
Please help//Convert to greyscale add_filter('xprofile_avatar_uploaded','rb_bw_filter', 10, 2); function rb_bw_filter($meta) { // $path = wp_upload_dir(); // get upload directory // $file = $path['basedir'].'/'.$meta['file']; // Get full size image $file = bp_core_fetch_avatar(array('item_id' => $other_user, 'type' => 'full','html'=>false)); $files[] = explode(',' ,$file); // Set up an array of image size urls // foreach ($meta['sizes'] as $size) { // $files[] = $path['path'].'/'.$size['file']; // } foreach ($files as $file) { // iterate through each image size // Convert image to grayscale credit to http://ottopress.com/2011/customizing-wordpress-images/ list($orig_w, $orig_h, $orig_type) = @getimagesize($file); $image = wp_load_image($file); imagefilter($image, IMG_FILTER_GRAYSCALE); switch ($orig_type) { case IMAGETYPE_GIF: imagegif( $image, $file ); break; case IMAGETYPE_PNG: imagepng( $image, $file ); break; case IMAGETYPE_JPEG: imagejpeg( $image, $file ); break; } } return $meta; }
Hello Buddypress buds!
A lot of people have been talking over the past couple of years about “how to require a profile photo upon registration. And I know it’s a risky thing to do, but many of us are willing to take that risk.
There are a handful of plugins that try to assist with this procedure, but some fail, and some are only partially successful. The best solution that I’ve found is Xprofile Custom Fields. With this plugin, and a lot of help from the author, I’ve managed to get profile photos to be required in the registration process. However, the issue I’m having is that the users are unable to effectively change their profile photo by using the options in the Buddypress “Profile” section/menu. The user can still click “Change Profile Photo,” and it will accept their upload, but the old photo remains in the member directory & in the user’s profile itself.
I think there must be a miscommunication occurring due to this new way of gathering the user’s original profile photo. It seems like some code, pertaining to the Buddypress “Change Profile Photo” function needs to be tweaked, but I can not pinpoint the function, which would be the first step towards fixing this issue.
To demonstrate how I’m requiring the profile photo upload in the registration, here is the function I’ve added to my theme’s functions.php file:
add_filter( 'bp_core_fetch_avatar', 'my_custom_avatar', 10, 2 ); function my_custom_avatar( $avatar, $params ) { if ( 'user' === $params['object'] ) { // Get the src of the original avatar. $array = array(); preg_match( '/src="([^\"]*)"/i', $avatar, $array ); if ( count( $array ) > 1 ) { $old_url_avatar = $array[1]; // Get the new url of image. $uploads = wp_upload_dir(); $img = maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( 5218, $params['item_id'] ) ); if ( ! empty( $img ) ) { $new_url_avatar = $uploads['baseurl'] . $img; // Replace the old src with the new url. $avatar = str_replace( $old_url_avatar, $new_url_avatar, $avatar ); } } } // Return the avatar. return $avatar; }
I’d like to mention that I have asked the plugin author about this, but my message on that plugin’s support forum has been deleted twice, making me think I should give the man a break.
Here are some specifications of my site:
It’s running on WordPress v4.6.1, Buddypress v2.7.0, & using BuddyPress Xprofile Custom Fields Type v2.6
“5218” is the field ID for the “Upload Image” field.
Thanks and sorry if I posted in an inappropriate forum, I think I chose the right one.
Topic: Notification avatars
I’ve been trying to work out how to get the user IDs for the notification items so I can display notification user avatars.
Is this the best way to do it, I’ve tested this with a few users and seems to work:
function test_notifications_avatar() { $bp = buddypress(); $user_id = $bp->notifications->query_loop->notification->secondary_item_id; if ( empty( $user_id ) ) $user_id = $bp->notifications->query_loop->notification->item_id; echo bp_core_fetch_avatar( array( 'item_id' => $user_id, 'type' => 'thumb' ) ); }
Hy, I have a Problem.
In the Widget i have this code, becouse see Only the Avatar from gravatar.com and not from Buddypress or WordPress<?php echo get_avatar( $comment, '45' ); ?>
Display in Html
<img alt="" src="https://secure.gravatar.com/avatar/ca07c51aecfa704741559ccc813d7b0d?s=45&d=mm&r=g" srcset="https://secure.gravatar.com/avatar/ca07c51aecfa704741559ccc813d7b0d?s=90&d=mm&r=g 2x" class="avatar avatar-45 gravatar" height="45" width="45">
Than i have change the code to:
<?php echo bp_core_fetch_avatar( array( 'item_id' => $comment->user_id,'type' => 'full','width' => 75,'height' => 75)); ?>
becouse is not working.What is the correct code for Display Avatar from a Comment.
Thanks a lot