mirror of
https://github.com/e107inc/e107.git
synced 2025-04-22 13:41:52 +02:00
#580 - Initial userclasses are now set after signing up (and after email activation)
This commit is contained in:
parent
8f0f9027a5
commit
f912c88a80
@ -708,7 +708,7 @@ Following fields auto-filled in code as required:
|
||||
*
|
||||
* @return boolean - true if $user['user_class'] updated, false otherwise
|
||||
*/
|
||||
public function userClassUpdate(&$user, $event='userveri')
|
||||
public function userClassUpdate($user, $event='userfull')
|
||||
{
|
||||
$pref = e107::getPref();
|
||||
$tp = e107::getParser();
|
||||
@ -717,34 +717,37 @@ Following fields auto-filled in code as required:
|
||||
$doClasses = FALSE;
|
||||
$doProbation = FALSE;
|
||||
$ret = FALSE;
|
||||
|
||||
switch ($event)
|
||||
{
|
||||
case 'userall' :
|
||||
case 'userall':
|
||||
$doClasses = TRUE;
|
||||
$doProbation = TRUE;
|
||||
break;
|
||||
case 'userfull' : // A 'fully fledged' user
|
||||
case 'userfull':
|
||||
if (!$pref['user_reg_veri'] || ($pref['init_class_stage'] == '2'))
|
||||
{
|
||||
$doClasses = TRUE;
|
||||
$doClasses = TRUE;
|
||||
}
|
||||
$doProbation = TRUE;
|
||||
break;
|
||||
case 'userpartial' :
|
||||
if ($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;
|
||||
}
|
||||
$doProbation = TRUE;
|
||||
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 ($doProbation && (varset($pref['user_new_period'], 0) > 0))
|
||||
{
|
||||
$initClasses[] = e_UC_NEWUSER; // Probationary user class
|
||||
}
|
||||
|
||||
if (count($initClasses))
|
||||
{ // Update the user classes
|
||||
if ($user['user_class'])
|
||||
@ -752,7 +755,8 @@ Following fields auto-filled in code as required:
|
||||
$initClasses = array_unique(array_merge($initClasses, explode(',',$user['user_class'])));
|
||||
}
|
||||
$user['user_class'] = $tp->toDB(implode(',',$initClasses));
|
||||
$ret = TRUE;
|
||||
//$ret = TRUE;
|
||||
$ret = $user['user_class'];
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
|
28
signup.php
28
signup.php
@ -326,11 +326,12 @@ if (e_QUERY)
|
||||
$dbData['WHERE'] = " user_sess='".$tp->toDB($qs[2], true)."' ";
|
||||
$dbData['data'] = array('user_ban'=>'0', 'user_sess'=>'');
|
||||
|
||||
|
||||
// Set initial classes, and any which the user can opt to join
|
||||
if ($userMethods->userClassUpdate($row, 'userveri'))
|
||||
if ($init_class = $userMethods->userClassUpdate($row, 'userfull'))
|
||||
{
|
||||
$dbData['data']['user_class'] = $row['user_class'];
|
||||
|
||||
//print_a($init_class); exit;
|
||||
$dbData['data']['user_class'] = $init_class;
|
||||
}
|
||||
|
||||
$userMethods->addNonDefaulted($dbData);
|
||||
@ -674,11 +675,12 @@ if (isset($_POST['register']) && $pref['user_reg'] == 1)
|
||||
require_once(FOOTERF);
|
||||
exit;
|
||||
}
|
||||
// User can be signed up immediately
|
||||
else
|
||||
{ // User can be signed up immediately
|
||||
{
|
||||
require_once(HEADERF);
|
||||
|
||||
if(!$sql->db_Select("user", "user_id", "user_loginname='".$allData['data']['user_loginname']."' AND user_password='".$allData['data']['user_password']."'"))
|
||||
if(!$sql->select("user", "user_id", "user_loginname='".$allData['data']['user_loginname']."' AND user_password='".$allData['data']['user_password']."'"))
|
||||
{
|
||||
// Error looking up newly created user
|
||||
$ns->tablerender("", LAN_SIGNUP_36);
|
||||
@ -686,6 +688,22 @@ if (isset($_POST['register']) && $pref['user_reg'] == 1)
|
||||
exit;
|
||||
}
|
||||
|
||||
// Set initial classes, and any which the user can opt to join
|
||||
if ($init_class = $userMethods->userClassUpdate($row, 'userpartial'))
|
||||
{
|
||||
$allData['data']['user_class'] = $init_class;
|
||||
$user_class_update = $sql->update("user", "user_class = '{$allData['data']['user_class']}' WHERE user_name='{$allData['data']['user_name']}'");
|
||||
|
||||
if($user_class_update === FALSE)
|
||||
{
|
||||
//$admin_log->e_log_event(10,debug_backtrace(),'USER','Userclass update fail',print_r($row,TRUE),FALSE,LOG_TO_ROLLING);
|
||||
require_once(HEADERF);
|
||||
$ns->tablerender(LAN_SIGNUP_75, LAN_SIGNUP_101);
|
||||
require_once(FOOTERF);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
e107::getEvent()->trigger('usersup', $_POST); // send everything in the template, including extended fields.
|
||||
e107::getEvent()->trigger('userfull', array_merge($allData['data'],$eufVals['data'])); // New trigger - send everything in the template, including extended fields.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user