Flexible Content Management System


Custom User Fields Storing Problem

Contributed by on Feb 24, 2004 - 08:03 PM

pnAPI only enables to change active user data with pnUserSetVar function but not other users'. For some registration purposes I suggest changing pnUserSetVar function code:
function pnUserSetVar($name, $value, $uid = 0)
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();

if (empty($name)) return false;

if (empty($uid)) {
$uid = pnSessionGetVar('uid');
if (empty($uid)) return false;


Making use of the previous change to the API code, the problem could be solved with altering newuser_user_finishnewuser function (modules/NS-NewUser/user.php).Right after the lines that update user table, insert the following:
$result = $dbconn->Execute("sql statement to insert new user...");

$uid = $dbconn->PO_Insert_ID($pntable['users'], $column['uid']);
if (!empty($dynadata) && is_array($dynadata)) {
while (list($key, $val) = each($dynadata)) {
pnUserSetVar($key, $val, $uid);
I found that this change completely solved the problem with custom user data fields storing.

Miklos Kovacs
Footnote: 1