Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

[SOLVED] Gender avatar in profile

  • mfe13
  • mfe13
  • OFFLINE
  • Posts: 572
  • Thanks: 26
  • Karma: 5
11 years 1 month ago - 11 years 1 month ago #234322 by mfe13
[SOLVED] Gender avatar in profile was created by mfe13
Hello

In bootstrap file / images / avatar / there are 12 avatar with the gender men or women.
But how to assign an avatar based on gender fields for the user who does not download pictures in their profile?
I think it is a conditional but I can not find how :blush:
thank you
Last edit: 11 years 1 month ago by krileon.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48466
  • Thanks: 8280
  • Karma: 1443
11 years 1 month ago #234326 by krileon
Replied by krileon on topic Gender avatar in profile
They're there for you to swap out as needed for your sites demographic. CB does not switch default avatar based off gender. Only way to swap them out based off gender is to use a delimiter field to display them using IF substitutions to condition against the avatar field and your gender field.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • mfe13
  • mfe13
  • OFFLINE
  • Posts: 572
  • Thanks: 26
  • Karma: 5
11 years 1 month ago #234342 by mfe13
Replied by mfe13 on topic Gender avatar in profile
I create a delimiter field with :

[cb:if cb_gender="Homme"]avatar_homme.png[/cb:if]
[cb:if cb_gender="Femme"]avatar_femme.png[/cb:if]

I add condition in field avatar :
field conditional self
if field: my new delimiter field
is operator: Does contain
to valor: nophoto_n.png
then : show

it works but it also replaces the images that have been uploaded :whistle:

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48466
  • Thanks: 8280
  • Karma: 1443
11 years 1 month ago - 11 years 1 month ago #234351 by krileon
Replied by krileon on topic Gender avatar in profile
You need to use a delimiter field to handle the entire avatar display. Example as follows.

[cb:if cb_gender="Homme" and avatar=~"nophoto_n.png|tnnophoto_n.png"]avatar_homme.png[/cb:if]
[cb:if cb_gender="Femme" and avatar=~"nophoto_n.png|tnnophoto_n.png"]avatar_femme.png[/cb:if]
[cb:if avatar!~"nophoto_n.png|tnnophoto_n.png"]show avatar[/cb:if]

You'll probably need to adjust the condition on the avatar to use regex and check for nophoto, but that's the idea behind the usage.

If you still want to use CB Conditionals then you'll need to have the avatar field condition it self (only do so on profile view and/or userist view) to ensure it doesn't have nophoto. As is you're trying to condition off the delimiter field, which isn't valid.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
Last edit: 11 years 1 month ago by krileon.

Please Log in or Create an account to join the conversation.

  • mfe13
  • mfe13
  • OFFLINE
  • Posts: 572
  • Thanks: 26
  • Karma: 5
11 years 1 month ago #234456 by mfe13
Replied by mfe13 on topic Gender avatar in profile
hello,

I explain here what I did if it helps someone ...
I created a delimiter field :
[cb:if cb_sexe="Man" avatar!=""]img1.png[/cb:if]
[cb:if cb_sexe="Women" avatar!=""]img2.png[/cb:if]

Then, in the Avatar fields, I added the condition :
Fields Conditional other
Operator: does contain
Valor: nophoto
Show : field delimiter
Hide : field avatar

Avatar is replaced by gender.
I can not do for userslist but it works for profiles.

Please Log in or Create an account to join the conversation.

  • mfe13
  • mfe13
  • OFFLINE
  • Posts: 572
  • Thanks: 26
  • Karma: 5
11 years 1 month ago #234525 by mfe13
Replied by mfe13 on topic Gender avatar in profile
hello, I come back to it!
there is a problem, but if a user record a photo with this setting, the picture does not appear, it is the original avatar is set!
is that I have another solution?
thank you

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum