Advertisement:

modifying the registration and profile information

Aloittaja fwitt, joulukuu 13, 2005, 12:15:43 IP

« edellinen - seuraava »

fwitt

in register.template.php

added first and last above user, inputs work select doesnt


<td width="40%">
<b>', "First Name", ':</b>
</td>
<td>
<input type="text" name="options[profile_first_name]" size="20" value="', isset($context['member']['options']['profile_first_name']) ? $context['member']['options']['profile_first_name'] :'', '" />
</td>
</tr><tr>
                                                <td width="40%">
<b>', "Surname", ':</b>
        </td>
<td>
<input type="text" name="options[profile_last_name]" size="20" value="', isset($context['member']['options']['profile_last_name']) ? $context['member']['options']['profile_last_name'] :'', '" />
</td>
</tr><tr>
        <td width="40%">
                                                        <b>Section:</b>
                                                </td>
                                                <td>
                                          <select name="options[profile_section]" size="1" />
                                          <option value="0" name="options[profile_section]" /></option/>
                                          <option value="1" name="options[profile_section]" />Beaver</option/>
                                          <option value="2" name="options[profile_section]" />Cub</option/>
                                          <option value="3" name="options[profile_section]" />Scout</option/>
                                          <option value="4" name="options[profile_section]" />Parent</option/>
                                          <option value="5" name="options[profile_section]" />Committee member</option/>
                                          <option value="6" name="options[profile_section]" />Helper</option/>
                                          <option value="7" name="options[profile_section]" />Leader</option/>
                                          </select>
                                                </td>
                                         </tr>









<td width="40%">
<b>', $txt[98], ':</b>
<div class="smalltext">', $txt[520], '</div>
</td>
<td>
<input type="text" name="user" size="20" tabindex="', $context['tabindex']++, '" maxlength="25" />
</td>
</tr><tr>






in profile.template.php


// Do the left hand column - where all the important user info is displayed.
echo '
<tr>
<td class="windowbg" width="420">
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td><b>', $txt[68], ': </b></td>
<td>', $context['member']['name'], '</td> 
                                        </tr><tr>
                                        <td><b>First name: </b></td>
                                        <td>', @$context['member']['options']['profile_first_name'], '</td>
                                        </tr><tr>
                                        <td><b>Surname: </b></td>
                                        <td>', @$context['member']['options']['profile_last_name'], '</td>
                                        </tr><tr>
                                        <td><b>Section: </b></td>
                                        <td>', @$context['member']['options']['profile_section'], '</td>
                                        </tr>';





<td>', ($context['allow_edit_name'] ? '<input type="text" name="realName" size="30" value="' . $context['member']['name'] . '" />' : $context['member']['name']), '</td>

</tr><tr>
<td><b>First name: </b></td>
<td><input type="text" name="default_options[profile_first_name]" size="30" value="', @$context['member']['options']['profile_first_name'], '" /></td>
</tr><tr>
<td><b>Surname: </b></td>
<td><input type="text" name="default_options[profile_last_name]" size="30" value="', @$context['member']['options']['profile_last_name'], '" /></td>
                                                              </tr><tr>
<td><b>Section: </b></td>
<td><select name="default_options[profile_Section]">
<option', @$context['member']['options']['profile_section'] == 'Beaver' ? ' selected="selected"' : '', '>Beaver</option>
<option', @$context['member']['options']['profile_section'] == 'Cub' ? ' selected="selected"' : '', '>Cub</option>
<option', @$context['member']['options']['profile_section'] == 'Scout' ? ' selected="selected"' : '', '>Scout</option>
<option', @$context['member']['options']['profile_section'] == 'Parent' ? ' selected="selected"' : '', '>Parent</option>
<option', @$context['member']['options']['profile_section'] == 'Committee member' ? ' selected="selected"' : '', '>Committee member</option>
<option', @$context['member']['options']['profile_section'] == 'Helper' ? ' selected="selected"' : '', '>Helper</option>
<option', @$context['member']['options']['profile_section'] == 'Leader' ? ' selected="selected"' : '', '>Leader</option>
</select></td></tr>';
// Allow the administrator to change the date they registered on and their post count.


in Personalmessage.template.php


                                // Edits
if (!empty($message['member']['options']['profile_first_name']))
echo $message['member']['options']['profile_first_name'] , ' ';
if (!empty($message['member']['options']['profile_last_name']))
echo $message['member']['options']['profile_last_name'], '<br />';
                                // End of Edits
// Show the member's gender icon?


in Display.template.php


                        // Edits
if (!empty($message['member']['options']['profile_first_name']))
echo $message['member']['options']['profile_first_name'] , ' ';
if (!empty($message['member']['options']['profile_last_name']))
echo $message['member']['options']['profile_last_name'], '<br />';

                        // End of Edits
// Show the member's gender icon?


also if you want a radio rather than a drop down in registration.template.php



</tr><tr>
                  <td width="40%">
                     <b>Role (required):</b>
                  </td>
                  <td>
                     <input type="radio" name="options[profile_role]" value="Employee" /> Employee<br />
                     <input type="radio" name="options[profile_role]" value="Customer" /> Customer<br />
                  </td>
               </tr>



I have been trying to edit the templates for the registration and profile to add extra fields for First and Last Name (I also want a third fieldbut as its not a text field I thought it would be easier to get the text fields working first then i could adapt working code rather than doing it all at once.

I have got the text boxes appearing where I want them to but I cant work out what happens to the data once its been entered into the registration form.

I have never done anything with php before trying to do this, so it could quite easily be a simple mistake.




Any help in working out what I have done wrong would be much apreciated.


-edit- removed code that didnt work and replaced it with the working code

Ciced


fwitt

looked at that already but it doesnt do the registration part, i tried to modify some of the code from that tutorial in what I have done.
But the important bit for me is the registration process as I need to know who I am allowing to sign up to the forum and which areas to allow them access to. Having there First and Last names makes it possible for me to work out if they are allowed to sign up.
I have already had cases where a member has signed up with username: APerson, Email: [email protected], where we have Andy Person and Alex Person who are both members.
Who would have completely different Permissions for the site this then left me with the task of working out which one of the two had in fact signed up, which in my opinion is a waste of admin time which could be better spent elsewhere.

I have managed to get bits of the code I want working independantly its just getting them all integrated that I dont seem to be able to do.

fwitt

got it all working (at last).

the last error that had me stuck for ages was so simple i now feel stupid for not noticeing.

in one edit i was using the variable profile_section and in the other i was recalling profile_Section.

Advertisement: