1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

Unusual default user_class behavior. Extra checks added.

This commit is contained in:
Cameron
2015-05-21 19:19:36 -07:00
parent 00bb2e2481
commit bc48a7efa5

View File

@@ -537,7 +537,7 @@ class UserHandler
{ {
if ($incInherited) if ($incInherited)
{ {
$classList = e107::getUserClass()->get_all_user_classes($var['user_class']); $classList = e107::getUserClass()->get_all_user_classes($userData['user_class']);
} }
else else
{ {
@@ -760,51 +760,57 @@ Following fields auto-filled in code as required:
$tp = e107::getParser(); $tp = e107::getParser();
$initClasses = array(); $initClasses = array();
$doClasses = FALSE; $doClasses = false;
$doProbation = FALSE; $doProbation = false;
$ret = FALSE; $ret = false;
switch ($event) switch($event)
{ {
case 'userall': case 'userall':
$doClasses = TRUE; $doClasses = true;
$doProbation = TRUE; $doProbation = true;
break; break;
case 'userfull': case 'userfull':
if (!$pref['user_reg_veri'] || ($pref['init_class_stage'] == '2')) if(!$pref['user_reg_veri'] || (intval($pref['init_class_stage']) == 2))
{ {
$doClasses = TRUE; $doClasses = true;
} }
$doProbation = TRUE; $doProbation = true;
break; break;
case 'userpartial' : case 'userpartial' :
if ($pref['init_class_stage'] == '1') if(intval($pref['init_class_stage']) === 1)
{ {
// Set initial classes if to be done on partial signup, or if selected to add them now // Set initial classes if to be done on partial signup, or if selected to add them now
$doClasses = TRUE; $doClasses = true;
} }
$doProbation = TRUE; $doProbation = true;
break; break;
} }
if($doClasses) if($doClasses)
{ {
if (isset($pref['initial_user_classes'])) { $initClasses = explode(',',$pref['initial_user_classes']); } // Any initial user classes to be set at some stage if(isset($pref['initial_user_classes'])) // Any initial user classes to be set at some stage
if ($doProbation && (varset($pref['user_new_period'], 0) > 0))
{ {
$initClasses[] = e_UC_NEWUSER; // Probationary user class $initClasses = explode(',', $pref['initial_user_classes']);
} }
if (count($initClasses)) if($doProbation && (varset($pref['user_new_period'], 0) > 0))
{ // Update the user classes {
if ($user['user_class']) $initClasses[] = e_UC_NEWUSER; // Probationary user class
}
if(count($initClasses))
{ // Update the user classes
if($user['user_class'])
{ {
$initClasses = array_unique(array_merge($initClasses, explode(',',$user['user_class']))); $initClasses = array_unique(array_merge($initClasses, explode(',', $user['user_class'])));
} }
$user['user_class'] = $tp->toDB(implode(',',$initClasses)); $user['user_class'] = $tp->toDB(implode(',', $initClasses));
//$ret = TRUE; //$ret = TRUE;
$ret = $user['user_class']; $ret = $user['user_class'];
} }
} }
return $ret; return $ret;
} }