• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Custom Gender Issues

#3
I would much rather have more built-in gender options. The errors I am getting are not on the lines I am changing. They're usually closing tags, which (again), appear to be formatted correctly. Maybe a quick editing guide may be more helpful?
 
#5
In template search:

account_personal_details
(no errors produced)
Code:
<li><label for="ctrl_gender_male"><input type="radio" name="gender" value="male" id="ctrl_gender_male" {xen:checked "{$visitor.gender} == 'male'"} /> {xen:phrase male}</label></li>
<li><label for="ctrl_gender_female"><input type="radio" name="gender" value="female" id="ctrl_gender_female" {xen:checked "{$visitor.gender} == 'female'"}  /> {xen:phrase female}</label></li>
<li><label for="ctrl_gender_bigender"><input type="radio" name="gender" value="bigender" id="ctrl_gender_bigender" {xen:checked "{$visitor.gender} == 'bigender'"}  /> {xen:phrase bigender}</label></li>
register_form (no errors produced)
Code:
<li><label for="ctrl_gender_male"><input type="radio" name="gender" value="male" id="ctrl_gender_male" {xen:checked "{$fields.gender} == 'male'"} /> {xen:phrase male}</label></li>
<li><label for="ctrl_gender_female"><input type="radio" name="gender" value="female" id="ctrl_gender_female" {xen:checked "{$fields.gender} == 'female'"} /> {xen:phrase female}</label></li>
<li><label for="ctrl_gender_bigender"><input type="radio" name="gender" value="bigender" id="ctrl_gender_bigender" {xen:checked "{$fields.gender} == 'bigender'"} /> {xen:phrase bigender}</label></li>
<li><label for="ctrl_gender_"><input type="radio" name="gender" value="" id="ctrl_gender_" {xen:checked "!{$fields.gender}"} /> ({xen:phrase unspecified})</label></li>
member_view (both instances in the script were changed to match)
Code:
<dd itemprop="gender"><xen:if is="{$user.gender} == 'male'">{xen:phrase male}<xen:if is="{$user.gender} == 'bigender'">{xen:phrase bigender}<xen:else />{xen:phrase female}</xen:if></dd>
Error: The following templates contained errors and were not saved: member_view: 1) Line 151: Template syntax error.

message_user_info
Code:
<dd itemprop="gender"><xen:if is="{$user.gender} == 'male'">{xen:phrase male}<xen:if is="{$user.gender} == 'bigender'">{xen:phrase bigender}<xen:else />{xen:phrase female}</xen:if></dd>
Error: The following templates contained errors and were not saved: message_user_info: 1) Line 84: Template syntax error.

The error lines are just the closing tag (/dl). Correct me if I'm wrong, but doesn't the new gender reside within the same containing tag, and thus not needing a new one?

What else needs to be edited? Within the PHP scripts mentioned in the other thread, what needs to be changed?

I appreciate your assistance :)
 

Jake Bunce

XenForo moderator
Staff member
#6
Change this part:

Code:
<dd itemprop="gender"><xen:if is="{$user.gender} == 'male'">{xen:phrase male}<xen:if is="{$user.gender} == 'bigender'">{xen:phrase bigender}<xen:else />{xen:phrase female}</xen:if></dd>
To this:

Code:
<dd itemprop="gender"><xen:if is="{$user.gender} == 'male'">{xen:phrase male}<xen:elseif is="{$user.gender} == 'bigender'" />{xen:phrase bigender}<xen:else />{xen:phrase female}</xen:if></dd>
That should do it. It's similar for the other template.
 
#7
ahh, yes! The self-closing tag. Almost forgot about that. Many thanks to you, Jake! Is there anything else I need to do in order to make this functional? You mentioned some database changes in the other thread...

Also, I'm still rather new to XF. Where should I go to define default avatars for each gender?
 
#9
Weird, when I search in my database, I don't see any fields containing the word 'gender.' What table/column is it named or contained within by default?

Also, I'm still looking to change the default avatars for each gender. Where would I go to do that? These are pretty much the last two major things that I need.
 

Morgain

Well-known member
#10
Maxwell I changed the default gender avatars like this:

Created 3 avatars for each gender.
Sizes:
avatar_female_l.png 192 X 154
avatar_female_m.png 96 X 76
avatar_female_s.png 48 X 39

So 3 male ones the same and the neutral one.

In the XF directory
\styles\default\xenforo\avatars

Rename all those 9 avatars - eg add "ORIG" on the end of the name.
By doing this you have the original files to compare or use as a basis for other designs later. I always do this when hacking to be safe.

Upload the new avatars into this folder.
By renaming the old ones with ORIG on the END of the name, the new ones sit with the old ones so you can double check you have the filenames correct.

That's it.

But I don't know what you do about giving your custom gender statuses a default avatar. You could rename Unspecified for one of them? I'm sure Jake or someone clever can help you take this further.
 
#11
Hi Morgain,

I very much appreciate your input, but unfortunately this does not help me in regards to defining the default avatar for custom genders (as you said). But I very much appreciate you taking the time to advise others, so you get points for that :)

I guess we'll just to wait to hear Jake's suggestions on both of these matters (the database and the avatars).
 

Jake Bunce

XenForo moderator
Staff member
#12
The table is xf_user. The field is gender.

The avatars are in styles/default/xenforo/avatars.

The use of those avatars is defined in the PHP code:

library/XenForo/Template/Helper/Core.php
 
#13
Jake, are you sure any modifications are necessary on the PHP scripts and in the database? I'm not seeing anything that would inhibit the new custom genders from being functional, at least from what I'm seeing.
 
#15
Right, but what lines actually need to be modified in the PHP files? Everything that I'm reading appears to be fine. If you can give me an example of the changes that need to be made, I'd be eternally grateful.
 
#17
Maybe a better question would be: what evidence leads you to the conclusion that those files need to be edited? As I said earlier, it looks like things appear to be in line. My PHP skills aren't perfect, so if there are any programmers reading this that want to chime in, I'd be quite grateful.