Permalink
Browse files

Removed SQL query from MY_Controller and replaced it with call to ->a…

…g_auth->get_user(); to conform to guides & misc changes.
  • Loading branch information...
1 parent c7cfb31 commit 7df4120c55e30e01113af5621f494ba384dd3727 @adamgriffiths committed Sep 21, 2011
Showing with 10 additions and 16 deletions.
  1. +2 −10 controllers/admin/users.php
  2. +6 −2 core/MY_Controller.php
  3. +2 −2 libraries/AG_Auth.php
  4. +0 −2 views/auth/pages/users/manage.php
@@ -19,7 +19,7 @@ public function manage()
foreach($result as $value => $key)
{
- $actions = anchor("admin/users/edit/".$key['id']."/", "Edit") . anchor("admin/users/delete/".$key['id']."/", "Delete"); // Build actions links
+ $actions = anchor("admin/users/delete/".$key['id']."/", "Delete"); // Build actions links
$this->table->add_row($key['username'], $key['email'], $actions); // Adding row to table
}
@@ -32,15 +32,7 @@ public function delete($id)
$this->ag_auth->view('users/delete_success');
}
- public function add()
- {
- $this->ag_auth->register(FALSE);
- }
-
- public function edit($id)
- {
- $this->ag_auth->register(FALSE, TRUE, $id);
- }
+ // WOKRING ON PROPER IMPLEMENTATION OF ADDING & EDITING USER ACCOUNTS
}
?>
View
@@ -30,9 +30,9 @@ public function field_exists($value)
{
$field_name = (valid_email($value) ? 'email' : 'username');
- $query = $this->db->get_where($this->config->item('auth_user_table'), array($field_name => $value));
+ $user = $this->ag_auth->get_user($value, $field_name);
- if($query->num_rows() <> 0)
+ if(array_key_exists('id', $user))
{
$this->form_validation->set_message('field_exists', 'The ' . $field_name . ' provided already exists, please use another.');
@@ -125,6 +125,10 @@ public function login($redirect = NULL)
} // login()
+ public function logout()
+ {
+ $this->ag_auth->logout();
+ }
}
/* End of file: MY_Controller.php */
View
@@ -181,8 +181,8 @@ public function login_user($user)
*/
public function logout()
{
- $this->session->sess_destroy();
- redirect($this->config->item('auth_logout'));
+ $this->CI->session->sess_destroy();
+ redirect($this->CI->config->item('auth_logout'));
}
@@ -1,5 +1,3 @@
<h2>Manage Users</h2>
-<h3><?php echo anchor($this->config->item('auth_controllers_root') . "users/add", "Add User"); ?></h3>
-
<?php echo $this->table->generate(); ?>

0 comments on commit 7df4120

Please sign in to comment.