Improve user creation form to automatically add project member and enable notifications
This commit is contained in:
@@ -69,7 +69,6 @@ class User extends Base
|
||||
$this->response->html(
|
||||
$this->template->layout('user/index', array(
|
||||
'board_selector' => $this->projectPermission->getAllowedProjects($this->userSession->getId()),
|
||||
'projects' => $this->project->getList(),
|
||||
'title' => t('Users').' ('.$paginator->getTotal().')',
|
||||
'paginator' => $paginator,
|
||||
)));
|
||||
@@ -105,14 +104,19 @@ class User extends Base
|
||||
|
||||
if ($valid) {
|
||||
|
||||
$project_id = empty($values['project_id']) ? 0 : $values['project_id'];
|
||||
unset($values['project_id']);
|
||||
|
||||
$user_id = $this->user->create($values);
|
||||
|
||||
if ($user_id !== false) {
|
||||
$this->projectPermission->addMember($project_id, $user_id);
|
||||
$this->session->flash(t('User created successfully.'));
|
||||
$this->response->redirect($this->helper->url->to('user', 'show', array('user_id' => $user_id)));
|
||||
}
|
||||
else {
|
||||
$this->session->flashError(t('Unable to create your user.'));
|
||||
$values['project_id'] = $project_id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +132,6 @@ class User extends Base
|
||||
{
|
||||
$user = $this->getUser();
|
||||
$this->response->html($this->layout('user/show', array(
|
||||
'projects' => $this->projectPermission->getAllowedProjects($user['id']),
|
||||
'user' => $user,
|
||||
'timezones' => $this->config->getTimezones(true),
|
||||
'languages' => $this->config->getLanguages(true),
|
||||
@@ -230,7 +233,7 @@ class User extends Base
|
||||
}
|
||||
|
||||
$this->response->html($this->layout('user/notifications', array(
|
||||
'projects' => $this->projectPermission->getAllowedProjects($user['id']),
|
||||
'projects' => $this->projectPermission->getMemberProjects($user['id']),
|
||||
'notifications' => $this->notification->readSettings($user['id']),
|
||||
'user' => $user,
|
||||
)));
|
||||
|
||||
Reference in New Issue
Block a user