Firefox PHP

customising new field on REGISTRATION page

Posted by vinayacak 
customising new field on REGISTRATION page
November 16, 2006 09:23AM
All,

I have installed PHORUM 5.1.16a and started using it for last 3 weeks. It is fantastic and gives me flexibility in customising it.

Today I am trying to add custom field to REG page. I add a new field called 'Tell_us_about_yourself' on CUSTOM PROFILES in admin page. After that I added the field to language file for a description.

Now i added following code to Register.tpl

<tr>
<td nowrap="nowrap">{LANG->Tell_us_about_yourself}*:&nbsp;</td>
<td><input type="text" name="email" size="30" value="{REGISTER->Tell_us_about_yourself}" /></td>
</tr>


Now the new field is displayed on REGISTER page.

When I try registering new user I am getting this error message in spite of trying new username, new email address and everything new.

"The email address you entered does not appear to be a valid email address. Please try again."

Don't know how to solve this problem. Please help me in resolving this issue.

Also it would be helpful if I can get some guidance on how add this custom field to the user approval page in MY CONTROL CENTER for admins.

Regards,
Vinay
Re: customising new field on REGISTRATION page
November 16, 2006 09:32AM
Quote

<input type="text" name="email" size="30" ...

You are putting this data in a field named "email", but that field is already used by Phorum itself for storing the email address.

You need to add a custom profile field to the Phorum configuration. Did you do this already? The name that you used there, should be used in the text field that you created in the registration page.

Allthough it's not completed yet, take a look at docs/creating_custom_userfields.txt


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: customising new field on REGISTRATION page
November 17, 2006 03:19AM
Thanks Maurice.

I modified and it worked fine.

I want to see this value while approving users and added following code to cc_users.tpl

<td class="PhorumTableRow" width="50%" nowrap="nowrap" width="150">{USERS->Tell_us_about_yourself}</td>

The value entered in reg page is not shown here. How do I rectify this problem?

Also I want to make the new field mandatory in register page. How to do it?

Please help.

Regards,
Vinay
Re: customising new field on REGISTRATION page
November 17, 2006 03:51AM
For making the field mandatory, you will have to write a module which checks the contents of this fields on posting the form. See docs/creating_mods.txt and search for before_register in that document. There's an example of a hook function for doing this check.

In the cc_users.tpl, you have no access to the full user information. If you want to use fields outside the ones that are already used in that template, you'll have to add some code for retrieving it. I did not test this code, but maybe you can use this (just put in in the template instead of the <td ....>....</td> that you have used now):
<?php
$fulluser = phorum_user_get($PHORUM["TMP"]["USERS"]["user_id"]);
$PHORUM["DATA"]["FULLUSER"] = $fulluser;
?>
<td class="PhorumTableRow" width="50%" nowrap="nowrap" width="150">{FULLUSER->Tell_us_about_yourself}</td>


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: customising new field on REGISTRATION page
November 21, 2006 08:48AM
Maurice,

this worked... Thanks for ur support
Re: Problem Adding New Fields to REGISTRATION page
June 27, 2007 09:45PM
I'm having the same problem and just can't get it to work correctly. I'm trying to add "Realname" and "Lot" fields to the registration template. I added the new file names in the Forum Admin (Add a Profile Field) and modified the following documents accordingly:

profile.tpl

{IF PROFILE->Realname}
<tr>
<td nowrap="nowrap">{LANG->Realname}:&nbsp;</td>
<td>{PROFILE->Realname}</td>
</tr>
{/IF}

{IF PROFILE->Lot}
<tr>
<td nowrap="nowrap">{LANG->Lot}:&nbsp;</td>
<td>{PROFILE->Lot}</td>
</tr>
{/IF}


register.tpl

<tr>
<td nowrap="nowrap">{LANG->Realname}*:&nbsp;</td>
<td><input type="text" name="Realname" size="30" value="{REGISTER->Realname}" /></td>
</tr>
<tr>

<td nowrap="nowrap">{LANG->Lot}*:&nbsp;</td>
<td><input type="text" name="Lot" size="30" value="{REGISTER->Lot}" /></td>
</tr>
<tr>

Now, the fields that show on the registration page look like this, with the first two blank:

*: _______________

*: _______________

User Name: _______________

Email: _______________

Password: _______________

Any clue as to what I am doing wrong here?
Re: Problem Adding New Fields to REGISTRATION page
June 28, 2007 02:46AM
{LANG->Lot} and {LANG->Realname} are coming from the language-file.
did you add them there?


Thomas Seifert
Re: Add New Field Names to Language File
June 28, 2007 11:33PM
Ok, that worked great. I added the new field names to the Language file and now they appear properly on the login page! For some reason, when I create the field within the Phorum Admin control panel, it does not add it to the Language file.

Now, my only remaining problem is how do I know that these new fields were created in the database and if not, how do I create them? Manually from within mySQladmin? Also, are there any more instruction on how to modify the user's profile page so that these fields are reflected there as well (so the admin can review the info before granting access)?
Re: Add New Field Names to Language File
June 29, 2007 02:08AM
Quote

For some reason, when I create the field within the Phorum Admin control panel, it does not add it to the Language file.

Its not meant to. It never adds anything to files.

Quote

Now, my only remaining problem is how do I know that these new fields were created in the database and if not, how do I create them?

If you added them in the custom profile panel in the admin then they are there. Custom fields are not having their own column but are stored in separate table.

Just search the forums. There are much more people which have done the same.


Thomas Seifert
Sorry, only registered users may post in this forum.

Click here to login