Change reference to session-field 'id' to 'user_id'
This commit is contained in:
@@ -14,7 +14,7 @@ class Project extends CI_Model {
|
||||
* @return array The user's projects.
|
||||
*/
|
||||
public function getOwn() {
|
||||
$query = $this->db->where(array('owner' => $this->session->user_data('id')))
|
||||
$query = $this->db->where(array('owner' => $this->session->user_data('user_id')))
|
||||
->order_by('lastaccess', 'desc')
|
||||
->get('projects');
|
||||
$projects = $query->result_array();
|
||||
@@ -38,7 +38,7 @@ class Project extends CI_Model {
|
||||
* @return array The shared projects.
|
||||
*/
|
||||
public function getShared() {
|
||||
$this->db->select('*')->from('shares')->order_by('lastaccess', 'desc')->where(array('user_id' => $this->session->user_data('id')));
|
||||
$this->db->select('*')->from('shares')->order_by('lastaccess', 'desc')->where(array('user_id' => $this->session->user_data('user_id')));
|
||||
$this->db->join('projects', 'projects.id = shares.project_id');
|
||||
$query = $this->db->get();
|
||||
|
||||
@@ -119,14 +119,14 @@ class Project extends CI_Model {
|
||||
$public_results = $query->result_array();
|
||||
|
||||
// or belong directly to the user
|
||||
$query = $this->db->query("SELECT * FROM `projects` WHERE `owner`=".$this->db->escape($this->session->userdata('id'))
|
||||
$query = $this->db->query("SELECT * FROM `projects` WHERE `owner`=".$this->db->escape($this->session->userdata('user_id'))
|
||||
." AND `name` LIKE ".$this->db->escape('%'.$needle.'%'));
|
||||
$own_results = $query->result_array();
|
||||
|
||||
|
||||
// get matching projects that are shared to the user
|
||||
$this->db->select('*')->from('shares')
|
||||
->where(array('user_id' => $this->session->userdata('id')))
|
||||
->where(array('user_id' => $this->session->userdata('user_id')))
|
||||
->like('name', $needle);
|
||||
$this->db->join('projects', 'projects.id = shares.project_id');
|
||||
$query = $this->db->get();
|
||||
|
||||
Reference in New Issue
Block a user