diff options
Diffstat (limited to 'application')
-rw-r--r-- | application/controllers/user.php | 13 | ||||
-rw-r--r-- | application/views/header.php | 11 | ||||
-rw-r--r-- | application/views/user/profile.php | 3 |
3 files changed, 23 insertions, 4 deletions
diff --git a/application/controllers/user.php b/application/controllers/user.php index 42f9e35ae..f52e9c0b1 100644 --- a/application/controllers/user.php +++ b/application/controllers/user.php @@ -321,6 +321,10 @@ class User extends CI_Controller { { $this->muser->require_access(); + if ($this->input->post("process") !== false) { + $this->_save_profile(); + } + $this->data["profile_data"] = $this->muser->get_profile_data(); $this->load->view('header', $this->data); @@ -328,7 +332,7 @@ class User extends CI_Controller { $this->load->view('footer', $this->data); } - function save_profile() + private function _save_profile() { $this->muser->require_access(); @@ -373,7 +377,12 @@ class User extends CI_Controller { $this->muser->update_profile($data); } - redirect("user/profile"); + $this->data["alerts"][] = array( + "type" => "success", + "message" => "Changes saved", + ); + + return true; } function logout() diff --git a/application/views/header.php b/application/views/header.php index 7ed605bf3..deafa1ef5 100644 --- a/application/views/header.php +++ b/application/views/header.php @@ -71,3 +71,14 @@ if (is_cli_client() && !isset($force_full_html)) { </div> <div class="container"> + <?php + if (isset($alerts)) { + foreach ($alerts as $alert) { ?> + <div class="alert alert-block alert-<?php echo $alert["type"]; ?>" style="text-align: center"> + <button type="button" class="close" data-dismiss="alert">×</button> + <?php echo $alert["message"]; ?> + </div> + <?php + } + } + ?> diff --git a/application/views/user/profile.php b/application/views/user/profile.php index b11231f29..bcd740612 100644 --- a/application/views/user/profile.php +++ b/application/views/user/profile.php @@ -1,4 +1,4 @@ -<?php echo form_open("user/save_profile", array("class" => "form-horizontal")); ?> +<?php echo form_open("user/profile", array("class" => "form-horizontal")); ?> <div class="control-group"> <label class="control-label" for="inputUsername">Username</label> @@ -29,5 +29,4 @@ <button type="submit" class="btn btn-primary" name="process">Save changes</button> </div> </div> - </form> |