|
Joined: Aug 2002
Posts: 1,191
Kahuna
|
Kahuna
Joined: Aug 2002
Posts: 1,191 |
Liahona, Here is what you can do: You can use an existing field from the user profile You can add your own field(s) to collect information If you want to use an [:"blue"]existing field from the database[/] Step 1. Open templates/default/newuser_signup.tmpl 1.1 Find: <br /><input type="text" name="Email" class="formboxes" /> <br /><br /> <br /><br /> <br /> BELOW it ADD 1.1.1 If the field is a normal text field like Location <br /><input type="text" name="Location" class="formboxes" /> <br /><br /> <br /><br /> <br /> 1.1.2 If the field you want to add needs more information like the Signature field then you need to use: <br /><textarea name="Signature" cols="50" rows="5" wrap="soft" class="formboxes">$Signature</textarea> <br /><br /> <br /><br /> <br /> 1.1.3 If the field you want to add a Yes/No or field like the Accept Private Messages from Other Users field then you need to use: <br /><input type="radio" name = "AcceptPrivs" value="yes" $AcceptPrivsyes class="formboxes" /> {$ubbt_lang['TEXT_YES']} <br /><input type="radio" name = "AcceptPrivs" value="no" $AcceptPrivsno class="formboxes" /> {$ubbt_lang['TEXT_NO']} <br /><br /> <br /><br /> <br /> Step 2. Open adduser.php 2.1 Find: <br /> $Verify = get_input("Verify","post"); <br /> BELOW it ADD 2.1.1 If the field is a normal text field like Location <br /> $Location = get_input("Location","post"); <br /> 2.1.2 If the field you want to add needs more information like the Signature field then you need to use: <br /> $Signature = get_input("Signature","post"); <br /> 2.1.3 If the field you want to add a Yes/No or field like the Accept Private Messages from Other Users field then you need to use: <br /> $AcceptPriv = get_input("AcceptPriv","post"); <br /> Note that the first parameter of the get_input function receives the name of the control you used in the template (name = "....") 2.2 Find: <br />// If Displayname is blank then set it to the Loginname <br /> if (!$Displayname) { <br /> $Displayname = $Loginname; <br /> } <br /> BELOW it ADD 2.2.1 If the field is a normal text field like Location <br /> if (!$Location) { <br /> $html -> not_right("The Location field is obligatory but was not specified",$Cat); <br /> } <br /> 2.2.2 If the field you want to add needs more information like the Signature field then you need to use: <br /> if (!$Signature) { <br /> $html -> not_right("The Signature field is obligatory but was not specified",$Cat); <br /> } <br /> 2.2.3 If the field you want to add a Yes/No or field like the Accept Private Messages from Other Users field then you need to use: <br /> if (!$AcceptPriv) { <br /> $html -> not_right("The Accept Private Messages field is obligatory but was not specified",$Cat); <br /> } <br /> 2.3 Find: <br /> $Color_q = addslashes($Color); <br /> BELOW it ADD 2.3.1 If the field is a normal text field like Location <br /> $Location_q = addslashes($Location); <br /> 2.3.2 If the field you want to add needs more information like the Signature field then you need to use: <br /> $Signature_q = addslashes($Signature); <br /> You might also want to convert the carriage returns to <br> in the field. To do so you need to issue before the above line: $Signature = str_replace("<br />","\n",$Signature); 2.3.3 If the field you want to add a Yes/No or field like the Accept Private Messages from Other Users field then you need to use: <br /> $AcceptPriv_q = addslashes($AcceptPriv); <br /> 2.4 Find: <br /> $query = " <br /> INSERT INTO {$config['tbprefix']}Users (U_LoginName, <br /> U_Username,U_Password,U_Email, <br /> U_Totalposts,U_Laston,U_Status, <br /> U_Sort,U_Display,U_View, <br /> U_PostsPer,U_EReplies,U_Registered, <br /> U_RegEmail,U_RegIP,U_Groups, <br /> U_Title,U_Color,U_Privates, <br /> U_Approved,U_PicturePosts) <br /> VALUES ('$Login_q', <br /> '$Displayn_q','$crypt','$Email_q', <br /> '0','$date','$Status_q', <br /> '{$theme['sort']}','$Display_q','$View_q', <br /> '{$theme['postsperpage']}','$EReplies_q','$date', <br /> '$Email_q','$ip_q','$Groups_q', <br /> '$Title_q','$Color_q','1', <br /> '$approved','$PicturePosts') <br /> "; <br /> CAHNGE it to this 2.4.1 If the field is a normal text field like Location <br /> $query = " <br /> INSERT INTO {$config['tbprefix']}Users (U_LoginName, <br /> U_Username,U_Password,U_Email, <br /> U_Totalposts,U_Laston,U_Status, <br /> U_Sort,U_Display,U_View, <br /> U_PostsPer,U_EReplies,U_Registered, <br /> U_RegEmail,U_RegIP,U_Groups, <br /> U_Title,U_Color,U_Privates, <br /> U_Approved,U_PicturePosts,[:"red"]U_Location[/]) <br /> VALUES ('$Login_q', <br /> '$Displayn_q','$crypt','$Email_q', <br /> '0','$date','$Status_q', <br /> '{$theme['sort']}','$Display_q','$View_q', <br /> '{$theme['postsperpage']}','$EReplies_q','$date', <br /> '$Email_q','$ip_q','$Groups_q', <br /> '$Title_q','$Color_q','1', <br /> '$approved','$PicturePosts',[:"red"]'$Location_q'[/]) <br /> "; <br /> 2.4.2 If the field you want to add needs more information like the Signature field then you need to use: <br /> $query = " <br /> INSERT INTO {$config['tbprefix']}Users (U_LoginName, <br /> U_Username,U_Password,U_Email, <br /> U_Totalposts,U_Laston,U_Status, <br /> U_Sort,U_Display,U_View, <br /> U_PostsPer,U_EReplies,U_Registered, <br /> U_RegEmail,U_RegIP,U_Groups, <br /> U_Title,U_Color,U_Privates, <br /> U_Approved,U_PicturePosts,[:"red"]U_Signature[/]) <br /> VALUES ('$Login_q', <br /> '$Displayn_q','$crypt','$Email_q', <br /> '0','$date','$Status_q', <br /> '{$theme['sort']}','$Display_q','$View_q', <br /> '{$theme['postsperpage']}','$EReplies_q','$date', <br /> '$Email_q','$ip_q','$Groups_q', <br /> '$Title_q','$Color_q','1', <br /> '$approved','$PicturePosts',[:"red"]'$Signature_q'[/]) <br /> "; <br /> 2.4.3 If the field you want to add a Yes/No or field like the Accept Private Messages from Other Users field then you need to use: <br /> $query = " <br /> INSERT INTO {$config['tbprefix']}Users (U_LoginName, <br /> U_Username,U_Password,U_Email, <br /> U_Totalposts,U_Laston,U_Status, <br /> U_Sort,U_Display,U_View, <br /> U_PostsPer,U_EReplies,U_Registered, <br /> U_RegEmail,U_RegIP,U_Groups, <br /> U_Title,U_Color,U_Privates, <br /> U_Approved,U_PicturePosts,[:"red"]U_AcceptPriv[/]) <br /> VALUES ('$Login_q', <br /> '$Displayn_q','$crypt','$Email_q', <br /> '0','$date','$Status_q', <br /> '{$theme['sort']}','$Display_q','$View_q', <br /> '{$theme['postsperpage']}','$EReplies_q','$date', <br /> '$Email_q','$ip_q','$Groups_q', <br /> '$Title_q','$Color_q','1', <br /> '$approved','$PicturePosts',[:"red"]'$AcceptPriv_q'[/]) <br /> "; <br /> NOTE: Step 2.4 has been edited for length. The original is in two lines only. The alteration is highlighted in red If you want to use an [:"blue"]existing field from the database[/] Step 3 3.1 Create the table in the database table <br />ALTER TABLE w3t_users ADD Fieldname` VARCHAR( 2 ) NOT NULL <br /> Here you need to repeat this step as many times as necessary as the information you need. Replace Fieldname with the name you need the field to have. Also you have to choose the type of the field. I personally use VARCHAR(...) for every text field I want to have (where ... is the maximum length of the field). VARCHAR fields hold the data that you actually store. So if a VARCHAR field is defined as size 10 and you store only "yes" in there, only three characters of that field will be stored. If on the other hand you use CHAR instead of VARCHAR, the in the same example 10 characters will be stored, the "yes" plus seven spaces. Hence VARCHAR fields are good for space preservation. Additionally I personally use TINYINT for Yes/No fields, storing 0/1 for No/Yes. Numeric fields are usually faster (especially indexed) against text based fields. Again this is your choice. Once you have created the field(s) you need to have in the database, use the instructions above to add them to the new user signup screen. To add them to the profile screens so that they can be edited you need to do the following (I will assume you have a new field called U_ObligatoryField Step 4. Open editbasic.php 4.1 Find: <br /> $query = " <br /> SELECT U_LoginName,U_Password,U_Email,U_Fakeemail,U_Name, <br /> U_Signature,U_Homepage,U_Occupation,U_Hobbies, <br /> U_Location,U_Bio,U_TextCols,U_TextRows,U_Extra1, <br /> U_Extra2,U_Extra3,U_Extra4,U_Extra5,U_Picture, <br /> U_Visible,U_AcceptPriv,U_OnlineFormat <br /> FROM {$config['tbprefix']}Users <br /> WHERE U_Number = '{$user['U_Number']}' <br /> "; <br /> CHANGE it to <br /> $query = " <br /> SELECT U_LoginName,U_Password,U_Email,U_Fakeemail,U_Name, <br /> U_Signature,U_Homepage,U_Occupation,U_Hobbies, <br /> U_Location,U_Bio,U_TextCols,U_TextRows,U_Extra1, <br /> U_Extra2,U_Extra3,U_Extra4,U_Extra5,U_Picture, <br /> U_Visible,U_AcceptPriv,U_OnlineFormat[:"red"],U_ObligatoryField[/] <br /> FROM {$config['tbprefix']}Users <br /> WHERE U_Number = '{$user['U_Number']}' <br /> "; <br /> NOTE: Step 4.1 has been edited for length. The original SELECT is in one line only. The alteration is highlighted in red 4.2 Find: <br /> list($LoginName,$ChosenPassword,$Email,$Fakeemail,$Name,$Signature, <br /> $Homepage,$Occupation,$Hobbies,$Location,$Bio,$TextCols,$TextRows, <br /> $ICQ,$Extra2,$Extra3,$Extra4,$Extra5,$Picture,$Visible,$AcceptPriv, <br /> $OnlineFormat) = $dbh -> fetch_array($sth); <br /> CHANGE it to <br /> list($LoginName,$ChosenPassword,$Email,$Fakeemail,$Name,$Signature, <br /> $Homepage,$Occupation,$Hobbies,$Location,$Bio,$TextCols,$TextRows, <br /> $ICQ,$Extra2,$Extra3,$Extra4,$Extra5,$Picture,$Visible,$AcceptPriv, <br /> $OnlineFormat,[:"red"]$ObligatoryField[/]) = $dbh -> fetch_array($sth); <br /> NOTE: Step 4.2 has been edited for length. The original is in one line only. The alteration is highlighted in red If your new field is a yes/no: 4.3.1 Find: <br />// Set the default for accepting private messages <br /> if ($AcceptPriv == "yes") { <br /> $acceptyes = "checked=\"checked\""; <br /> } <br /> else { <br /> $acceptno = "checked=\"checked\""; <br /> } <br /> BELOW it ADD <br /> if ($ObligatoryField == "yes") { <br /> $ObligatoryFieldyes = "checked=\"checked\""; <br /> } <br /> else { <br /> $ObligatoryFieldno = "checked=\"checked\""; <br /> } <br /> If your new field is a text field that needs carriage returns (like the signature field in the profile): 4.3.2 Find: <br /> $Bio = str_replace("<br />","\n",$Bio); <br /> BELOW it ADD <br /> $ObligatoryField = str_replace("<br />","\n",$ObligatoryField); <br /> If your new field will contain quotes "": 4.3.3 Find: <br /> $Bio = str_replace("\"",""",$Bio); <br /> BELOW it ADD <br /> $ObligatoryField = str_replace("\"",""",$ObligatoryField); <br /> Step 5: Open templates/default/editbasic.tmpl (The locations are chosen arbitrarily. You can change the instructions to put the fields wherever you want): If your new field is a yes/no: 5.2.1 Find: <br />{$ubbt_lang['AUX_ONLINE']} <br /><br /> <br /><input type="radio" name = "OnlineFormat" value="yes" $OnlineFormatyes class="formboxes" /> {$ubbt_lang['TEXT_YES']} <br /><input type="radio" name = "OnlineFormat" value="no" $OnlineFormatno class="formboxes" /> {$ubbt_lang['TEXT_NO']} <br /><br /> <br /><br /> <br /> BELOW it ADD <br />Title for the obligatory field <br /><br /> <br /><input type="radio" name = "ObligatoryField" value="yes" $ObligatoryFieldyes class="formboxes" /> {$ubbt_lang['TEXT_YES']} <br /><input type="radio" name = "ObligatoryField" value="no" $ObligatoryFieldno class="formboxes" /> {$ubbt_lang['TEXT_NO']} <br /><br /> <br /><br /> <br /> If the field you want to add needs more information like the Signature field then you need to use: 5.2.2 Find: <br />{$ubbt_lang['PROF_SIG']} <br /><br /> <br /><textarea name="Signature" cols="50" rows="5" wrap="soft" class="formboxes">$Signature</textarea> <br /><br /> <br /><br /> <br /> BELOW it ADD <br />Title for the obligatory field <br /><br /> <br /><textarea name="ObligatoryField" cols="50" rows="5" wrap="soft" class="formboxes">$ObligatoryField</textarea> <br /><br /> <br /><br /> <br /> If the field is a normal text field like Location 5.2.3 Find: <br />{$ubbt_lang['PROF_LOC']} <br /><br /> <br /><input type="text" name="Location" value = "$Location" class="formboxes" /> <br /><br /> <br /><br /> <br /> BELOW it ADD <br />Title for the obligatory field <br /><br /> <br /><input type="text" name="ObligatoryField" value = "$ObligatoryField" class="formboxes" /> <br /><br /> <br /><br /> <br /> Step 6: Open changebasic.php 6.1 Find: <br /> $displayname = get_input("displayname","post"); <br /> BELOW it ADD <br /> $ObligatoryField = get_input("ObligatoryField","post"); <br /> If you need to make any checks (for instance the length of the field) 6.2.1 Find <br />// ------------------------------------------------ <br />// If Bio is greater than 250, the we do not allow <br /> if ( strlen($Bio) > 250) { <br /> $html -> not_right($ubbt_lang['BIO_TOO_LONG'],$Cat); <br /> } <br /> BELOW it ADD <br /> if ( strlen($ObligatoryField) > 250) { <br /> $html -> not_right("The Obligatory Field is too long",$Cat); <br /> } <br /> If you need to make any checks (for an email field) 6.2.1 Find <br />// Check the email format <br /> if (!eregi("^[0-9_a-z]([-_.+]?[0-9_a-z])*@[0-9_a-z]([-.]?[0-9_a-z])*\.[a-wyz][a-z](g|l|m|pa|t|u|v|z|fo|me)?$", $Email)) { <br /> $html -> not_right($ubbt_lang['BAD_FORMAT'],$Cat); <br /> } <br /> BELOW it ADD <br /> if (!eregi("^[0-9_a-z]([-_.+]?[0-9_a-z])*@[0-9_a-z]([-.]?[0-9_a-z])*\.[a-wyz][a-z](g|l|m|pa|t|u|v|z|fo|me)?$", $ObligatoryField)) { <br /> $html -> not_right($ubbt_lang['BAD_FORMAT'],$Cat); <br /> } <br /> If you need to make any checks (for any < > characters) 6.2.1 Find <br /> $Occupation = str_replace("<","<",$Occupation); <br /> $Hobbies = str_replace("<","<",$Hobbies); <br /> BELOW it ADD <br /> $ObligatoryField = str_replace("<","<",$ObligatoryField); <br /> $ObligatoryField = str_replace(">",">",$ObligatoryField); <br /> 6.3 Find <br /> $displayname_q = addslashes($displayname); <br /> BELOW it ADD <br /> $ObligatoryField = addslashes($ObligatoryField); <br /> 6.4 Find <br /> $query = " <br /> UPDATE {$config['tbprefix']}Users <br /> SET U_Password = '$Password_q', <br /> U_Email = '$Email_q', <br /> U_Fakeemail = '$Fakeemail_q', <br /> U_Name = '$Name_q', <br /> U_Signature = '$Signature_q', <br /> U_Homepage = '$Homepage_q', <br /> U_Occupation = '$Occupation_q', <br /> U_Hobbies = '$Hobbies_q', <br /> U_Location = '$Location_q', <br /> U_Bio = '$Bio_q', <br /> U_Extra1 = '$ICQ_q', <br /> U_Extra2 = '$Extra2_q', <br /> U_Extra3 = '$Extra3_q', <br /> U_Extra4 = '$Extra4_q', <br /> U_Extra5 = '$Extra5_q', <br /> U_Picture = '$Picture_q', <br /> U_Visible = '$Visible_q', <br /> U_AcceptPriv = '$AcceptPriv_q', <br /> U_OnlineFormat = '$OnlineFormat_q', <br /> U_PicWidth = '$imagewidth', <br /> U_PicHeight = '$imageheight' <br /> $extra <br /> WHERE U_Number = '{$user['U_Number']}' <br /> "; <br /> CHANGE it to <br /> $query = " <br /> UPDATE {$config['tbprefix']}Users <br /> SET U_Password = '$Password_q', <br /> U_Email = '$Email_q', <br /> U_Fakeemail = '$Fakeemail_q', <br /> U_Name = '$Name_q', <br /> U_Signature = '$Signature_q', <br /> U_Homepage = '$Homepage_q', <br /> U_Occupation = '$Occupation_q', <br /> U_Hobbies = '$Hobbies_q', <br /> U_Location = '$Location_q', <br /> U_Bio = '$Bio_q', <br /> U_Extra1 = '$ICQ_q', <br /> U_Extra2 = '$Extra2_q', <br /> U_Extra3 = '$Extra3_q', <br /> U_Extra4 = '$Extra4_q', <br /> U_Extra5 = '$Extra5_q', <br /> U_Picture = '$Picture_q', <br /> U_Visible = '$Visible_q', <br /> U_AcceptPriv = '$AcceptPriv_q', <br /> U_OnlineFormat = '$OnlineFormat_q', <br /> U_PicWidth = '$imagewidth', <br /> U_PicHeight = '$imageheight'[:"red"], <br /> U_ObligatoryField = '$ObligatoryField'[/] <br /> $extra <br /> WHERE U_Number = '{$user['U_Number']}' <br /> "; <br /> Repeat the steps 3-6 for as many fields you want to add and once you have done so, go back to the first steps to add them to your registration process. I hope this helps. Now I have a headache.... Warm regards Nikos PS: Sorry for the long post 
Nikos
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 1,157
Joined: July 2001
|
|
Forums63
Topics37,575
Posts293,931
Members13,823
|
Most Online6,139 Sep 21st, 2024
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|