News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Genders

Started by Jennifer RachaelAnn, April 19, 2017, 07:46:04 PM

Previous topic - Next topic

Linkjay

You could use the help wanted section or mod requests. You could also go as far as using a freelancer for hire site to do that.
I play games in my free time and volunteer my knowledge and support to the gaming communities of the internet.

You can contact me by these methods:
Use my Contact Script • PM me here • Add me on Steam

shawnb61

The custom fields solution requires no code, though it is limited in where identity is displayed.
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Kindred

Do what i said...   apply the mod
Then fix the one code which failed the auto check, as indicated...

If you want more options, then add cases within the list of case statements



Quote from: Kindred on April 20, 2017, 08:36:37 AM
Actually, this mod
https://custom.simplemachines.org/mods/index.php?mod=2152

will almost install on 2.0.13, if you emulate "SMF 2.0 RC2" (no quotes)
the only failure is in Load.php for the image
The fix?
Install the mod and then make this specific change

Code (in Load.php, find) Select

'image' => !empty($profile['gender']) ? '<img class="gender" src="' . $settings['images_url'] . '/' . ($profile['gender'] == 1 ? 'Male' : 'Female') . '.gif" alt="' . $gendertxt . '" />' : ''
   

Code (replace with ) Select

'image' => !empty($profile['gender']) ? '<img src="' . $settings['images_url'] . '/' . $genderimg . '" alt="' . $gendertxt . '" border="0" />' : ''



the nice thing about this mod is that it becomes fairly easy to change or add the choices -- just change the case statements as were added (see below) and then add additional images for each representation
Code (in Load.php) Select

switch($profile['gender']) {
            case 5:
                $gendertxt = $txt['intersexed'];
                $genderimg = 'intersexed.gif';
                break;
            case 4:
                $gendertxt = $txt['transf2m'];
                $genderimg = 'transexual.gif';
                break;
            case 3:
                $gendertxt = $txt['transm2f'];
                $genderimg = 'transexual.gif';
                break;
            case 2:
                $gendertxt = $txt['female'];
                $genderimg = 'Female.gif';
                break;
            case 1:
                $gendertxt = $txt['male'];
                $genderimg = 'Male.gif';
                break;
            default:
                $gendertxt = '';
                break;
        }

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

bestnow

#23
Quote from: shawnb61 on April 25, 2017, 08:59:09 PM
The custom fields solution requires no code, though it is limited in where identity is displayed.

Beta version of mod that Kindred send,


--edit: attachment removed

Arantor

Still don't get why custom fields aren't being used, requires no code change at all.

Kindred

that is true....  custom fields could be used as well, with no coding.
I just went the route of the mod because it uses the existing gender field in the user record... but if you never plan to do any additional logic on the field, then I guess custom fields would be easier, indeed.

bestnow - I have removed your attachment.
1- the original mod license does not allow redistribution or modification. Giving instruction on HOW to modify it is not a violation, but packaging that modification and claiming it with your own copyright is a violation.

2- adding your copyright to the SMF copyright line like that is a violation of our mod design guidelines
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

FYI the gender field in 2.1 is already a custom field.

shawnb61

Quote from: Arantor on April 26, 2017, 04:37:58 AM
Still don't get why custom fields aren't being used, requires no code change at all.

I think the concern here is that, without customization, the custom field isn't displayed on posts in 2.0. 

Not an issue with 2.1, which handles this quite nicely, as you point out. 

IMO, dealing with the custom field limitation in 2.0 in the meanwhile may be a good compromise, & wait for 2.1 for improved visibility. 

Looking ahead, I'm not sure I'd want to utilize the mod, as I am not sure what the 2.1 migration ramifications would be without testing it extensively (maybe I'm being too paranoid & assuming it won't come over cleanly...).  I'd hate to lose the detail, or, require custom one-off code to migrate it properly with images, etc. 

I would definitely go with custom fields & wait for 2.1 for the visibility.
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Arantor

What improved visibility?

The GitHub field on posts like yours and mine is a custom field!

Sir Osis of Liver

Quote from: Sir Osis of Liver on April 19, 2017, 11:52:48 PM
If custom fields are used, gender will not be displayed in poster info panel in display template.  Would require some custom coding to do that.

I was incorrect. :P  Custom profile field is displayed in poster info if Show on Topic View: is checked in custom field settings.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

shawnb61

In other words, there is no lost functionality at all using custom fields.   

Sorry, I missed that. 

"Toto, we've been in Kansas all along!"
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Sir Osis of Liver

Actually, it's in the screenshot you posted earlier, but I don't see very well and missed it.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

shawnb61

Jennifer Rachael Ann -

Do you think you could follow the examples in the pictures in Reply #8 above?

No coding.  Just configuring the custom fields.  Let us know if you need further detail/explanation.
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Advertisement: