mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-22 07:52:29 +03:00
Fixed the validate_username model method.
This commit is contained in:
parent
9655feca6c
commit
0631dbadf9
3 changed files with 23 additions and 11 deletions
|
@ -156,12 +156,14 @@ class Admins_model extends EA_Model {
|
|||
*/
|
||||
public function validate_username($username, $user_id)
|
||||
{
|
||||
$num_rows = $this->db->get_where('user_settings', [
|
||||
'username' => $username,
|
||||
'id_users !=' => $user_id
|
||||
])->num_rows();
|
||||
if ( ! empty($user_id))
|
||||
{
|
||||
$this->db->where('id_users !=', $user_id);
|
||||
}
|
||||
|
||||
return $num_rows > 0 ? FALSE : TRUE;
|
||||
$this->db->where('username', $username);
|
||||
|
||||
return $this->db->get('user_settings')->num_rows() === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -187,9 +187,14 @@ class Providers_model extends EA_Model {
|
|||
*/
|
||||
public function validate_username($username, $user_id)
|
||||
{
|
||||
$num_rows = $this->db->get_where('user_settings',
|
||||
['username' => $username, 'id_users != ' => $user_id])->num_rows();
|
||||
return $num_rows > 0 ? FALSE : TRUE;
|
||||
if ( ! empty($user_id))
|
||||
{
|
||||
$this->db->where('id_users !=', $user_id);
|
||||
}
|
||||
|
||||
$this->db->where('username', $username);
|
||||
|
||||
return $this->db->get('user_settings')->num_rows() === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -164,9 +164,14 @@ class Secretaries_model extends EA_Model {
|
|||
*/
|
||||
public function validate_username($username, $user_id)
|
||||
{
|
||||
$num_rows = $this->db->get_where('user_settings',
|
||||
['username' => $username, 'id_users != ' => $user_id])->num_rows();
|
||||
return $num_rows > 0 ? FALSE : TRUE;
|
||||
if ( ! empty($user_id))
|
||||
{
|
||||
$this->db->where('id_users !=', $user_id);
|
||||
}
|
||||
|
||||
$this->db->where('username', $username);
|
||||
|
||||
return $this->db->get('user_settings')->num_rows() === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue