diff options
Diffstat (limited to 'app/Controller/User.php')
-rw-r--r-- | app/Controller/User.php | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/app/Controller/User.php b/app/Controller/User.php index 1a7810b0..6628bcb6 100644 --- a/app/Controller/User.php +++ b/app/Controller/User.php @@ -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, ))); |