Add an additional field for the user

5 posts by 2 authors in: Forums > CMS Builder
Last Post: April 4, 2008   (RSS)

By Djulia - April 3, 2008

Hi,

I would like to add an additional field for the user.
Admin > User Accounts > modify

For example :
Phone
Mailing Address

Is that possible ?

Thank you for your assistance.

Djulia

Re: [Djulia] Add an additional field for the user

By Dave - April 3, 2008

You can edit the (hidden) User Accounts section with this url:

admin.php?menu=database&action=editTable&tableName=accounts

Just be sure to backup /data/schema/accounts.ini.php and not overwrite it next time you upgrade!

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Djulia] Add an additional field for the user

By Dave - April 4, 2008

The software doesn't support that functionality directly but you could do it with some PHP code. Use this (or something similar) where $record['createdByUserNum'] is defined. Note that if your variable is called $pageRecord you'll need to rename $record to that in this code:

<?php // load user
$query = "SELECT * FROM {$TABLE_PREFIX}accounts WHERE num = '{$record['createdByUserNum']}'";
$result = mysql_query($query) or die("MySQL Error: ". htmlspecialchars(mysql_error()) . "\n");
$createdByUserRecord = mysql_fetch_assoc($result);
?>


Then you can display user fields like this:

<?php echo $createdByUserRecord['fullname'] ?>

And list all the user fields (for testing) like this:

<xmp><?php print_r($createdByUserRecord); ?></xmp>

Hope that helps! :)
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Add an additional field for the user

By Djulia - April 4, 2008

It is perfect, thank you Dave. [:)]

Djulia