Uutiset:

Join the Facebook Fan Page.

Main Menu
Advertisement:

Registering new members settings?

Aloittaja atcair, lokakuu 17, 2005, 03:19:32 AP

« edellinen - seuraava »

atcair

I asked this somewhere else but can't find the post.

I want to require Fisrt and Last names when new people register.  I can't find any options for this.  How can I accomplish this?

Thanks

atcair


Oldiesmann

Where do you want this information displayed? In their profile?
Michael Eshom
Christian Metal Fans

atcair

I suppose. My real reason is that I want to see who is registering for the forum. I can even maintain a seperate database of real name/usernames if it doesn't show in their profile.
I know they can lie but the forum is for a realativly limited group of people.  I would like to allow "outsiders" but I want to know they are outsiders.

Getting their name when they register is what really matters.

Thanks

Oldiesmann

Ok, so you want it displayed in the admin registration center. No problem :)

If you've got 1.1, please click here to jump to the instructions for 1.1 (slightly different)...

1.0.5:

Themes/default/Register.template.php

Find
</tr><tr>
<td width="40%">
<b>', $txt[82], ':</b>
</td>
<td>
<input type="password" name="passwrd2" size="30" />
</td>
</tr>


Add after that
<tr>
<td width="40%">
<b>First Name:</b>
</td>
<td>
<input type="text" name="first_name" size="30" />
<div class="smalltext">{disclaimer}</div>
</td>
</tr><tr>
<td width="40%">
<b>Last Name:</b>
</td>
<td>
<input type="text" name="last_name" size="30" />
</td>
</tr>


Then find
<td class="windowbg">', $member['dateRegistered'], '</td>

Add after that
<td class="windowbg">', $member['first_name'], '</td>
<td class="windowbg">', $member['last_name'], '</td>


Themes/default/Modifications.english.php

Add this somewhere (doesn't matter where as long as it's between <?php and ?>):
$txt['name_required'] = 'You must enter both your first and your last name';

Sources/Register.php

Find
if (isReservedName($_POST['user'], 0, false))
fatal_error('(' . htmlspecialchars($_POST['user']) . ') ' . $txt[473], false);


Add after that
if ($_POST['first_name'] == '' || trim($_POST['first_name']) == '' || $_POST['last_name'] == '' || trim($_POST['last_name']) == '')
fatal_lang_error('name_required', false);


Find
'ID_POST_GROUP' => 4,

Add after that
'first_name' => "'$_POST[first_name]'",
'last_name' => "'$_POST[last_name]'",


Find
'dateRegistered' => array('label' => $txt['admin_browse_registered']),

Add after that
'first_name' => array('label' => 'First Name'),
'last_name' => array('label' => array('label' => 'Last Name'),


Find
$request = db_query("
SELECT ID_MEMBER, memberName, emailAddress, memberIP, dateRegistered
FROM {$db_prefix}members
WHERE is_activated = 0
AND validation_code " . ($context['browse_type'] == 'approve' ? '=' : '!=') . " ''
ORDER BY $_REQUEST[sort]" . (!isset($_REQUEST['desc']) ? '' : ' DESC') . "
LIMIT $_REQUEST[start], $modSettings[defaultMaxMembers]", __FILE__, __LINE__);


Replace
$request = db_query("
SELECT ID_MEMBER, memberName, emailAddress, memberIP, dateRegistered, first_name, last_name
FROM {$db_prefix}members
WHERE m.is_activated = 0
AND validation_code " . ($context['browse_type'] == 'approve' ? '=' : '!=') . " ''
ORDER BY $_REQUEST[sort]" . (!isset($_REQUEST['desc']) ? '' : ' DESC') . "
LIMIT $_REQUEST[start], $modSettings[defaultMaxMembers]", __FILE__, __LINE__);


Find
'dateRegistered' => timeformat($row['dateRegistered']),

Add after that
'first_name' => timeformat($row['first_name']),
'last_name' => timeformat($row['last_name']),


1.1:

Themes/default/ManageMembers.template.php:

Find
<td class="windowbg">
<a href="', $member['href'], '">', $member['username'], '</a>
</td>


Add after that
<td class="windowbg">$member['first_name']</td>
<td class="windowbg">$member['last_name']</td>


Themes/default/Register.template.php

Find
</tr><tr>
<td width="40%">
<b>', $txt[82], ':</b>
</td>
<td>
<input type="password" name="passwrd2" size="30" tabindex="', $context['tabindex']++, '" />
</td>
</tr>';


Replace
</tr><tr>
<td width="40%">
<b>', $txt[82], ':</b>
</td>
<td>
<input type="password" name="passwrd2" size="30" tabindex="', $context['tabindex']++, '" />
</td>
</tr><tr>
<td width="40%">
<b>First Name:</b>
</td>
<td>
<input type="text" name="first_name" size="30" tabindex="', $context['tabindex']++, '" />
</td>
</tr><tr>
<td width="40%">
<b>Last Name:</b>
</td>
<td>
<input type="text" name="last_name" size="30" tabindex="', $context['tabindex']++, '" />
</td>
</tr>';


Modifications.english.php

Add (anywhere between <?php and ?>):
$txt['name_required'] = 'You must enter both your first and your last name';

Sources/ManageMembers.php

Find
'memberName' => array('label' => $txt['admin_browse_username']),

Add after that
'first_name' => array('label' => 'First Name'),
'last_name' => array('label' => 'Last Name'),


Find
SELECT ID_MEMBER, memberName, emailAddress, memberIP, dateRegistered

Replace
SELECT ID_MEMBER, memberName, first_name, last_name, emailAddress, memberIP, dateRegistered,

Find
'username' => $row['memberName'],

Add after that
'first_name' => $row['first_name'],
'last_name' => $row['last_name'],


Sources/Register.php

Find
'username' => $_POST['user'],

Add after that
'first_name' => $_POST['first_name'],
'last_name' => $_POST['last_name'],


Sources/Subs-Members.php

Find
// No name?!  How can you register with no name?
if (empty($regOptions['username']))
fatal_lang_error(37, false);


Add after that

if (empty($regOptions['first_name']) || empty($regOptions['last_name']))
fatal_lang_error('name_required', false);


Find
'emailAddress' => "'$regOptions[email]'",

Add after that
'first_name' => "'$regOptions[first_name]'",
'last_name' => "'$regOptions[last_name]'",


That should do it. The first name and last name will only be displayed in the admin center when you're browsing members awaiting activation/approval.
Michael Eshom
Christian Metal Fans

Elmacik

wow... to compile a mod would be easier.... lol :P
good work Oldiesmann
Home of Elmacik

Oldiesmann

Yeah, it would be easier, but it's quicker to type it up as I go instead of taking the time to package it up as a mod :)
Michael Eshom
Christian Metal Fans

atcair

Wow Thanks.  I'll get that put in and let everyone know how it turns out.

Thanks again!!!

atcair

One problem.  Can't find a Themes/default/modifications.english.PHP file anywhere.

The themes/default is there but no modifications.php file.  Actually, nothing that says modifications at all.

Am I being stupid?

Elmacik

Oldiesmann,
i think there is some place more you have to add that fields.
into the admin panel -> registration ->register new member

there is no place to enter extra data but it gives this error:
you have to fill first and last name :)

(btw, if you tell us how to set it not to require, it would be nice :) )
Home of Elmacik

Elmacik

Lainaus käyttäjältä: atcair - lokakuu 18, 2005, 05:09:39 IP
One problem.  Can't find a Themes/default/modifications.english.PHP file anywhere.

The themes/default is there but no modifications.php file.  Actually, nothing that says modifications at all.

Am I being stupid?
must be there, if not, find it from the installation package and re-upload to there
Home of Elmacik

atcair

Sorry to be a pain but want to be 100% sure. In Themes/default/Register.template.php

I can't find the code exactly as you have it.  I have the following
Lainaa:</tr><tr>
                  <td width="40%">
                     <b>', $txt[82], ':</b>
                  </td>
                  <td>
                     <input type="password" name="passwrd2" size="30" />
                  </td

The
Lainaasize="30" tabindex="', $context['tabindex']++, '" />
is missing.

Is this still the right place?  Just want to make sure so I don't screw it up.

Elmacik

i think you are using 1.0.5 but trying to do the modification for 1.1 :)
Oldiesmann has posted above both for 1.0.5 and 1.1 RC 1
dont use one for another
Home of Elmacik

Oldiesmann

Sorry... Should be Themes/default/languages/Modifications.english.php

Also, I left the "first name" and "last name" fields out of the admin registration center because I figured if you were registering them, you'd know who they were.

To add them:

Themes/default/Register.template.php

1.0.5:

Find
<td width="50%" align="left">
<input type="password" name="password" size="30" /><br />
</td>


Add after that
</tr><tr class="windowbg2">
<td width="50%" align="right">
<b>First Name:</b>
</td>
<td width="50%" align="left">
<input type="text" name="first_name" size="30" />
</td>
</tr><tr class="windowbg2">
<td width="50%" align="right">
<b>Last Name:</b>
</td>
<td width="50%" align="left">
<input type="text" name="last_name" size="30" />
</td>


1.1:

Find
<td width="50%" align="left">
<input type="password" name="password" id="password_input" size="30" /><br />
</td>


Add after that
</tr><tr class="windowbg2">
<th width="50%" align="right">
<label for="first_name_input"><b>First Name:</b></label>
</th>
<td width="50%" align="left">
<input type="text" name="first_name" id="first_name_input" size="30" /><br />
</td>
</tr><tr class="windowbg2">
<th width="50%" align="right">
<label for="last_name_input"><b>Last Name:</b></label>
</th>
<td width="50%" align="left">
<input type="text" name="last_name" id="last_name_input" size="30" /><br />
</td>


And for making it so it's not required:

1.0.5:

Sources/Register.php

Find and remove
if ($_POST['first_name'] == '' || trim($_POST['first_name']) == '' || $_POST['last_name'] == '' || trim($_POST['last_name']) == '')
fatal_lang_error('name_required', false);


1.1:

Sources/Subs-Members.php

Find and remove
if (empty($regOptions['first_name']) || empty($regOptions['last_name']))
fatal_lang_error('name_required', false);
Michael Eshom
Christian Metal Fans

atcair

I may have done something wrong.  When I click Registration Management I get
LainaaParse error: parse error, unexpected ';', expecting ')' in /home/lrn2fly2/public_html/board/Sources/Register.php on line 749
And when I click View?delete Members I get
LainaaTemplate Parse Error!
There was a problem loading the /Themes/default/ManageMembers.template.php template or language file. Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\). To see more specific error information from PHP, try accessing the file directly.

Mind you I am a moron and may have do something weird. Do those error mean anything to you?

Elmacik

can you please post the relevant lines in that files?
a very simple problem i guess
Home of Elmacik

atcair

#16
I am a big time noob and although I have some html skills I have no PHP experience.  What is the best way to find line 749?  I have no idea what to do so I will post the whole text. I promise I will learn and not do this to anyone again  :-[ 


Elmacik

i couldnt really find it.. too frightening amount of codes :P
can you please re-upload a new Register.php and over-write the old one?
and also the other file thats giving error..
then you can try to re-apply the changes for creating "first name" and "last name" fileds in registration

to edit PHP, you can use wordpad :)
Home of Elmacik

atcair

I will do that.  It's time to go home.  I also get an error from 
Lainaa/Themes/default/ManageMembers.template.php

I will reload both and start fresh tommorow.  I really appreciate the help.  I'll let you know when I try again.  :D

atcair

Ok, I reloaded all the bad files and started over.  I am till getting
LainaaParse error: parse error, unexpected ';', expecting ')' in /home/lrn2fly2/public_html/board/Sources/Register.php on line 748
but only when I click Registration Management,  When I click View/Delete Members all is fine and I can click on a member and see they're info although I don't see first or last name.

I was very careful about following ALL of the instructions.  Any ideas what might have gone wrong?

I believe line 748 is somewhere in here:
Lainaa// The columns that can be sorted.
   $context['columns'] = array(
      'ID_MEMBER' => array('label' => $txt['admin_browse_id']),
      'memberName' => array('label' => $txt['admin_browse_username']),
      'emailAddress' => array('label' => $txt['admin_browse_email']),
      'memberIP' => array('label' => $txt['admin_browse_ip']),
      'dateRegistered' => array('label' => $txt['admin_browse_registered']),       'first_name' => array('label' => 'First Name'),
      'last_name' => array('label' => array('label' => 'Last Name'),
   );

   // Default sort column to 'dateRegistered' if the current one is unknown or not set.
   if (!isset($_REQUEST['sort']) || !array_key_exists($_REQUEST['sort'], $context['columns']))
      $_REQUEST['sort'] = 'dateRegistered';

See antything?  Thanks

Advertisement: