Add an additional field for the user

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

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: [Dave] Add an additional field for the user

By Djulia - April 4, 2008

Thank you Dave, that helps much. [:)]

But, I have another problem.
Now, I would like to obtain the values of the accounts table on my page (myPage.php).

For example :

Created by <?php echo $pageRecord['username'] ?>

There is a possible solution ?

Thank you for your assistance.

Djulia

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