Author Topic: Additional text boxes in registration  (Read 21347 times)

0 Members and 1 Guest are viewing this topic.

Offline loz

  • Newbie
  • *
  • Posts: 28
    • View Profile
Additional text boxes in registration
« on: April 27, 2005, 10:20:45 AM »
Hi,

I need to know a little more about the people who want to register on my site before I accept their registration.

Is it possible to add extra required text fields to the registration form (address, postcode, name, occupation, telephone & fax) which will also be included in the database and then allow them to update these details through their control panel once registered?

I've made several searches and browsed the forum for a solution to this problem. Please help.

Thanks, Loz.

Offline Vincent

  • 4images Moderator
  • Addicted member
  • *****
  • Posts: 1.195
    • View Profile
    • www.foto-kocher.com
Re: Additional text boxes in registration
« Reply #1 on: April 27, 2005, 10:54:53 AM »
also interested to know!
vincent
Beati pauperi spiritus

4images 1.7 // My Installed Mods


Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Additional text boxes in registration
« Reply #2 on: April 27, 2005, 02:35:58 PM »
yes u can, u'll need manualy add new fields into 4images_users table and update includes/db_field_definitions.php with the info about your new fields.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Re: Additional text boxes in registration
« Reply #3 on: April 28, 2005, 01:00:44 AM »
There are also comments in that file that explain what to edit.  Don't worry about anything else.  4images automatically takes care of outputting the custom fields in the admin ACP and member pages

Offline loz

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Additional text boxes in registration
« Reply #4 on: May 03, 2005, 10:32:34 AM »
Hi,

I've made all the changes to the 4images_users table in my database and updated includes/db_field_definitions.php with the info about my new fields. The fields appear in the admin control panel when you visit 'Users/Add user' but I really want the new fields to appear in the registration page, the user details approval page (before I approve a user) and in the user's control panel once they've been approved (enabling them to change the field values).

Can someone please tell me how to achieve this?

Thanks, Loz.

Offline loz

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Additional text boxes in registration
« Reply #5 on: May 05, 2005, 09:45:42 AM »
Please help me with this one, I need to know the extra field information about the users before I can approve them to use the forum. The comments in the db_field_definitions.php file don't tell how to add the extra fields to the registration form and users control panel.

Offline loz

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Additional text boxes in registration
« Reply #6 on: May 05, 2005, 10:50:57 AM »
Don't worry, I've figured it out now.

Offline utbusta

  • Pre-Newbie
  • Posts: 2
    • View Profile
Re: Additional text boxes in registration
« Reply #7 on: June 20, 2005, 05:54:20 PM »
Don't worry, I've figured it out now.

Would it be possible to list how you did this?  I too am wanting to add a few fields like address, what college they attend etc..  I am a total newb and some sort of details would be very helpful.  Thanks!

I added the fields in my database, i didnt know what ot modify in the DB-Field_Definitions.php file, how can one get it to show up on the registration form and to get the info to show up in the admin/edit users list etc... and to show up in the users profile.  From the looks of mine its not uploading the new data into the database  :cry:

Offline loz

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Additional text boxes in registration
« Reply #8 on: June 21, 2005, 09:36:33 AM »
Here's the instructions. If I were you, I'd copy and paste this into a word editor because this code view on the bulletin board doesn't help.

Code: [Select]
To add new user text fields to the database so that you know more details about who is registering please follow these instructions.

----------------------------------

Step 1
Open: includes/db_field_definitions.php

----------------------------------

##### Find code:

// Example for additional user fields

##### After, unquote the following (just remove '//' from the beginning of the line):

//$additional_user_fields['user_adress'] = array($lang['user_adress'], "text", 1);

##### To add more fields just copy and paste this line you've edited without the // at the beginning and then change the name of 'user_adress' to something relevant you want to have as a field i.e. 'user_telephone'. To not make this field required change the 1 near the end of the line to 0.######


----------------------------------

Step 2
Open: lang/english/main.php

----------------------------------


##### Find code:

$lang['lost_password_msg'] = "In case you forgot your password, enter the email address you have used for registration.";

##### After, add:

$lang['user_adress'] = "Address:";

##### If you have included any more fields in the previous step repeat adding this line, replacing 'user_adress' with your field(s) name i.e. 'user_telephone'. Also change the "Address:" to the field(s) name i.e. "Telephone:" ######


----------------------------------

Step 3
Open: templates/default/register_form.html

----------------------------------

##### Find Code:

          <tr>
            <td class="row1"><b>{lang_email}</b></td>
            <td class="row1"><input type="text" name="user_email" size="30" class="input" value="{user_email}" /></td>
          </tr>

##### After, add:

          <tr>
            <td class="row2"><b>{lang_user_adress}</b></td>
            <td class="row2"><input type="text" name="user_adress" size="30" value="{user_adress}" class="input" /></td>
          </tr>

##### If you have included any more fields in the previous steps repeat adding this line, replacing user_adress with your field(s) name i.e. user_telephone. Please note there are three instances of user_adress you will need to change. Also, remember to change both <td class="row2"> to <td class="row1"> and alternate each time you need to repeat step 3 so that your background table cells alternate in colour. ######


----------------------------------

Step 4
Open: templates/default/member_edit_profile.html

----------------------------------

##### Find code:

          <tr>
            <td class="row1"><b>{lang_invisible}</b></td>
            <td class="row1">
              <input type="radio" name="user_invisible" value="1"{user_invisible_yes} />
              {lang_yes}&nbsp;&nbsp;&nbsp;
              <input type="radio" name="user_invisible" value="0"{user_invisible_no} />
              {lang_no}
</td>
          </tr>

##### After, add:

          <tr>
            <td class="row2"><b>{lang_user_adress}</b></td>
            <td class="row2"><input type="text" name="user_adress"  size="30" value="{user_adress}" class="input" /></td>
          </tr>

##### As like the previous steps, if you have any other fields replace the user_adress with the relevant field name. Same with the row2 information found in step 3. ######


----------------------------------

Step 5
Add database fields via 'PHPMyAdmin' tool or similar database admin program.

----------------------------------

Visit your database and locate "4images_users" table in your database. Open this table and after user_email add a new column for every field you want naming the field user_adress or whatever you've named the previous fields in the last few steps.

----------------------------------

Step 6
Save all changes to the files in steps 1-4 and then upload them to the correct directories.

----------------------------------

 

Offline utbusta

  • Pre-Newbie
  • Posts: 2
    • View Profile
Re: Additional text boxes in registration
« Reply #9 on: June 21, 2005, 05:09:20 PM »
That's Great!  Thanks.

Is there a way to display that info, like in the user profile and the Admin/Edit Users area?  Whats another or the best way to display that info?

Much Appreciated, Thanks


Offline commy

  • Pre-Newbie
  • Posts: 1
    • View Profile
Re: Additional text boxes in registration
« Reply #10 on: October 25, 2005, 08:40:44 PM »
Thanks, that worked for me aswell.

The only problem is that when I have go to register, the fields are not required. Is there a way to make this so?

Also, I am know trying to add some of those extra fields to my contol panel so that when I can search my users by state for example. I am having problems with this. Is there a way to do this?

 

Offline loz

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Additional text boxes in registration
« Reply #11 on: November 07, 2005, 11:16:42 AM »
Hi Sorry it's taken a while to reply. If you want to make some fields required and some not, change the last editable in the includes/db_fields_definitions.php

i.e.

If I want to make the photographer field required, use this like so:

$additional_user_fields['user_firstname'] = array($lang['user_firstname'], "text", 1);

If you don't want it required change the 1 to a 0 like so:

$additional_user_fields['user_firstname'] = array($lang['user_firstname'], "text", 0);


I hope this helps.

By the way, depending on the version of 4images you have, the script should automatically add the fields into the admin section. I'll try and have a look into the searching for users using the new fields - should be something in admin/users.php

Offline DarkNeo

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Additional text boxes in registration
« Reply #12 on: January 29, 2006, 10:21:18 PM »
Hi there,

Cool script but can you help me with adding info into the MYsql?? i dont know how to do that.

Im new with Databases.

Thx

Offline DarkNeo

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Additional text boxes in registration
« Reply #13 on: January 31, 2006, 09:57:39 PM »
Hi there,

Cool script but can you help me with adding info into the MYsql?? i dont know how to do that.

Im new with Databases.

Thx

Please anybody?? help me please

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: Additional text boxes in registration
« Reply #14 on: January 31, 2006, 10:18:11 PM »
@DarkNeo:

Quote

Visit your database and locate "4images_users" table in your database. Open this table and after user_email add a new column for every field you want naming the field user_adress or whatever you've named the previous fields in the last few steps.


This part is also indicated on how to implement within in your PHPMyAdmin (or to your relative software tool you might be currently using). How better do you want it to be ? ;)

If you do not know how to operate mySQL at all, I'd suggest seeking on Google and read free tutorials from results.