[SOLVED] Gravatar as CB Avatar

7 years 8 months ago - 7 years 7 months ago #284378 by MAYASIMA
[SOLVED] Gravatar as CB Avatar was created by MAYASIMA
I am trying to pull the Gravatar into the CB Avatar. In the "Profile Value Layout" of the CB Avatar I added:
[cb:if cb_gravatar=""][value][/cb:if]
[cb:if cb_gravatar!=""][cb:userfield field="cb_gravatar" /][/cb:if]

In the "Userlist Value Layout" of the CB Avatar I added:
[cb:if cb_gravatar=""][value][/cb:if]
[cb:if cb_gravatar!=""][cb:userfield field="cb_gravatar" reason="list" /][/cb:if]

It only seems to work when I both set the Gravatar and CB Avatar fields to Show on Profile. Obviously that defeats the purpose. I just want the CB Avatar field to Show on Profile and have it pull the Gravatar if a Gravatar is available.

Any feedback as to what I am doing wrong here?

Thx!

Sima

Please Log in to join the conversation.

7 years 8 months ago #284390 by krileon
Replied by krileon on topic Gravatar as CB Avatar
They both need to be set to show on profile for those substitutions to output them, but they don't actually have to be visible. To do this move them to a tab that's in a not shown on profile position so they won't display on profile, but can be substituted in fine.


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 to join the conversation.

7 years 7 months ago #285027 by MAYASIMA
Replied by MAYASIMA on topic Gravatar as CB Avatar
Hello Kyle,

I followed your instructions and it works fine now. I have another problem though, now when I update the cb avatar with another image it will not replace it when it just viewed. It does replace it in edit mode but not when it is just displayed, instead it shows the gravatar. Do I need to create an auto action to delete the gravatar email address every time the cb avatar gets updated?

Thanks,

Sima

Please Log in to join the conversation.

7 years 7 months ago #285046 by krileon
Replied by krileon on topic Gravatar as CB Avatar
Well your condition is specifically configured to show the gravatar if the gravatar field has a value. It's not conditioning whether they uploaded something or not. So you'll need to empty the gravatar field before it'll show your uploaded image. The alternative is to add an extra condition to see if they uploaded something. Below will probably work.

[cb:if cb_gravatar="" or avatar!~"/(nophoto_n|tnnophoto_n)\.png$/"][value][/cb:if]
[cb:if cb_gravatar!="" and avatar=~"/(nophoto_n|tnnophoto_n)\.png$/"][cb:userfield field="cb_gravatar" /][/cb:if]

The first condition says if cb_gravatar is empty or if avatar is not the empty default then show avatar field. The second condition says if cb_gravatar is not empty and the avatar field is the empty default then show gravatar field.

This just switches the behavior you're seeing to the gravatar field instead of the avatar field though. Only way to clear the issue both ways is if you upload something then empty cb_gravatar and if you set cb_gravatar then delete the avatar (requires PHP).


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 to join the conversation.

7 years 7 months ago #285067 by MAYASIMA
Replied by MAYASIMA on topic Gravatar as CB Avatar
Thanks Kyle, I got it to work with your feedback. Just a question, after fixing the issue, the avatar or gravatar are displaying as regular size (dimensions) and not the thumbnail size. How can I fix this?

Please Log in to join the conversation.

7 years 7 months ago - 7 years 7 months ago #285107 by krileon
Replied by krileon on topic Gravatar as CB Avatar
The [value] should already be appropriately sized based off location. Fullsize on profile and thumbnail on userlist for example. The substitution usage you're using for the gravatar field is always going to be fullsize. To substitute in thumbnail you need to specify the reason as list on the substitution. Example as follows.

[cb:userfield field="cb_gravatar" reason="list" /]


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 to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.285 seconds

Facebook Twitter LinkedIn