News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Registration with more Information eg. ICQ etc.?

Started by Bad-Angel, January 30, 2005, 10:56:12 AM

Previous topic - Next topic

Bad-Angel

Hi all,

is it possible to add some features to the registration process!
Z.B. new folders like icq, webpage etc. witch also shown in the forum profile?

I Had Mambo 4.5.1a and SMF 1.0.1 with Birdge 2.2

chadness

Yes, it's definitely possible, and fairly simple if it's something SMF already has as an option.  You can add fields in smf_registration.html.php by duplicating the fields currently in there and using whatever names you like.  The, in smf_registration.php you can add the code to enter that in to the database.  Most of what you need is already in there.  Find: $register_vars = array(
and under there you'll see lots of sections like:$possible_ints = array(
Add the fields you added in to there.

So, for instance, if you wanted an ICQ option, in smf_registration.html.php you might add this line to the section with similar lines (optionally, instead of "Your ICQ" you might make a new variable and enter that in your english file, but....) :
    <tr>
      <td width="30%"><?php echo "Your ICQ"?> *</td>
      <td><input type="text" name="icq" size="40" value="" class="inputbox" title="Your ICQ thingy" /></td>
    </tr>

Optionally, add validation in the validation section above.

In smf_registration.php you would first add a line to grab the registration info.  Maybe to this section:
$name = $row->name;
$email = $row->email;
$username = $row->username;

Add a line like this:
$icq= $row->icq;


and you would change this line:

'ICQ', 'AIM', 'YIM', 'MSN',

to:
'ICQ'=>$icq,
'AIM', 'YIM', 'MSN',


I think this will work, but this is all untested.  OK, chances are I overlooked something - I usually do :)  It should at least be a good start.

[Unknown]

It looked good until the last part.  You don't need to do that; rather, make it:

<input type="text" name="ICQ" size="40" value="" class="inputbox" title="Your ICQ thingy" />

(note the capitalization!)

And the registration will automatically add that field.  This goes for templates too.

-[Unknown]

Sean

Hi there, I have a related question, so I figured i would ask it here, :)

Anyways, how can I have the extra data from the field emailed to me, when a new user registers?

Thanks

chadness

Fairly easy - you need to edit two files.  First is a Mambo file, languages/english.php (assuming you're doing this in English).  Look for a section that looks basically like this:
DEFINE('_ASEND_MSG','Hello %s,

A new user has registered at %s.
This email contains their details:

Name - %s
e-mail - %s
Username - %s

Please do not respond to this message as it is automatically generated and is for information purposes only');

Edit that to have the additional description you need and then another %s variable, such as adding the IP address they registered from:
DEFINE('_ASEND_MSG','Hello %s,

A new user has registered at %s.
This email contains their details:

Name - %s
e-mail - %s
Username - %s
IP Address - %s

Please do not respond to this message as it is automatically generated and is for information purposes only');

Then you edit the Admin email function in smf_registration.php to include that piece of info.  Look for a line like this:
$message2 = sprintf (_ASEND_MSG, $adminName2, $mosConfig_sitename, $row->name, $email, $username);
Which, in this example of adding IP info, you may change like this:
$message2 = sprintf (_ASEND_MSG, $adminName2, $mosConfig_sitename, $row->name, $email, $username,$user_info[ip]);

Please note, this code is all completely untested, but it should give you the general idea of what you need to edit.

mikewest

does the profile template file have to be altered still?

chadness

What we were discussing only uses profile information already in SMF, so no modifications would be necessary.  If you want additional profile details, you would still have to make the modifications here: http://unknown.network32.net/tutorial.smf_custom-profile

Advertisement: