diff options
Diffstat (limited to 'src/web/_model/apps/profile.php')
-rw-r--r-- | src/web/_model/apps/profile.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/web/_model/apps/profile.php b/src/web/_model/apps/profile.php index 592fbcb..97b0150 100644 --- a/src/web/_model/apps/profile.php +++ b/src/web/_model/apps/profile.php @@ -29,8 +29,36 @@ class Profile_model extends Model { return NULL; } + $following = FALSE; + $followed = FALSE; + $follow_id = NULL; + + if ($this->main->session) { + $sid = $this->main->user()['id']; + $res = $this->db->select('f.value, f.id') + ->from('admin.follow f') + ->where('f.follower_id') + ->eq($sid) + ->where('f.followee_id') + ->eq($uid) + ->row(); + $following = $res ? $res['value'] : FALSE; + $follow_id = $res ? $res['id'] : NULL; + $res = $this->db->select('f.value') + ->from('admin.follow f') + ->where('f.follower_id') + ->eq($uid) + ->where('f.followee_id') + ->eq($sid) + ->row(); + $followed = $res ? $res['value'] : FALSE; + } + $data = parent::get_data(); $data['user'] = $user; + $data['following'] = $following; + $data['followed'] = $followed; + $data['follow_id'] = $follow_id; $data['title'] = lang('title', sub: [$user['first_name']]); return $data; } |