method add documentation in bbn\User\Manager
Creates a new user and returns its configuration (with the new ID)
function(array $cfg)
{
$u =& $this->class_cfg['arch']['users'];
$fields = array_unique(array_values($u));
$cfg[$u['active']] = 1;
$cfg[$u['cfg']] = new stdClass();
foreach ($cfg as $k => $v){
if (!\in_array($k, $fields)) {
$cfg[$u['cfg']]->$k = $v;
unset($cfg[$k]);
}
}
$cfg[$u['cfg']] = json_encode($cfg[$u['cfg']]);
if (isset($cfg['id'])) {
unset($cfg['id']);
}
if (!empty($cfg[$u['id_group']])) {
$group = $this->getGroupType($cfg[$u['id_group']]);
switch ($group) {
case 'real':
if (bbn\Str::isEmail($cfg[$u['email']])
&& $this->db->insert($this->class_cfg['tables']['users'], $cfg)
) {
$cfg[$u['id']] = $this->db->lastId();
// Envoi d'un lien
if (!empty($this->class_cfg['arch']['hotlinks'])) {
$this->makeHotlink($cfg[$this->class_cfg['arch']['users']['id']], 'creation');
}
return $cfg;
}
break;
case 'api':
$cfg[$u['email']] = null;
$cfg[$u['login']] = null;
if ($this->db->insert($this->class_cfg['tables']['users'], $cfg)) {
$cfg[$u['id']] = $this->db->lastId();
return $cfg;
}
break;
}
}
return null;
}
Creates a new user and returns its configuration (with the new ID) BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2025
BBN Solutions