| Author |
Add more registration fields |
Adnan
Super Administrator
Posts: 80
Location: Montreal, Canada
Joined: 23.03.06 |
| Posted on 05-08-2006 19:46 |
|
|
Sometimes the default settings in PHP-Fusion aren't always what we want, and that's the beauty of this open source software, you can change it to fit your needs and wants!!! Its not that hard either, once you know what you are doing.
This article is to show you how to add more fields to the registration form, and then subsequent changes in all the places where people's profiles are edited/viewed. I've tried to make it as simple and easy to follow as possible!
Read Full Article => Add more registration fields |
|
| Author |
Sponsored Link |
Advertisement
Location: Internet
|
|
|
|
| Author |
RE: Add more registration fields |
gero9mo
Member
Posts: 3
Joined: 23.09.06 |
| Posted on 23-09-2006 01:44 |
|
|
Hi Adnan!
First of all thank you for making the tutorial and the instructions for how to ad "items" to the register fields.
What i want to ask for help about is this:
I only want to add new fields in the "user profile" section and the folowing 2 fields i need to show/ad is:
Titan Poker Nickname
Noble Poker Nickname
If i am to make this as an opton for my users to fill out,, do i then edit just this section:
but this only asks the user to modify the field, we also need to be able to save it. Thus we go to /includes/update_profile_include.php and around line 66 the following can be seen,
$user_sig = isset($_POST['user_sig']) ? stripinput(trim($_POST['user_sig'])) : "";after which we add the retrieval of our information, so the line above becomes,
$user_sig = isset($_POST['user_sig']) ? stripinput(trim($_POST['user_sig'])) : "";
$user_interests = isset($_POST['user_interests']) ? stripinput(trim($_POST['user_interests'])) : "";
further down the file, at about line 98 the following will be modified,
$result = dbquery("UPDATE ".$db_prefix."users SET user_name='$username',".$newpass."user_email='".$_POST['user_email']."', user_hide_email='$user_hide_email', user_location='$user_location', user_birthdate='$user_birthdate', user_aim='$user_aim', user_icq='$user_icq', user_msn='$user_msn', user_yahoo='$user_yahoo', user_web='$user_web', user_theme='$user_theme', user_offset='$user_offset', ".$set_avatar."user_sig='$user_sig' WHERE user_id='".$userdata['user_id']."'"  ;to become,
$result = dbquery("UPDATE ".$db_prefix."users SET user_name='$username',".$newpass."user_email='".$_POST['user_email']."', user_hide_email='$user_hide_email', user_interests = '$user_interests', user_location='$user_location', user_birthdate='$user_birthdate', user_aim='$user_aim', user_icq='$user_icq', user_msn='$user_msn', user_yahoo='$user_yahoo', user_web='$user_web', user_theme='$user_theme', user_offset='$user_offset', ".$set_avatar."user_sig='$user_sig' WHERE user_id='".$userdata['user_id']."'"  ;
and this part:
now we can ask the user for the information, they can edit it, and we can save it as well. The only thing left so far is the ability to SEE this information.
The changes in profile.php are necessary so that any user (or guest) can see this information on any member. Make sure that if you have asked for some sensitive information that you do NOT make these changes! We are gonna make changes later to the profile in the admin panel, so the admins can see this information, so for sensitive information please do that change only. For our purpose, the interests of a member are not of a sensitive nature, so here are the changes to be done in profile.php,
at about line 79,
</tr>
</table>\n";will be changed to,
</tr>
<tr>
<td width='1%' class='tbl1' style='white-space:nowrap'><b>Interests</b></td>
<td class='tbl1' colspan='2'>".($data['user_interests'] ? $data['user_interests'] : $locale['u048'])."</td>
</tr>
</table>\n";
Could you help me get "this sorted out" so that i can have this option for my members to fill out?
Thanx for helping
gero9mo |
|
| Author |
RE: Add more registration fields |
Adnan
Super Administrator
Posts: 80
Location: Montreal, Canada
Joined: 23.03.06 |
| Posted on 23-09-2006 02:39 |
|
|
So if I understand this correctly, you just want this option to be available from the edit_user portion and in the user profile, but no mention of this in the registration form. Correct?
If yes, then follow through with everything as listed, but just don't do the obtaining of info from the user in register.php ... don't do anything like <input type=...> this way it'll just put in a blank field at that spot, but it can be filled when the user updates it from edit profile.
Hopefully that answers your question, if not let me know...
Adnan. |
|
| Author |
RE: Add more registration fields |
gero9mo
Member
Posts: 3
Joined: 23.09.06 |
| Posted on 23-09-2006 17:35 |
|
|
Yep..
Exactly what was thinking of... I now got to extra boxes at the profile page and people have the option to fill it out after regging.. but as i have donne this at theese files only yet:
edit_profile.php
includes/update_profile_include.php
administration/updateuser.php
administration/members.php
I still dont get the field where you fill inn the info at the update profile page to be shown in the profile page.But for me it's here the hard part starts if i have to "not fill inn" stuff..But i'll try to edit it and see how things work out... but really i could use another "hint" right now!
But to get it said: Awesome help in this dude..thank you so much for making it available/understandable.
gero9mo
|
|
| Author |
RE: Add more registration fields |
Adnan
Super Administrator
Posts: 80
Location: Montreal, Canada
Joined: 23.03.06 |
| Posted on 23-09-2006 19:35 |
|
|
Ok, basically I want you to follow the whole tutorial from A to Z, modifying every single file as suggested EXCEPT for Change #1. Do NOT add the code from Change #1. This way it should all work as expected.
don't forget to do the changes to profile.php or else the added info will not be shown! (Which is change #7).
Adnan. |
|
| Author |
Sponsored Link |
Advertisement
Location: Internet
|
|
|
|
| Author |
RE: Add more registration fields |
gero9mo
Member
Posts: 3
Joined: 23.09.06 |
| Posted on 25-09-2006 18:07 |
|
|
Hi again adnan.
Have been a bit bussy the past days but last night i went through the prosedure and it's all ok exept for a couple of errors after my editing and that is when i go to my admin panel and try to edit my member "poker names" it's always showing "my poker name" after saving and aditing,, the names are updated and saved to the members profiles but it only will show the names i typed in as my own poker nick names at the member admin,, if i look on a member profile.
I think i can find that error causing that but i wanted to ask you this:
At the first article (add more reg fields edit #2) on this you say it like this at the edit register file:$TemporaryName = isset($_POST['PutUniqueNameHere']) ? stripinput(trim($_POST['PutUniqueNameHere'])) : "";
And then at the second article it says this:
$interests = isset($_POST['user_interests']) ? stripinput(trim($_POST['user_interests'])) : "";
I hope this is the way it's ment after my edit at my reg file:
$titan_poker_name = isset($_POST['user_titan_poker_name']) ? stripinput(trim($_POST['user_titan_poker_name'])) : "";
$noble_poker_name = isset($_POST['user_noble_poker_name']) ? stripinput(trim($_POST['user_noble_poker_name'])) : "";
One of the reasons for asking is this -- in the line above this (in default reg file) the comand says like this:
$user_hide_email = isNum($_POST['user_hide_email']) ? $_POST['user_hide_email'] : "1";
maybe its like this i also should add it:
$user_titan_poker_name = isset($_POST['user_titan_poker_name']) ? stripinput(trim($_POST['user_titan_poker_name'])) : "";
$user_noble_poker_name = isset($_POST['user_noble_poker_name']) ? stripinput(trim($_POST['user_noble_poker_name'])) : "";
And why is not this edit neccesarry in the first article 8taken from article 2):now at line 122, you shall see the following code,
"user_hide_email" => isNum($_POST['user_hide_email']) ? $_POST['user_hide_email'] : "1"
));the modification done is as follows, we replace the above with
"user_hide_email" => isNum($_POST['user_hide_email']) ? $_POST['user_hide_email'] : "1",
"user_interests" => $interests
));
And when running the preview of a page with this code:<?php
$result = dbquery("ALTER TABLE ".$db_prefix."users ADD user_PutUniqueNameHere VARCHAR(16) NOT NULL DEFAULT '' AFTER user_hide_email");
?>
And am i here suposed to run this preview a couple of times like this:#1: <?php
$result = dbquery("ALTER TABLE ".$db_prefix."users ADD user_titan_poker_name VARCHAR(16) NOT NULL DEFAULT '' AFTER user_hide_email");
?><br><br>#2: <?php
$result = dbquery("ALTER TABLE ".$db_prefix."users ADD user_noble_poker_name VARCHAR(16) NOT NULL DEFAULT '' AFTER user_titan_poker_name");
?>
Sorry for being a bit"lost" here but i am so new in the game of understanding code that i know i sometimes mess things up by not seing "the obvious" but i get a bit confused here and wish i only read the first article lol :)
But exept for the first mentioned problem, it looks like everything is working alright at the site and i am most greatfull for all your help on this issue..
Nice if i could get a "clearification" of my confusedness :)
gero9mo
Edited by on 25-09-2006 20:30 |
|
| Author |
RE: Add more registration fields |
Adnan
Super Administrator
Posts: 80
Location: Montreal, Canada
Joined: 23.03.06 |
| Posted on 26-09-2006 03:36 |
|
|
Hey,
hopefully this will help clarify things,
TemporaryName is a temporary variable that takes the inputed information and just inserts it in the table ... where as PutUniqueNameHere is the name of the variable as labelled in the database. they can be the same or different, it really makes no difference. In my original article that was in parts, I had them labelled differently so I just kep that same convention here. it makes no difference if u label them the same or not.
as for that change not being required, again its the convention of renaming it and storing it. follow the example if you only have one change and then repeat it again for the second and so on ... its a bit longer this way but u know u'll get it right. the first general article is there for u to understand so u can do all the changes as u go along, no matter how many fields you are adding.
and finally yes, previewing #1 and then changing it to #2 and then previewing that is the way to go.
Let me know if there are any more questions,
Adnan. |
|
| Author |
RE: Add more registration fields |
pesfever
Member
Posts: 3
Location: Netherlands
Joined: 22.10.06 |
| Posted on 22-10-2006 19:36 |
|
|
Hi Adnan,
I have been busy with this a few days and I am not a programmer so I hope you can help me out.
I am trying to add 2 more fields : First Name and Last Name.
-> behind the field User Name
The fields must be mandatory as well.
I also want to make the Birthdate mandatory (how to do this bcos
the field consists of 3 blocks : month/day/year ?)
So far the 1st two fields works well, only when I go to the admin panel and want to
edit the members I see a blanc page with errors I can't fix.
This is the last file to edit : /administration/members.php
I also already had inserted the 2 fields in PHPMyAdmin
Hope you can help me out ...
Edited by on 23-10-2006 11:18 |
|
| Author |
RE: Add more registration fields |
Adnan
Super Administrator
Posts: 80
Location: Montreal, Canada
Joined: 23.03.06 |
| Posted on 23-10-2006 11:03 |
|
|
Wat errors are you getting? Please be more specific or give link for me to check it out (you can PM this to me if you don't want the site public yet).
for the bday, wat you can try is use the same code i gave for making a field mandatory but put it three times, one for day, one for month, and one for year. This way it should check that all three have been filled in. |
|
| Author |
RE: Add more registration fields |
pesfever
Member
Posts: 3
Location: Netherlands
Joined: 22.10.06 |
| Posted on 23-10-2006 11:25 |
|
|
I already put the original file /administration/members.php back, dunno
what the errors were. But they referred to lines where I didn't edit so I quess I must
have done something wrong else where ... I will give it one more try bcos so far
your explanation worked well, thnx for that. |
|
| Author |
Sponsored Link |
Advertisement
Location: Internet
|
|
|
|
| Author |
RE: Add more registration fields |
pesfever
Member
Posts: 3
Location: Netherlands
Joined: 22.10.06 |
| Posted on 23-10-2006 12:11 |
|
|
got this same error again :
Parse error: parse error in ~/administration/members.php on line 485
line 485 says ?>
So I added } after the two fields I inserted :
if ($error == "") {
$TemporaryName = isset($_POST['PutUniqueNameHere']) ? stripinput(trim($_POST['PutUniqueNameHere'])) : "";
}
It is working now ! Great.
Gonna work on the birthdate now ... many thnx again !
Edited by on 23-10-2006 12:12 |
|
| Author |
RE: Dropdown list in edit_profile.php |
liliplanet
Member
Posts: 3
Location: Cape Town
Joined: 06.01.07 |
| Posted on 06-01-2007 13:43 |
|
|
Hi again Adnan,
My business directory I thought of using User Group Apply infusion, but somehow it's too complicated. I would like to create a droplist for User Groups which will be in the edit_profile.php.
So probarbly would use something similar to user theme dropdown? Please, how would I change the following for user_groups ..
<tr>
<td class='tbl'>".$locale['u015']."</td>
<td class='tbl'><select name='user_theme' class='textbox' style='width:100px;'>
".makefileopts($theme_files, $userdata['user_theme'])."
</select></td>
</tr>
Look so forward to your reply.
Thank you so much!
Lilian |
|
| Author |
RE: Add more registration fields |
Semir
Member
Posts: 2
Joined: 08.01.07 |
| Posted on 08-01-2007 14:33 |
|
|
Selam Alejkum,
I went true the tutorial and added extra filed but when the users register and put in their name it does not show up it is just blank even though I get no errors!! But when I go to edit profile and then I type in the name and update it is shows so is this the only way this works or something wrong with my registration,? Sorry but im only begginer in php  |
|
| Author |
RE: Add more registration fields |
Semir
Member
Posts: 2
Joined: 08.01.07 |
| Posted on 08-01-2007 19:38 |
|
|
fixed  |
|