Show
Ignore:
Timestamp:
09/30/08 21:04:49 (5 years ago)
Author:
kenji
Message:

Add link to @username

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • events/phpframework/codeigniter/trunk/system/application/models/status_model.php

    r20302 r20309  
    154154        function get_last_comment($id) 
    155155        { 
    156                 $this->db->select('SQL_CALC_FOUND_ROWS statuses.comment'); 
     156                $this->db->select('SQL_CALC_FOUND_ROWS statuses.comment, username AS reply_username'); 
    157157                $this->db->from('statuses'); 
     158                $this->db->join('users AS u2', 'statuses.reply_user_id = u2.id', 'left'); 
    158159                $this->db->where('user_id', $id); 
    159                 $this->db->order_by('created_at', 'DESC'); 
     160                $this->db->order_by('statuses.created_at', 'DESC'); 
    160161                $this->db->limit(1, 0); 
    161162                $query = $this->db->get(); 
     
    180181        function get_comment($id) 
    181182        { 
    182                 $this->db->select('statuses.id, username, comment, UNIX_TIMESTAMP(statuses.created_at) AS created_at, image'); 
     183                $this->db->select('SQL_CALC_FOUND_ROWS statuses.id, u1.username AS username, comment, u2.username AS reply_username, UNIX_TIMESTAMP(statuses.created_at) AS created_at, u1.image AS image'); 
    183184                $this->db->from('statuses'); 
    184                 $this->db->join('users', 'statuses.user_id = users.id', 'left'); 
     185                $this->db->join('users AS u1', 'statuses.user_id = u1.id', 'left'); 
     186                $this->db->join('users AS u2', 'statuses.reply_user_id = u2.id', 'left'); 
    185187                $this->db->where('statuses.id', $id); 
    186188                $this->db->limit(1, 0);