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

Removing Gender?

Discussion in 'XenForo Pre-Sales Questions' started by Fallacy, Oct 10, 2011.

  1. Fallacy

    Fallacy New Member

    This is probably a slightly odd question, but how easy would it be to remove gender as an option to fill out? I'm assuming this would require some tweaking with the avatars.
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You can remove it from the templates:

    Admin CP -> Appearance -> Templates -> register_form

    Remove this code:

    Code:
    	<dl class="ctrlUnit">
    		<dt>{xen:phrase gender}:</dt>
    		<dd>
    			<ul>
    				<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_"><input type="radio" name="gender" value="" id="ctrl_gender_" {xen:checked "!{$fields.gender}"} /> ({xen:phrase unspecified})</label></li>
    			</ul>
    		</dd>
    	</dl>
    
    A similar edit must be made to account_personal_details.

    Removing this field will result in everyone having an "unspecified" gender.
     
    Breixo and Fallacy like this.
  3. Fallacy

    Fallacy New Member

    Wow, thanks. Now all I have to do is figure out how I'm going to afford a license.
     
  4. jonsidneyb

    jonsidneyb Well-Known Member

    Thanks, I was needing this as well.
     
  5. digitalpoint

    digitalpoint Well-Known Member

    This thread was much more interesting when I only read the title. :)
     
  6. Deepmartini

    Deepmartini Well-Known Member

    It would be nice to have this as an option in the admin control panel. Would be a simple feature to include.
     
    AndyB likes this.
  7. JChandler

    JChandler Member

    On a slightly odder note, is it possible to ADD selections to the gender possibilities? I'm working on a project that validates the existence of genders outside of the accepted male/female dichotomy.

    If it is possible, how's it done? I'd rather have more selections rather than just "unspecified."
     
  8. James

    James Well-Known Member

    You'd have to edit/extend XenForo_DataWriter_User::_getFields() on lines 57 and 58 to allow more values:
    PHP:
    'gender'
    => array('type' => self::TYPE_STRING'default' => '''allowedValues' => array('male''female''''hermaphrodite''etc')),
    Then you'd have to edit the gender template to add the extra values.
     
    stefan and JChandler like this.
  9. JChandler

    JChandler Member

    Will this cause issues with default avatars for male and female? What will Xenforo do when it looks for something other than male/female?
     
  10. ragtek

    ragtek Guest

    Use the default avatar
    [​IMG]
     
  11. stefan

    stefan Member

    I tried to add more gender options (edited user.php in line 58 as well as the template), but when I try to put something other then "male"/"female"/"" into the field, i get the following message:

    Any ideas?^^
     
  12. ragtek

    ragtek Guest

    Yes


    Check the db;)
    Code:
    gender ENUM('','male','female') NOT NULL DEFAULT '' COMMENT 'Leave empty for ''unspecified''',
    you'll need to change this in your db too (you'll find this in the table xf_user )
     
    stefan likes this.
  13. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    I replied to JC's private message, but I am posting it here too:

    That requires some doing. See this post:

    http://xenforo.com/community/threads/can-i-add-a-gender-option-i-e-couple.7276/#post-102746

    You might consider just creating a profile field for this:

    Admin CP -> Users -> Custom User Fields
     
  14. RoldanLT

    RoldanLT Well-Known Member

    How about removing only the unspecified button, and defaults the selection to male?
     
  15. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    @RoldanLT

    Code:
    	<dl class="ctrlUnit">
    		<dt>{xen:phrase gender}:</dt>
    		<dd>
    			<ul>
    				<li><label for="ctrl_gender_male"><input type="radio" name="gender" value="male" id="ctrl_gender_male" {xen:checked "{$fields.gender} == 'male' OR !{$fields.gender}"} /> {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>
    			</ul>
    		</dd>
    	</dl>
    
     
    RoldanLT and vinhtq like this.
  16. AndyB

    AndyB Well-Known Member

    Digital Doctor likes this.
  17. RoldanLT

    RoldanLT Well-Known Member

    XF 1.4 has different template:
    Code:
    <dl class="ctrlUnit">
            <dt>{xen:phrase gender}:</dt>
            <dd>
                <ul>
                    <li><label><input type="radio" name="{$fieldMap.gender}" value="male" {xen:checked "{$fields.gender} == 'male'"} /> {xen:phrase male}</label></li>
                    <li><label><input type="radio" name="{$fieldMap.gender}" value="female" {xen:checked "{$fields.gender} == 'female'"} /> {xen:phrase female}</label></li>
                    <li><label><input type="radio" name="{$fieldMap.gender}" value="" {xen:checked "!{$fields.gender}"} /> ({xen:phrase unspecified})</label></li>
                </ul>
            </dd>
        </dl>
     
  18. Digital Doctor

    Digital Doctor Well-Known Member

    Ideally, adding the issue of Gender should be an option, not a requirement. Especially on most forums, there are more guys pretending they are girls than actual girls.
     
    WoodiE and MQK8 like this.

Share This Page