Display a customized Avatar when hidden by Privacy

8 years 4 months ago - 8 years 4 months ago #274276 by pranaydhruv
Hello Team,

I have utilized the post below :-

www.joomlapolis.com/forum/153-professional-member-support/228527-solved-gender-badges?start=12

and replicated the code in Profile layout of the avatar,however i also want to add one more condition that if avatar is empty(HTML output hidden by cb privacy plugin i want to display a different image. I have tried different permutations and combinations of IF's but for some reason it doesn't work.

[cb:if avatar!~"/(nophoto_n|tnnophoto_n)\.png$/"][value][/cb:if]
[cb:if avatar=~"/(nophoto_n|tnnophoto_n)\.png$/" and cb_gender="Female"]<img src="http://localhost/components/com_comprofiler/plugin/templates/default/images/avatar/nophoto_f.png" alt="Female" class="cbImgPict cbFullPict img-thumbnail" />[/cb:if]
[cb:if avatar=~"/(nophoto_n|tnnophoto_n)\.png$/" and cb_gender="Male"]<img src="http://localhost/components/com_comprofiler/plugin/templates/default/images/avatar/nophoto_m.png" alt="Male" class="cbImgPict cbFullPict img-thumbnail" />[/cb:if]

This is what i have tried , but without success :-

Example 1:-
[cb:if avatar=" "]<img src="http://localhost/components/com_comprofiler/plugin/templates/default/images/avatar/nophoto_m.png" alt="Male" class="cbImgPict cbFullPict img-thumbnail" />[/cb:if]

Example 2:-
[cb:if avatar!="1"]<img src="http://localhost/components/com_comprofiler/plugin/templates/default/images/avatar/nophoto_m.png" alt="Male" class="cbImgPict cbFullPict img-thumbnail" />[/cb:if]

Thanks
Pranay

Please Log in to join the conversation.

8 years 4 months ago #274498 by pranaydhruv
Replied by pranaydhruv on topic Display a customized Avatar when hidden by Privacy
Hello Team,


Need some help with this issue please.

Thanks
Pranay

Please Log in to join the conversation.

8 years 4 months ago #274505 by nant

pranaydhruv wrote: Hello Team,


Need some help with this issue please.

Thanks
Pranay


Sorry, this is not a simple support question.

It involves multiple add-ons and coding logic.
I will tackle it when I have a chance to research it further.

I am not sure for example what the exact effect of privacy would be.

Please Log in to join the conversation.

8 years 4 months ago #274507 by pranaydhruv
Replied by pranaydhruv on topic Display a customized Avatar when hidden by Privacy
Hello Nant,

the if's solution provided by Kyle in the post i refer, works fine for gender badges issue i have tested it so a similar if should work for Avatar but maybe i am not selecting something correct. unable to figure out what exactly is missing.

Thanks
Pranay

Please Log in to join the conversation.

8 years 4 months ago #274528 by nant

pranaydhruv wrote: Hello Nant,

the if's solution provided by Kyle in the post i refer, works fine for gender badges issue i have tested it so a similar if should work for Avatar but maybe i am not selecting something correct. unable to figure out what exactly is missing.

Thanks
Pranay


The code Kyle provided was targeting a profile layout for the avatar field (original post here: www.joomlapolis.com/forum/153-professional-member-support/228527-gender-badges?start=6#259249 ).

Your

Example 1:-
[cb:if avatar=" "]<img src="http://localhost/components/com_comprofiler/plugin/templates/default/images/avatar/nophoto_m.png" alt="Male" class="cbImgPict cbFullPict img-thumbnail" />[/cb:if]

Example 2:-
[cb:if avatar!="1"]<img src="http://localhost/components/com_comprofiler/plugin/templates/default/images/avatar/nophoto_m.png" alt="Male" class="cbImgPict cbFullPict img-thumbnail" />[/cb:if]


is most likely failing the avatar checks.
I do not see how the avatar field becomes a space (example 1) or becomes 1.

How did you come up with these concepts?
Perhaps I missed something?

You mentioned something like: "avatar is empty(HTML output hidden by cb privacy plugin".
What exactly do you mean by this?
Do you have privacy enabled on the avatar field?
If so what exact settings?

Sorry, I am still trying to understand your use case needs.

Please Log in to join the conversation.

8 years 4 months ago #274544 by pranaydhruv
Replied by pranaydhruv on topic Display a customized Avatar when hidden by Privacy
Dear Nant,

Kyle updated that when a field is hidden by the privacy plugin, only HTML output gets hidden or becomes empty. that is why u see the space or blank in one of the IF conditions, the other condition means a scenario when the avatar field value is not equal to 1, which means it has nothing in it.

so basically whatever value corresponds to an empty value that is generated for a field when a user selects the privacy option of that field to private or something custom is what needs to be considered in the if statement as per my understanding.

Thanks
Pranay

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.272 seconds

Facebook Twitter LinkedIn