From 7016f468848fad6a1bb2829423a532323e1f548a Mon Sep 17 00:00:00 2001 From: Andy Smith Date: Fri, 19 Aug 2011 21:14:16 +0100 Subject: [PATCH] Profile edit now redirects back to profile, unless user is an admin --- application/controllers/user.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/application/controllers/user.php b/application/controllers/user.php index caf7826e..ac0b81b9 100644 --- a/application/controllers/user.php +++ b/application/controllers/user.php @@ -159,8 +159,13 @@ class User extends CI_Controller { break; // All okay, return to user screen case OK: - $this->session->set_flashdata('notice', 'User '.$this->input->post('user_name').' edited'); - redirect('user'); + if($this->session->userdata('user_id') == $this->input->post('id')) { + $this->session->set_flashdata('notice', 'User '.$this->input->post('user_name').' edited'); + redirect('user/profile'); + } else { + $this->session->set_flashdata('notice', 'User '.$this->input->post('user_name').' edited'); + redirect('user'); + } return; } $this->load->view('layout/header');