Welcome Guest, Not a member yet? Register   Sign In
Codeigniter remove follow button after following user
#1

Hi I am able to display users friends on a page but when I into the friends profile I still see the follow button, is there anyway I can remove the button after following? I am using codeigniter. see code.
Model:

Code:
public function get_friends($user_id = NULL){
   if ($user_id = $this->session->userdata('user_id')){
   $this->db->select('*');
   $this->db->from('users');
   $this->db->join('friends', 'friends.user_id = users.user_id');
   $this->db->where('friends.user_id2', $user_id);
   $query = $this->db->get();
   return $query->result_array($user_id);
       }
}


Controller


Hi I am able to display users friends on a page but when I into the friends profile I still see the follow button, is there anyway I can remove the button after following? I am using codeigniter. see code.
Model


Code:
public function get_friends($user_id = NULL){
   if ($user_id = $this->session->userdata('user_id')){
   $this->db->select('*');
   $this->db->from('users');
   $this->db->join('friends', 'friends.user_id = users.user_id');
   $this->db->where('friends.user_id2', $user_id);
   $query = $this->db->get();
   return $query->result_array($user_id);
       }
}


Controller


Code:
public function view($user_id = NULL){
   $data['friends'] = $this->Friend_model->get_friends($user_id);  
   $this->load->view('user/templates/header_view_subpage');
   $this->load->view('user/members_entry_view', $data);
   $this->load->view('user/templates/footer_view_subpage');

}

View



Code:
<?php
    $session = $this->session->userdata('user_id');
    $friends = $this->session->userdata('user_id2');
    if($session == $members['user_id']):
?>
   <div class="col-md-6">
   <button type="button" class="btn btn-primary btn-sm btn-block"><i class="fa fa-envelope"></i> Send Message</button>
   </div>
 <div class="col-md-6">
[color=#242729][size=small][font=Monaco, Consolas, Courier, monospace]    <button type="button" class="btn btn-primary btn-sm btn-block"><i class="fa fa-add"></i> Follow</button>[/font][/size][/color]
   </div>
<?php
endif;
?>


Attached Files Thumbnail(s)
   
Reply


Messages In This Thread
Codeigniter remove follow button after following user - by eddykay_101 - 08-07-2017, 04:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB