/** * Fetches the Profile Fields for a User input form * * @param integer Forum Type: 0 indicates a profile field, 1 indicates an option field * */ function fetch_profilefields($formtype = 0) { global $vbulletin, $stylevar, $customfields, $bgclass, $show; global $vbphrase, $altbgclass, $bgclass1, $tempclass; // get extra profile fields $profilefields = $vbulletin->db->query_read_slave("\n\t\tSELECT * FROM " . TABLE_PREFIX . "profilefield\n\t\tWHERE editable IN (1,2)\n\t\t\tAND form " . iif($formtype, '>= 1', '= 0') . "\n\t\tORDER BY displayorder\n\t"); while ($profilefield = $vbulletin->db->fetch_array($profilefields)) { $profilefieldname = "field{$profilefield['profilefieldid']}"; if ($profilefield['editable'] == 2 and !empty($vbulletin->userinfo["{$profilefieldname}"])) { continue; } if ($formtype == 1 and in_array($profilefield['type'], array('select', 'select_multiple'))) { $show['optionspage'] = true; } else { $show['optionspage'] = false; } if (($profilefield['required'] == 1 or $profilefield['required'] == 3) and $profilefield['form'] == 0) { exec_switch_bg(1); } else { exec_switch_bg($profilefield['form']); } $tempcustom = fetch_profilefield($profilefield); // now add the HTML to the completed lists if (($profilefield['required'] == 1 or $profilefield['required'] == 3) and $profilefield['form'] == 0) { $customfields['required'] .= $tempcustom; } else { if ($profilefield['form'] == 0) { $customfields['regular'] .= $tempcustom; } else { switch ($profilefield['form']) { case 1: $customfields['login'] .= $tempcustom; break; case 2: $customfields['messaging'] .= $tempcustom; break; case 3: $customfields['threadview'] .= $tempcustom; break; case 4: $customfields['datetime'] .= $tempcustom; break; case 5: $customfields['other'] .= $tempcustom; break; default: ($hook = vBulletinHook::fetch_hook('profile_fetch_profilefields_loc')) ? eval($hook) : false; } } } } }
if (!$vbulletin->userinfo['userid']) { print_no_permission(); } $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml'); $xml->add_group('response'); if ($profilefield = $db->query_first("SELECT profilefield.* FROM " . TABLE_PREFIX . "profilefield AS profilefield WHERE profilefieldid = " . $vbulletin->GPC['fieldid'])) { if ($profilefield['editable'] == 1 OR ($profilefield['editable'] == 2 AND empty($vbulletin->userinfo["field$profilefield[profilefieldid]"]))) { $profilefield_template = fetch_profilefield($profilefield, 'memberinfo_customfield_edit'); $xml->add_tag('template', process_replacement_vars($profilefield_template)); } else { $xml->add_tag('error', fetch_error('profile_field_uneditable')); $xml->add_tag('uneditable', '1'); } } else { // we want this person to refresh the page, so just throw a no perm error print_no_permission(); } $xml->close_group();
/** * Fetches the Profile Fields for a User input form * * @param integer Forum Type: 0 indicates a profile field, 1 indicates an option field * */ function fetch_profilefields($formtype = 0) // 0 indicates a profile field, 1 indicates an option field { global $vbulletin, $customfields, $bgclass, $show; global $vbphrase, $altbgclass, $bgclass1, $tempclass; // get extra profile fields $profilefields = $vbulletin->db->query_read_slave(" SELECT * FROM " . TABLE_PREFIX . "profilefield WHERE editable IN (1,2) AND form " . iif($formtype, '>= 1', '= 0'). " ORDER BY displayorder "); while ($profilefield = $vbulletin->db->fetch_array($profilefields)) { $profilefieldname = "field$profilefield[profilefieldid]"; if ($profilefield['editable'] == 2 AND !empty($vbulletin->userinfo["$profilefieldname"])) { continue; } if ($formtype == 1 AND in_array($profilefield['type'], array('select', 'select_multiple'))) { $show['optionspage'] = true; } else { $show['optionspage'] = false; } if (($profilefield['required'] == 1 OR $profilefield['required'] == 3) AND $profilefield['form'] == 0) // Ignore the required setting for fields on the options page { exec_switch_bg(1); } else { exec_switch_bg($profilefield['form']); } $tempcustom = fetch_profilefield($profilefield); // now add the HTML to the completed lists if (($profilefield['required'] == 1 OR $profilefield['required'] == 3) AND $profilefield['form'] == 0) // Ignore the required setting for fields on the options page { $customfields['required'] .= $tempcustom; } else { if ($profilefield['form'] == 0) { $customfields['regular'] .= $tempcustom; } else // not implemented { switch ($profilefield['form']) { case 1: $customfields['login'] .= $tempcustom; break; case 2: $customfields['messaging'] .= $tempcustom; break; case 3: $customfields['threadview'] .= $tempcustom; break; case 4: $customfields['datetime'] .= $tempcustom; break; case 5: $customfields['other'] .= $tempcustom; break; default: ($hook = vBulletinHook::fetch_hook('profile_fetch_profilefields_loc')) ? eval($hook) : false; } } } } }