I am trying to show content to users based on their gender.
{if $user->gender == 1} works some place but not others.
What can I use to show content on the gallery startpage based on gender?
Muchas Gracias
I am trying to show content to users based on their gender.
{if $user->gender == 1} works some place but not others.
What can I use to show content on the gallery startpage based on gender?
Muchas Gracias
You can use $__wcf->user->gender at any place.
Thanks for that tip
And is there a way to get content author's gender?
For example if I use $__wcf->user->gender on Recent Activity for Dashboard - I got my gender, not authors one, which gives incorrect result.
I tried $author->gender, but it doesn't work...
EDIT: Failures also for:
- $__wcf->getUser($post->userID)->gender
- $owner->gender
And few combinations of these
Sorry for doing this, but this issue is blocking me - anybody know solution for this? To get authors gender? Or it is impossible? If it is not possible - please let me know so I will be able to close this and release translation without this.
It's always based on the template and the given variables. In your example of recent activities the template dashboardBoxRecentActivity.tpl is loaded which includes another one.
In the template recentActivityListItem you have the "real" items which where shown in the recent activites.
So there is a variable assigned in the foreach loop called $event. With this variable you can get access to the user of the event object. To access this user you need to use $event->getUserProfile() or access the gender of the user with $event->getUserProfile()->gender
This is a bit more advanced. What you really want to do with that information?
Thanks for answer, I'm not playing with templates, but finalizing translation.
Example line in English language:
Replied to the thread {if $thread->hasLabels()}{foreach from=$thread->getLabels() item=label}<span class="label badge{if $label->getClassNames()} {$label->getClassNames()}{/if}">{lang}{$label->label}{/lang}</span> {/foreach}{/if} <a href="{link application='wbb' controller='Thread' object=$thread}postID={@$post->postID}{/link}#post{@$post->postID}" class="wbbPostLink" data-post-id="{@$post->postID}">{$thread->topic}</a>.
In Polish language "replied" got different forms for he and she. So my idea was to get gender from profiles and if set - give correct vesrion:
- if "male" then "Username odpowiedział w wątku"
- if "female" then "Username odpowiedziała w wątku"
Currently I'm able to get my own gender with $__wcf->user->gender, but of course I cannot use this construction in situation above as this would return always my gender, not the user who has replied.
With $event->getUserProfile()->gender I got fatal error...
If it is not possible to get author gender at translation part I will probably have to add something like: "Username odpowiedział(a) w wątku" or only male version...
Use a general form. The gender is not set by every user.
In your case I can't find a solution to access the user of the post.
Well, I can strike this out from my to-do list. But it's pity, probably some general form will be looking weird there...
Thanks for help
Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!