-
Author
Tagged: default avatar, man woman
-
June 17, 2015 at 20:37 #63538HavenParticipant
I design the default avatars for man and woman.
I hope when the website show default avatar , it can show default man avatar image and default woman avatar image according to the user profile.
How can I do ?June 19, 2015 at 18:19 #63896LauraModeratorHello, it can be done with custom code, try this in functions.php of child theme
COPY CODEadd_filter( 'bp_core_fetch_avatar_no_grav', '__return_true' ); function myavatar_add_default_avatar( $url ) { global $bp; $gender = xprofile_get_field_data('I am a', bp_get_member_user_id()); if ($gender == "Male") { return $img_url = SECU.'MALE AVATAR URL OF IMAGE'; } else { return $img_url = SECU.'FEMALE AVATAR URL OF IMAGE'; } } add_filter( 'bp_core_mysteryman_src', 'myavatar_add_default_avatar' ); add_filter( 'bp_core_default_avatar_user', 'myavatar_add_default_avatar' );
Just add the url for female an male images and it should work.
It works only if you have Male and Female and no more options in I am a fieldHi 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 🙂
June 20, 2015 at 00:57 #64003HavenParticipantI tried this code, excellent!, it work nice. now the users show default avatar according their gender.
Thank u lots!June 21, 2015 at 04:34 #64124LauraModeratorGlad it worked!
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 🙂
August 13, 2015 at 20:14 #72903jenny555ParticipantHi, i try it, but it doesn’t work for me. I also have a problem with the display of women online and men online in homepage doesn’t work well, this may be related. Can you help me please?
August 15, 2015 at 02:53 #73068LauraModeratorHello, do you have your site in another language? If so, you need to change the shortcode in homepage, and change woman and man for your language words, also in the code above
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 🙂
August 16, 2015 at 01:46 #73188jenny555ParticipantHello Laura,
yes i have the french language activated. I tried what you told me to do, but it doesn’t. Here is my functions file:COPY CODE<?php /** * @package WordPress * @subpackage Sweetdate * @author SeventhQueen <themesupport@seventhqueen.com> * @since Sweetdate 1.0 */ /** * Sweetdate Child Theme Functions * Add extra code or replace existing functions */ //Avatar default add_filter( 'bp_core_fetch_avatar_no_grav', '__return_true' ); function myavatar_add_default_avatar( $url ) { global $bp; $gender = xprofile_get_field_data('Je suis', bp_get_member_user_id()); if ($gender == "Homme") { return $img_url = SECU.'/wp-content/uploads/2015/08/avatarh.png'; } else { return $img_url = SECU.'/wp-content/uploads/2015/08/avatarf.png'; } } add_filter( 'bp_core_mysteryman_src', 'myavatar_add_default_avatar' ); add_filter( 'bp_core_default_avatar_user', 'myavatar_add_default_avatar' ); //manual total members add_filter( 'bp_get_total_member_count', 'kleo_my_total_members' ); function kleo_my_total_members($number) { $number = str_replace(".","",$number); return 1284; } //manual number online members add_filter( 'kleo_online_users_count', 'kleo_my_online_users', 10, 2); function kleo_my_online_users($number, $value) { switch ($value) { //ALL MEMBERS ONLINE case FALSE: return '195'; break; case "Woman": return $number+51; break; case "Man": return $number+134; break; default: return $number; break; } } ?>
what doesn’t work? Also I didn’t understand what I have to change in the homepage. Thanks
August 17, 2015 at 19:02 #73431LauraModeratorHello, have you tried using the full url path of the image? “http://mywebsite.com/…”
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 🙂
August 18, 2015 at 00:27 #73496jenny555ParticipantHello Laura, problem solved! it works!
Here is the solution for members who have the same problem as me …
We do need to change, “I am a” and “Man” in your language (case sensitive). Then, this blocking, it is the “SECU.” before url in the code. I deleted it and it works.
Here are the correct code. But I have more questions then I’ll open another topic. In the meantime, thank you.COPY CODE//Avatar default add_filter( 'bp_core_fetch_avatar_no_grav', '__return_true' ); function myavatar_add_default_avatar( $url ) { global $bp; $gender = xprofile_get_field_data('Je suis', bp_get_member_user_id()); if ($gender == "Un Homme") { return $img_url = '/wp-content/uploads/2015/08/avatarh.png'; } else { return $img_url ='/wp-content/uploads/2015/08/avatarf.png'; } } add_filter( 'bp_core_mysteryman_src', 'myavatar_add_default_avatar' ); add_filter( 'bp_core_default_avatar_user', 'myavatar_add_default_avatar' );
August 20, 2015 at 01:05 #73831LauraModeratorHello, glad you could do it!
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 🙂
July 23, 2016 at 03:51 #129905love2playgamesParticipantHi Laura,
Ok, good news I also got this Male/Female going.
The bad news is this default avatar function is taking over ALL the members that already has their own profile avatar previously…
So it seems like it will work good ONLY for the NEW members that upload their profile image to replace this default avatar. OR wouldn’t over write with the registered avatar by email or facebook image.
I end up have to take out this functions after all 🙁
Can you help me how to fix this default function ONLY for the Mystry Man and NOT overwrite or avoid the existing member avatar?
Please advise big time help. Thanks
July 25, 2016 at 21:07 #130153LauraModeratorHello, that is not available right now 🙁
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 🙂
January 12, 2017 at 00:50 #149536boraboramediaParticipantI got this code working to. Very nice!
However, I was wondering if 1 change is possible. At this moment when somebody register they always get the Female placeholder. Also if it is a man. When the user saves their profile, the right placeholder is set.
So my question is. Is it possible to use the custom unisex placeholder of SweetDate, but when the user saves their profile for the 1st time, the right placeholder will be loaded, of course only when they do not have uploaded a own picture.
Thnx!
January 13, 2017 at 05:13 #149694LauraModeratorHello you could make them the same image so they look unisex
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 🙂
January 18, 2017 at 00:22 #150044boraboramediaParticipantBut I would like to use 2 images, one for men profiles and one for female profiles. Like the above snippet does. It just loads the female placeholder by default, but I would like that the default SweetDate placeholder is loaded. And when somebody saves their profile the man/female placeholder is loaded. Hopefully you can help me with this…
January 20, 2017 at 10:41 #150285LauraModeratorHello, this would require more development so i suggest to hire a developer. As this snippet doesn’t have default images
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 🙂
January 30, 2017 at 15:17 #151351mrchristopheeParticipantHow can you use this code in Kleo, there is no ‘I am a’ Field?
February 2, 2017 at 05:50 #151670LauraModeratorHello, you can add it at Users > Profile fields
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 🙂
-
AuthorPosts
You must be logged in to reply to this topic.