44 lines
1.2 KiB
PHP
Executable File

<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class User_model extends CI_model {
function __construct() {
parent::__construct();
$this->load->database();
}
function update_profile_pic($ion_user_id,$file_url){
$this->db->where('id', $ion_user_id);
if ($this->db->update('users', array('profile_pic'=>$file_url))) {
return true;
} else {
return false;
}
}
function get_profile_pic($ion_user_id){
$this->db->where('id',$ion_user_id);
$this->db->select('profile_pic');
$result=$this->db->get('users')->row();
return $result;
}
function getUserIdentity($identity){
$this->db->select('*')->from('users as us');
$this->db->join('users_groups as usg', 'us.id = usg.user_id');
$this->db->where('us.email', $identity);
$this->db->or_where("us.username",$identity);
$users = $this->db->get();
$data['ion_user_id']=$users->row()->id;
$data['ion_id'] = $users->row()->user_id;
$data['Ionemail'] = $users->row()->email;
$data['user_type'] = $users->row()->group_id;
$data['profile_pic'] = $users->row()->profile_pic;
return $data;
}
}