Welcome Guest, Not a member yet? Register   Sign In
how update user data using ion_auth ?
#1

[eluser]Keloo[/eluser]
I'm trying update user data for each user using ion_auth update function and I just don't know how.

Here the controller

Code:
function user()
{
  if(!$this->ion_auth->logged_in())
  {
   redirect('home/index');
  }
  else
  {
  
   $this->db->where('username',$this->uri->segment(3));
   $this->data['users'] = $this->ion_auth->users()->result();

   $data = array(
    'first_name' => $this->input->post('first_name'),
    'last_name' => $this->input->post('last_name'),
    'email' => $this->input->post('email')

   );

   $id = $this->input->post('user_id');

   $this->ion_auth->update($id,$data);
   $this->layouts->view('user',$this->data);
  
  }

}

The view
Code:
<?php foreach($users as $user): ?>
<h2>Welcome &lt;?php echo $user->username; ?&gt; </h2>

User info

&lt;?php echo form_open('home/user/'.$user->username); ?&gt;

  <label >First name </label>
          &lt;input type="text" name="first_name" id="first_name" value="&lt;?=$user-&gt;first_name?&gt;" /&gt;
          &lt;?php echo form_error('first_name','<p class="error">','</p>'); ?&gt;
        
          <label for="first_name">Last name </label>
          &lt;input type="text" name="last_name" id="last_name"  value="&lt;?=$user-&gt;last_name?&gt;" /&gt;
          &lt;?php echo form_error('last_name','<p class="error">','</p>'); ?&gt;
                  
          <label for="email_address">Email </label>
          &lt;input type="email" name="email_address" id="email_address"  value="&lt;?=$user-&gt;email?&gt;"/&gt;
          &lt;?php echo form_error('email_address','<p class="error">','</p>'); ?&gt;

          &lt;input type="hidden" name="user_id" id="user_id"  value="&lt;?=$user-&gt;user_id?&gt;" /&gt;
    
    <p>&lt;?php echo form_submit('submit', 'Update');?&gt;</p>

&lt;?php endforeach;?&gt;

When I click update, it updates to 0. I can't figure out how to fix this issue.


Messages In This Thread
how update user data using ion_auth ? - by El Forum - 06-03-2012, 03:36 AM
how update user data using ion_auth ? - by El Forum - 06-03-2012, 05:09 AM
how update user data using ion_auth ? - by El Forum - 06-03-2012, 07:36 AM
how update user data using ion_auth ? - by El Forum - 06-03-2012, 08:02 AM
how update user data using ion_auth ? - by El Forum - 06-03-2012, 08:41 AM
how update user data using ion_auth ? - by El Forum - 06-03-2012, 09:09 AM
how update user data using ion_auth ? - by El Forum - 06-03-2012, 09:15 AM
how update user data using ion_auth ? - by El Forum - 06-03-2012, 09:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB