PDA

View Full Version : $profilefield --> online.php


Gio~Logist
09-09-2005, 12:02 AM
I tried the following code in order to pull up a user's profile field in online.php However, i was unsuccessful!


$profilefields = $DB_site->query("
SELECT profilefieldid, required, title, type, data, def, height
FROM " . TABLE_PREFIX . "profilefield
WHERE form = 0 OR 6 OR 7 OR 8 OR 9 OR 10 OR 11 OR 12 OR 13 OR 14 OR 15 OR 16" . iif(!can_moderate(), "
AND hidden = 0") . "
ORDER BY displayorder
");


require_once('./includes/functions_user.php');

$search = array(
'#(\r\n|\n|\r)#',
'#(<br />){3,}#', // Replace 3 or more <br /> with two <br />
);
$replace = array(
'<br />',
'<br /><br />',
);

while ($profilefield = $DB_site->fetch_array($profilefields))
{
exec_switch_bg();
$profilefieldname = "field$profilefield[profilefieldid]";
if ($profilefield['type'] == 'checkbox' OR $profilefield['type'] == 'select_multiple')
{
$data = unserialize($profilefield['data']);
foreach ($data AS $key => $val)
{
if ($userinfo["$profilefieldname"] & pow(2, $key))
{
$profilefield['value'] .= iif($profilefield['value'], ', ') . $val;
}
}
}
else if ($profilefield['type'] == 'textarea')
{
$profilefield['value'] = preg_replace($search, $replace, trim($userinfo["$profilefieldname"]));
}
else
{
$profilefield['value'] = $userinfo["$profilefieldname"];
}
if ($profilefield['value'] != '')
{
$show['extrainfo'] = true;
}


}