Jump to content
TNG Community
bluemusicman

Is it possible to only display mandatory fields for User Registration

Recommended Posts

bluemusicman

I'm running TNG13 on my own Ubuntu Server 20.01 LTS.

On my home page I encourage users when Registering to only provide the mandatory information (username, password, email and real name) but most people seem happy to fill in address,  phone number etc. as well. I'm uncomfortable storing this information and I don't need it.  I generally only grant registration to family members in any case.  I could just manually delete the information when granting access but would prefer they didn't provide it.

Would it be possible to suppress showing the non-mandatory fields on the registration page?  If anyone has a suggestion how to do that please let me know.  I'm comfortable editing PHP though not very proficient.

 

Thanks

Share this post


Link to post
Share on other sites
RickM

Probably this simplest way would be to target the class or id of each of the fields you want to suppress and use display: none; in you mytngstyle.css file.

Just had a peek at the form and there does not appear to be any css or id connected to each of the fields..

I will whip up a mod to suppress all fields except the four you have in brackets.. That way IF in the furue the form is updated, one only needs to sort the Mod to suit, not redo the whole thing..

Will try to get it done today..

And no I am also not that proficient with php, just I am enjoying the process of figuring it all out.. Maybe I will actually learn something too <smile>

Share this post


Link to post
Share on other sites
RickM

@manofmull

Nice site and nice form.. I was halfway through the Mod.. I will finish it though.. Might do the Mod for your page too, if I can figure it out <smile>.

Is the captcha part of the form, or is it separate?? I like it and think I would like that feature for either logins and or registrations or any other contact, help stop the spammers and all.. I like the simpleness of it..

Nice job Sir..

Share this post


Link to post
Share on other sites
RickM

Cheers mate!!

Will go have a nosey at that.. I guess the User Reg form has not changed much through the versions of TNG.. It doesn't seem that hard to play with (but then that may not be said for me playing with it <smile>).

I will finish the Mod for the basic form and then look at what you have done and whip an Mod to suit that for you.. That way IF you were to do something silly, you can aleast run the Mod and it is done. I'm guessing theough, a smart dude like you will have backups <Smile>.

 

Share this post


Link to post
Share on other sites
manofmull

Rick

I've saved the newacctform for years! OR I don't upload the "new" one each upgrade (it's the same form)

With the form, you cannot remove this bit Preferred language:

or it won't work

I got my present form simply by deleting the lines of code from it.

I agree with bluemusicman that it asks for way too much.

Share this post


Link to post
Share on other sites
RickM

Yeah it does, sometimes though it might be nice to have.. There are people out there who, just because its the way they are, might send birthday cards, or Christmas cards or whatever.. Regardless of the internet and my age, I still love that my Mum sends me a birthday & Christmas card.. And one also has to remember this bollocks about collecting info of a personal nature.. All this ass covering.. Feck spend a few days in hospital (and believe me I have) NOTING is really personal there unless one has their own room and here in NZ that is not impossible but not highly likely.. I have had that pleasure (??) only twice.. Locked down in one (TB) and it was the only space available in the other. Sorry rambling again.. But shite.. If someone really didn't want to share the info they would not..

Actually for the sake and size of the file I should just modify it directly, but we are encouraged to make Mods rather than do that, in the event of!! Thanks for the heads up about the preferred language.. I was leaving it in for now..

 

Share this post


Link to post
Share on other sites
Philip Roy

If you do want to just hack a file and not use mods, this is the change that I make...starting at line 89 of newacctform.php and just commenting out lines

<tr><td valign="top"><?php echo $text['username']; ?>*:</td><td><input type="text" name="username" size="20" maxlength="20" /></td></tr>
<tr><td valign="top"><?php echo $text['password']; ?>*:</td><td><input type="password" name="password" size="20" maxlength="20" /></td></tr>
<tr><td valign="top"><?php echo $text['pwdagain']; ?>*:</td><td><input type="password" name="password2" size="20" maxlength="20" /></td></tr>
<tr><td valign="top"><?php echo $text['realname']; ?>*:</td><td><input type="text" name="realname" size="50" maxlength="50" /></td></tr>
<!--	<tr><td valign="top"><?php echo $text['phone']; ?>:</td><td><input type="text" name="phone" size="30" maxlength="30" /></td></tr> -->
<tr><td valign="top"><?php echo $text['email']; ?>*:</td><td><input type="text" name="<?php echo $_SESSION['tng_email']; ?>" size="50" maxlength="100" /></td></tr>
<tr><td valign="top"><?php echo $text['emailagain']; ?>*:</td><td><input type="text" name="em2" size="50" maxlength="100" /></td></tr>
<!--	<tr><td valign="top"><?php echo $text['website']; ?>:</td><td><input type="text" name="website" size="50" maxlength="100" value="http://" /></td></tr> -->
<!--	<tr><td valign="top"><?php echo $text['address']; ?>:</td><td><input type="text" name="address" size="50" maxlength="100" /></td></tr> -->
<!--	<tr><td valign="top"><?php echo $text['city']; ?>:</td><td><input type="text" name="city" size="50" maxlength="64" /></td></tr> -->
<!--	<tr><td valign="top"><?php echo $text['state']; ?>:</td><td><input type="text" name="state" size="50" maxlength="64" /></td></tr> -->
<!--	<tr><td valign="top"><?php echo $text['zip']; ?>:</td><td><input type="text" name="zip" size="20" maxlength="10" /></td></tr> -->
<!--	<tr><td valign="top"><?php echo $text['country']; ?>:</td><td><input type="text" name="country" size="50" maxlength="64" /></td></tr> -->

Note that you have to comment out the start and end of the lines.

Edited by Philip Roy

Share this post


Link to post
Share on other sites
RickM

@Philip Roy Nice one my friend..

@bluemusicman @manofmull Just pmed a Mod for perusal (MoM its not your version but the generic file MOD)

You can check it here if you like.. Put your shades on though https://v13stage.alineofmalkins.com/Malkins-Gen/newacctform.php

May Not actually work on my staging site I don't have any email service etc setup on it..

 

Edited by RickM
Grammatical error changed & Added an addendum

Share this post


Link to post
Share on other sites
Philip Roy

I'm partially colour blind, but not on that registration page...yikes! 😂

Interestingly, despite the fact I tend to post code adjustments here and always manually make them to my site...I am working on one mod for my site of all the changes I make. But I actually confess that whilst it might end up easier (in terms of applying all changes at once)...having them all in one config file is not the easiest for me to follow. Love the concept of mods...I'm not sure they are for me though still.

Phil

Share this post


Link to post
Share on other sites
RickM

Strangely I am also in the process of putting all my changes into Mods.. I initially thought of just one file, but that becomes too ungainly after a while, and if only one module is changed I can go straight to that one and make the change, rather than scroll through 1000s of lines of code to find the one I want.. I think it also helps with Mod clashes or keeping them down.. My first one file attempt clashed with a few Mods and I have only a few of them (at this time) I looked at MY Mod and could see hmm easier IF I do it one module at a time, Its working out really well touch wood..

And yeah the colours are just a way of showing the css changes that can be applied.. Of course I could go further and add classes etc to the input fields etc, but??

Yeah, I personally think Mods are a great thing because someone has taken the time to come up with a method of passing along a change they figured was good for them. And being able to pick and choose some of the things available is another good thing.. Keeps the basic program code down (easier for the author) and it allows folks to decide if they like or not.. The down side is if there are issues and the author is not diligent at keeping up with them then what do you do?? And if there are changes to the basic module that the Mod affects and the Mod author does not keep up what do you do?? Like me start to learn php and how to write a Mod I guess. But there are others who don't want that shite.. And lastly, can we trust the folk writing the Mod.. Yeah I'm gonna say it (even though I have put a Mod out there too) what if someone writes something clever enough to harm the Dbase or worse?? (God forbid).. Oh right backup backup backup.. HmmHmmmm right!!

 

Share this post


Link to post
Share on other sites
bhemph

Attached is a cleaned up copy of Michael's form updated to not throw warnings on newer PHP at least until a new field is added to the form in some future version of TNG.  I also hid the language dropdown, in case you only have one language.  If you do have multiple languages, and would like the user to be able to set it you can just remove the hidden input in this one and restore the original row of the table.  If you compare this version to the version in the TNG distribution, you will be able to see the changes to be able to make website, country, and notes be hidden as well if you would like.

newacctform.php

Share this post


Link to post
Share on other sites
Ken Roy
7 hours ago, Philip Roy said:

But I actually confess that whilst it might end up easier (in terms of applying all changes at once)...having them all in one config file is not the easiest for me to follow. Love the concept of mods...I'm not sure they are for me though still.

Phil

Phil,

the Mod Manager has a pull down selection that allows you to install multiple mods at once, so there is no need to put all your changes in one cfg file.  I have about 25 private mods that I do not publish that change the TNG configuration files to the defaults I use in TNG and to tailor my site look and feel.

Prior to the Mod Manager, one had to manually keep a file that documented the changes one made to TNG and had to redo those changes every time one upgraded.  There are several articles on the TNG WIki in the Mod Manager category that can help.

Share this post


Link to post
Share on other sites
Philip Roy

Thanks, I’m aware of that and have in fact separated my files under development into a few files with meaningful names.

4 minutes ago, Ken Roy said:

Prior to the Mod Manager, one had to manually keep a file that documented the changes one made to TNG and had to redo those changes every time one upgraded.

And that’s how I always have worked. It’s not an issue for me. I ran a busy Joomla site (featured in a couple of Joomla books) this way. I don’t keep one file, I have a folder of changed files with txt files of the same name that outline the changes. I’ve never found it a chore to apply changes each time as it provides a bit of comfort and a chance to review files when there is a new release.

That said, I am going to give it a go and make series of cfg files that do all the work just for fun...and who knows, I may never go back to my old approach.

Phil

Share this post


Link to post
Share on other sites
manofmull
7 hours ago, bhemph said:

Attached is a cleaned up copy of Michael's form updated to not throw warnings on newer PHP at least until a new field is added to the form in some future version of TNG.  I also hid the language dropdown, in case you only have one language.  If you do have multiple languages, and would like the user to be able to set it you can just remove the hidden input in this one and restore the original row of the table.  If you compare this version to the version in the TNG distribution, you will be able to see the changes to be able to make website, country, and notes be hidden as well if you would like.

newacctform.php

Brent

Brilliant, many thanks. I tried removing the language dropdown a while back, but things were broken.

As an English-only website, I have no need for selection.

Years back, I remember getting complaints that registration was too long-winded and too personal, to which I agree.

I've no need for addresses, phone numbers etc., just like bluemusicman above.

I'm now using your new cleaned-up version and also inserted it in my post above.

Share this post


Link to post
Share on other sites
manofmull
8 hours ago, RickM said:

@Philip Roy Nice one my friend..

@bluemusicman @manofmull Just pmed a Mod for perusal (MoM its not your version but the generic file MOD)

You can check it here if you like.. Put your shades on though https://v13stage.alineofmalkins.com/Malkins-Gen/newacctform.php

May Not actually work on my staging site I don't have any email service etc setup on it..

 

Talk about "blinded by the light" lol

Oh my poor eyes!   Thanks for the effort though.

Phil: years back I didn't know how to comment out, so just deleted the "offending" lines code.

Glad I'm not the only one with newacctform issues.

Share this post


Link to post
Share on other sites
bluemusicman

Wow, lots of responses to my request.  Many thanks to you all this gives me lots of options to try.


Regards

Share this post


Link to post
Share on other sites
Philip Roy
17 hours ago, Ken Roy said:

Phil,

the Mod Manager has a pull down selection that allows you to install multiple mods at once, so there is no need to put all your changes in one cfg file.  I have about 25 private mods that I do not publish that change the TNG configuration files to the defaults I use in TNG and to tailor my site look and feel.

Prior to the Mod Manager, one had to manually keep a file that documented the changes one made to TNG and had to redo those changes every time one upgraded.  There are several articles on the TNG WIki in the Mod Manager category that can help.

Ken...I just got my mods working on my local site and am currently testing on my live site. You may have a convert! I think I have seen the light 😀There's that moment that you just apply the mods and you think "Is that all there is to it?". Kudos to everyone that wrote the wiki articles also...I had a few curly issues and the solutions were all there.😉

Phil

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×