-
Author
-
February 27, 2015 at 23:34 #48018BDecker19Participant
Hi, having issues where our site is currently displaying the user avatar in the menu. The images are getting set in Buddypress as can be seen in our directory, although they’re just not displaying in the menu bar when a user is logged in. See attached. Thoughts how can try diagnosing?
Attachments:
You must be logged in to view attached files.February 27, 2015 at 23:35 #48020BDecker19Participantnote, it seems btw the issue may be that it’s looking for a gravatar image, rather than the default profile image (or whatever the main directory section area is grabbing?)
February 28, 2015 at 06:55 #48069LauraModeratorHello, please share a website link, admin account so we can check it out 🙂 Also ftp would help
Thanks for contacting usHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
February 28, 2015 at 21:42 #48162sharmstrModeratorI had a similar avatar issue with Social Login. See the reason here: https://archived.seventhqueen.com/forums/topic/intergrating-social-login-plugin-with-kleo-login#post-44269
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
February 28, 2015 at 23:47 #48175BDecker19ParticipantHmm… tried adding in this code, and unfortunately doesn’t seem to be solving the issue for us?
March 1, 2015 at 02:30 #48197LauraModeratorHello, i have uploaded an avatar for the user you gave me and it worked fine in members directory, the register with linkedin adds an avatar to each profile? Did the member with the bug register with linkedin? It works in the users goes to profile and changes the avatar
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
March 1, 2015 at 03:01 #48201BDecker19Participanthmm… may have lost you a little here? basically you’re saying then it may be the social login plugin that’s not correctly updating the avatar file?
March 1, 2015 at 03:06 #48202BDecker19Participantif so, could you let me know what’s involved in setting an avatar correctly (for instance, what happens when a user uploads an avatar manually the way you did)?
March 1, 2015 at 03:35 #48206sharmstrModeratorAgain, it sounds exactly like the problem I had with the Social Login plugin. The avatar in the menu did not display if a user used any social site to login (facebook, google +, linkedin). It was only when I user uploaded an image via their profile AND logged in via WP.
The reason this happens is because the Social Login is doing its own filtering of the get_avatar function. You need to see if the plugin you’re using is doing the same thing.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
March 1, 2015 at 03:44 #48207BDecker19ParticipantWhen you say “doing its own filtering of the get_avatar function” — what’s this mean exactly?
March 1, 2015 at 06:10 #48225LauraModeratorHello, it means that it doesnt look for buddypress, but for wordpress avatar, it needs to be changed, you could ask in their support forum? 🙂
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
March 1, 2015 at 06:16 #48226BDecker19Participantwhen you say “it” — kinda confused. I’d think it’s the theme that’s looking for either the buddypress or wordpress avatar, rather than the plugin, no?
March 1, 2015 at 07:00 #48227sharmstrModeratorWhen something is filtered (changed), it doesnt matter who/what calls it. (http://codex.wordpress.org/Plugin_API/Filter_Reference) The results have already been changed by the time Kleo calls it. Furthermore, as shown in the code, kleo is calling bp_get_loggedin_user_avatar. That’s not a kleo function, that’s a Buddypress function.
Have you discussed this with the plugin devs? We’ve illustrated that it only happens when people use their plugin to log in, correct?
I’ll walk you through the issue with Social Login. Hopefully this will help you understand and assist you finding the issue with whatever plugin you’re using.
As I’ve said, SL filters ‘get_avatar’. get_avatar is called by bp_get_loggedin_user_avatar.
COPY CODEadd_filter ('get_avatar', 'oa_social_login_custom_avatar', 10, 5);
The filter calls ‘oa_social_login_custom_avatar’.
COPY CODE/** * Hook to display custom avatars */ function oa_social_login_custom_avatar ($avatar, $mixed, $size, $default, $alt = '') { //The social login settings static $oa_social_login_avatars = null; if (is_null ($oa_social_login_avatars)) { $oa_social_login_settings = get_option ('oa_social_login_settings'); $oa_social_login_avatars = (isset ($oa_social_login_settings ['plugin_show_avatars_in_comments']) ? $oa_social_login_settings ['plugin_show_avatars_in_comments'] : 0); } //Check if social avatars are enabled if (!empty ($oa_social_login_avatars)) { //Check if we have an user identifier if (is_numeric ($mixed) AND $mixed > 0) { $user_id = $mixed; } //Check if we have an user email elseif (is_string ($mixed) AND ($user = get_user_by ('email', $mixed))) { $user_id = $user->ID; } //Check if we have an user object elseif (is_object ($mixed) AND property_exists ($mixed, 'user_id') AND is_numeric ($mixed->user_id)) { $user_id = $mixed->user_id; } //None found else { $user_id = null; } //User found? if (!empty ($user_id)) { //Override current avatar ? $override_avatar = true; //BuddyPress (Thumbnails in the default WordPress toolbar) if (function_exists ('bp_core_fetch_avatar') AND function_exists ('bp_core_avatar_default')) { //Fetch the BuddyPress user avatar $bp_user_avatar = bp_core_fetch_avatar (array ('item_id' => $user_id, 'no_grav' => true, 'html' => false)); //Do not override if it's not the default avatar if (!empty ($bp_user_avatar) AND $bp_user_avatar <> bp_core_avatar_default ()) { //User has probably upladed an avatar $override_avatar = false; } } //Show avatar? if ($override_avatar) { //Read the avatar $user_meta_thumbnail = get_user_meta ($user_id, 'oa_social_login_user_thumbnail', true); $user_meta_picture = get_user_meta ($user_id, 'oa_social_login_user_picture', true); //Use the picture if possible if ($oa_social_login_avatars == 2) { $user_picture = (!empty ($user_meta_picture) ? $user_meta_picture : $user_meta_thumbnail); } //Use the thumbnail if possible else { $user_picture = (!empty ($user_meta_thumbnail) ? $user_meta_thumbnail : $user_meta_picture); } //Avatar found? if ($user_picture !== false AND strlen (trim ($user_picture)) > 0) { return ''; } } } } //Default return $avatar; }
As you can see in the function, it changes the get_avatar call to return the following, no matter what arguments you supply.
COPY CODE'';
The problem with this is that Kleo wants all the html stripped out so that it only receives the path to the file, not the img src tags. Since kleo doesnt get a path and gets the actual image html, it cant find the avatar and shows a default one instead.
Again, talk to the devs and see if they filter get_avatar. Maybe something else is going on, but you should investigate this as an option.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
March 1, 2015 at 07:38 #48229BDecker19ParticipantOk, definitely will. To be honest, still a bit confused though. Where is bp_get_loggedin_user_avatar calling to? As in, the image address it seems isn’t stored in the database anywhere, right?
March 3, 2015 at 01:48 #48446BDecker19ParticipantSee below reply from social login provider. Is this helpful in diagnosing what the issue is?
Hi Benji,
I found a bug when displaying the full sized avatar and have fixed that. However that does not help you with your kleo theme not displaying the proper thumbnail. Since that is something that is out of our scope I cannot code that modification. I can however point you to the code we have developed and hopefully you can modify your theme to use the same code. In the file LoginRadius.php there is the code:
if ( isset( $loginRadiusSettings[‘LoginRadius_socialavatar’] ) && in_array( $loginRadiusSettings[‘LoginRadius_socialavatar’], array( ‘socialavatar’, ‘largeavatar’, ‘allgravateravatar’, ’emptysocialavatar’ ) ) ) {
add_filter( ‘bp_core_fetch_avatar’, ‘login_radius_bp_avatar’, 10, 2 );
}
The login_radius_bp_avatar() is the function used for Buddypress avatar rendering. This is probably the same function you need for your theme icon. Please let us know if this is helpful in your modification.
LoginRadius TeamMarch 3, 2015 at 02:00 #48449sharmstrModeratorOh look, they are filtering the avatar. *sigh*
I need to see login_radius_bp_avatar
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
March 3, 2015 at 02:22 #48453sharmstrModeratorPut this in your childs functions.php file and see what happens. This is just a guess since I dont have their code.
edit: attached code instead
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
Attachments:
You must be logged in to view attached files.March 3, 2015 at 02:35 #48458sharmstrModeratorYou cant attach php files.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
March 3, 2015 at 02:36 #48459BDecker19Participantah, how bout this?
Attachments:
You must be logged in to view attached files.March 3, 2015 at 02:41 #48462sharmstrModeratorDid you try the code I gave you?
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
March 3, 2015 at 02:48 #48465sharmstrModeratorI also need a linkedin account to use to login with.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
March 3, 2015 at 02:53 #48468sharmstrModeratorIs this site live or still in beta?
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
March 3, 2015 at 02:54 #48469BDecker19Participanteh, somewhere in between. but no actual users yet, and just made a backup
March 3, 2015 at 03:01 #48470sharmstrModeratorwhat’s the ftp server name?
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
March 3, 2015 at 03:03 #48472sharmstrModeratornever mind. i got it.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
March 3, 2015 at 15:49 #48543sharmstrModeratorIts showing up now but they put their own css on it when they filter it. I’m not fixing that. Good luck.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
March 3, 2015 at 17:08 #48555BDecker19ParticipantHey, thanks so much for this. Semi-out of curiosity, are you able to let me know what you did to fix it?
March 3, 2015 at 17:14 #48560sharmstrModeratorlook at the top of your functions.php file.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
March 3, 2015 at 18:04 #48570BDecker19ParticipantHmm… ok. So it looks like you’re overwriting kleo BP config file, changing the “output” within kleo_menu_user_avatar from:
COPY CODE$output .= '<a title="' . bp_get_loggedin_user_fullname() . '" class="kleo-bp-user-avatar' . ( $args->has_children && in_array($depth, array(0,1)) ? ' js-activated' : '' ) . '" href="' . $url . '" title="' . $attr_title .'">' . '<img src="' . bp_get_loggedin_user_avatar(array('width' => 25, 'height' => 25, 'html' => false)) . '" class="kleo-rounded" alt="">' . ($item->attr_title != '' ? ' ' . $item->attr_title : '');
to:
COPY CODE$output .= '<a title="' . bp_get_loggedin_user_fullname() . '" class="kleo-bp-user-avatar kleo-rounded-noborder kleo-avatar-menu' . ( $args->has_children && in_array($depth, array(0,1)) ? ' js-activated' : '' ) . '" href="' . $url . '" title="' . $attr_title .'">' . bp_get_loggedin_user_avatar(array('width' => 25, 'height' => 25)) . '</a>';
Where the difference is you’re adding the extra classes (I guess just to ensure proper styling?) and then calling the bp_get_loggedin_user_avatar function, which it wasn’t previously.
Is this all right?
Thanks so much for your help here!
March 3, 2015 at 18:05 #48571hmaParticipantHello,
I have a basic question,
I can see in the picture attached that Bdecker has put on lien the admin bar which is in grey with some menu from Kleo like notifications, and picture of user (when working ,;-))
Forgive me but how can I reach this ?
I only got a basic and ugly wordpress admin bar…
Best regards,
hervéMarch 3, 2015 at 18:45 #48575sharmstrModerator@hma – That’s not the admin bar. That’s kleos top bar menu. Theme options > Header Options. Create the menu in Appearance > Menus
Benji – I’m not overwriting the config. As I explained a few times now, I modified the kleo_menu_user_avatar because ….
The problem with this is that Kleo wants all the html stripped out so that it only receives the path to the file, not the img src tags. Since kleo doesnt get a path and gets the actual image html, it cant find the avatar and shows a default one instead.
The path is dependent upon how they logged in. If they log in via WP then it looks in the avatar folder. If they log in via linked in, then the path is on the linkedin servers.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
-
AuthorPosts
The forum ‘General questions’ is closed to new topics and replies.