News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Remove additional information section on registration form

Started by CraftyLion, January 04, 2025, 06:25:48 AM

Previous topic - Next topic

CraftyLion

I hope this hasn't been asked before but how do I remove the Additional Information section on the registration form?

Aleksi "Lex" Kilpinen

Admin -> Configuration -> Features and Options -> Profile Fields

Click "Modify" for the field you want to remove from registration, and find the option "Show on Registration".
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

CraftyLion

All the custom fields I've added to the registration form are required by the applicant yet the Additional Information section still remains (and is empty).

Aleksi "Lex" Kilpinen

Hmm, didn't check or test this live - but I would have assumed, that the section should disappear if empty.
The relevant file is Register.template.php, found here https://github.com/SimpleMachines/SMF/blob/release-2.1/Themes/default/Register.template.php and I think this should mean that it's not shown if there's nothing to ask

// If we have either of these, show the extra group.
if (!empty($context['profile_fields']) || !empty($context['custom_fields']))
echo '
<div class="title_bar">
<h3 class="titlebg">', $txt['additional_information'], '</h3>
</div>
<div class="roundframe noup">
<fieldset>
<dl class="register_form" id="custom_group">';

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF


Sir Osis of Liver

In 2.1.4 Curve2, Additional Information displays Gender profile field by default.  If Gender is disabled, Additional Information is not displayed.  Same for custom profile fields, Additional Information is only displayed if one or more fields are active.  Maybe a theme issue.  Which theme are you using?
When in Emor, do as the Snamors.
                              - D. Lister

Aleksi "Lex" Kilpinen

I'm fairly sure the custom "Please select your country" is somehow involved, it's out of place, it seems to be slightly broken, it's probably added in a way that broke the logic somehow - It really should actually be below the "Additional information" header, and the header should be there too., or it should be higher up where you see the Gender selection as well.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Sir Osis of Liver

Gender should be below Additional Information.  What does it look like in Curve2?
When in Emor, do as the Snamors.
                              - D. Lister

Aleksi "Lex" Kilpinen

Quote from: Sir Osis of Liver on January 04, 2025, 04:12:44 PMGender should be below Additional Information.
Not necessarily, it depends on if it is optional or required.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Sir Osis of Liver

Ok, yes.  But if you require both Gender and custom field, they're both displayed above Additional Information, and the heading remains, same as in OP's registration form -

https://www.thekrashsite.com/smf21core/index.php?action=signup

I think that's a bug.

When in Emor, do as the Snamors.
                              - D. Lister

Aleksi "Lex" Kilpinen

Then we may have logic error somewhere, as I understand it the Addition Information header should only be there when there is something optional presented.

E: Moved to bugs for further investigation.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Sir Osis of Liver


// If we have either of these, show the extra group.
if (!empty($context['profile_fields']) || !empty($context['custom_fields']) && empty($context['custom_fields_required']))
echo '
<div class="title_bar">
<h3 class="titlebg">', $txt['additional_information'], '</h3>
</div>
<div class="roundframe noup">
<fieldset>
<dl class="register_form" id="custom_group">';



Well, that almost works.

When in Emor, do as the Snamors.
                              - D. Lister

Sir Osis of Liver

Oddly, it only happens if both fields are required.  If one is and the other isn't, they're displayed correctly.
When in Emor, do as the Snamors.
                              - D. Lister

CraftyLion

Quote from: Sir Osis of Liver on January 04, 2025, 04:00:51 PMIn 2.1.4 Curve2, Additional Information displays Gender profile field by default.  If Gender is disabled, Additional Information is not displayed.  Same for custom profile fields, Additional Information is only displayed if one or more fields are active.  Maybe a theme issue.  Which theme are you using?


I'm using the default Curve2 theme using Curve2 Color Changer mod. Because I'm intending on running a database for voice-over actors, I need the Gender field to be required duration registration.

Sir Osis of Liver

It's not a theme issue, it's a bug.  I can give you a code hack to fix it just for your forum, but haven't been able to get register template to do it right.  Part of the problem seems to be that gender is not a custom field, which confuses the logic.
When in Emor, do as the Snamors.
                              - D. Lister

Arantor

Gender used to be not a custom field but the 2.1 install/upgrade creates it as such.
Holder of controversial views, all of which my own.


Sir Osis of Liver

Then it's just a problem with the logic.  Will have another go tonight.
When in Emor, do as the Snamors.
                              - D. Lister

Sir Osis of Liver

  >:(  Can't make this work correctly.  It should work as written -


    // If we have either of these, show the extra group.
    if (!empty($context['profile_fields']) || !empty($context['custom_fields']))
        echo '
            <div class="title_bar">
                <h3 class="titlebg">', $txt['additional_information'], '</h3>
            </div>
            <div class="roundframe noup">
                <fieldset>
                    <dl class="register_form" id="custom_group">';


But it doesn't because $context['profile_fields'] is not empty when there are no fields to display under Additional Information. 

When in Emor, do as the Snamors.
                              - D. Lister

live627

Quote from: Sir Osis of Liver on January 04, 2025, 04:29:40 PM
// If we have either of these, show the extra group.
if (!empty($context['profile_fields']) || !empty($context['custom_fields']) && empty($context['custom_fields_required']))
echo '
<div class="title_bar">
<h3 class="titlebg">', $txt['additional_information'], '</h3>
</div>
<div class="roundframe noup">
<fieldset>
<dl class="register_form" id="custom_group">';



Well, that almost works.


We need to do the same with the cclosing tags, too.

// If we have either of these, close the list like a proper gent.
if (!empty($context['profile_fields']) || !empty($context['custom_fields']) && empty($context['custom_fields_required']))
echo '
</dl>
</fieldset>
</div><!-- .roundframe -->';

Sir Osis of Liver

Works if all custom fields are required, or all fields are not required, but doesn't work if there are required and unrequired fields.  Additional Information is not displayed.

Quote from: Sir Osis of Liver on January 07, 2025, 05:27:05 PMBut it doesn't because $context['profile_fields'] is not empty when there are no fields to display under Additional Information.
When in Emor, do as the Snamors.
                              - D. Lister

Advertisement: