mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 20:57:26 +02:00
User extended fields validation working again on signup
This commit is contained in:
@@ -281,12 +281,14 @@ class e107_user_extended
|
|||||||
global $tp;
|
global $tp;
|
||||||
$eufVals = array(); // 'Answer' array
|
$eufVals = array(); // 'Answer' array
|
||||||
$hideFlags = array();
|
$hideFlags = array();
|
||||||
|
|
||||||
foreach ($this->fieldDefinitions as $k => $defs)
|
foreach ($this->fieldDefinitions as $k => $defs)
|
||||||
{
|
{
|
||||||
$category = $defs['user_extended_struct_parent'];
|
$category = $defs['user_extended_struct_parent'];
|
||||||
if (($category == 0) || (check_class($this->catDefinitions[$category]['user_extended_struct_applicable']) && check_class($this->catDefinitions[$category]['user_extended_struct_write'])))
|
if (($category == 0) || ($isSignup && (int) $this->catDefinitions[$category]['user_extended_struct_applicable'] === (int) e_UC_MEMBER && (int) $this->catDefinitions[$category]['user_extended_struct_write'] === (int) e_UC_MEMBER) || (check_class($this->catDefinitions[$category]['user_extended_struct_applicable']) && check_class($this->catDefinitions[$category]['user_extended_struct_write'])))
|
||||||
{ // Category applicable to user
|
{ // Category applicable to user
|
||||||
if (check_class($defs['user_extended_struct_applicable']) && check_class($defs['user_extended_struct_write']))
|
|
||||||
|
if (($isSignup && (int) $defs['user_extended_struct_applicable'] === (int) e_UC_MEMBER && (int) $defs['user_extended_struct_write'] === (int) e_UC_MEMBER) || (check_class($defs['user_extended_struct_applicable']) && check_class($defs['user_extended_struct_write'])))
|
||||||
{ // User can also update field
|
{ // User can also update field
|
||||||
$f = 'user_'.$defs['user_extended_struct_name'];
|
$f = 'user_'.$defs['user_extended_struct_name'];
|
||||||
if (isset($inArray[$f]) || ($isSignup && ($defs['user_extended_struct_required'] == 1)))
|
if (isset($inArray[$f]) || ($isSignup && ($defs['user_extended_struct_required'] == 1)))
|
||||||
@@ -295,7 +297,7 @@ class e107_user_extended
|
|||||||
$err = $this->user_extended_validate_entry($val, $defs);
|
$err = $this->user_extended_validate_entry($val, $defs);
|
||||||
if ($err === true)
|
if ($err === true)
|
||||||
{ // General error - usually empty field; could be unacceptable value, or regex fail and no error message defined
|
{ // General error - usually empty field; could be unacceptable value, or regex fail and no error message defined
|
||||||
$eufVals['errortext'][$f] = str_replace('--SOMETHING--',$tp->toHtml($defs['user_extended_struct_text'],FALSE,'defs'),LAN_USER_75);
|
$eufVals['errortext'][$f] = str_replace('--SOMETHING--',$tp->toHtml(defset($defs['user_extended_struct_text'], $defs['user_extended_struct_text']),FALSE,'defs'),LAN_USER_75);
|
||||||
$eufVals['errors'][$f] = ERR_GENERIC;
|
$eufVals['errors'][$f] = ERR_GENERIC;
|
||||||
}
|
}
|
||||||
elseif ($err)
|
elseif ($err)
|
||||||
|
@@ -1376,6 +1376,10 @@ class validatorClass
|
|||||||
{
|
{
|
||||||
$curLine = str_replace('%t', constant($constPrefix.$n), $curLine); // Standard messages
|
$curLine = str_replace('%t', constant($constPrefix.$n), $curLine); // Standard messages
|
||||||
}
|
}
|
||||||
|
if(empty($vars['failed'][$f]))
|
||||||
|
{
|
||||||
|
$vars['failed'][$f] = LAN_VALIDATE_191;
|
||||||
|
}
|
||||||
$curLine = str_replace('%v', htmlentities($vars['failed'][$f]),$curLine);
|
$curLine = str_replace('%v', htmlentities($vars['failed'][$f]),$curLine);
|
||||||
$curLine = str_replace('%f', $f, $curLine);
|
$curLine = str_replace('%f', $f, $curLine);
|
||||||
if ($checkNice & isset($niceNames[$f]['niceName']))
|
if ($checkNice & isset($niceNames[$f]['niceName']))
|
||||||
|
@@ -468,9 +468,9 @@ if (isset($_POST['register']))
|
|||||||
|
|
||||||
// Validate Extended User Fields.
|
// Validate Extended User Fields.
|
||||||
$eufVals = array();
|
$eufVals = array();
|
||||||
if (isset($_POST['ue']))
|
//if (isset($_POST['ue']))
|
||||||
{
|
{
|
||||||
$eufVals = $usere->userExtendedValidateAll($_POST['ue'], varset($_POST['hide'],array()), TRUE); // Validate the extended user fields
|
$eufVals = $usere->userExtendedValidateAll(varset($_POST['ue'], array()), varset($_POST['hide'],array()), TRUE); // Validate the extended user fields
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -490,10 +490,11 @@ if (isset($_POST['register']))
|
|||||||
{
|
{
|
||||||
$temp[] = validatorClass::makeErrorList($allData,'USER_ERR_','%n - %x - %t: %v', '<br />', $userMethods->userVettingInfo);
|
$temp[] = validatorClass::makeErrorList($allData,'USER_ERR_','%n - %x - %t: %v', '<br />', $userMethods->userVettingInfo);
|
||||||
}
|
}
|
||||||
if (varsettrue($eufData['errors']))
|
if (varsettrue($eufVals['errors']))
|
||||||
{
|
{
|
||||||
$temp[] = validatorClass::makeErrorList($eufData,'USER_ERR_','%n - %x - %t: %v', '<br />', $userMethods->userVettingInfo);
|
$temp[] = validatorClass::makeErrorList($eufVals,'USER_ERR_','%n - %t: %v', '<br />');
|
||||||
}
|
}
|
||||||
|
|
||||||
message_handler('P_ALERT', implode('<br />', $temp));
|
message_handler('P_ALERT', implode('<br />', $temp));
|
||||||
}
|
}
|
||||||
} // End of data validation
|
} // End of data validation
|
||||||
|
Reference in New Issue
Block a user