⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Show records based on UserID



dalston

dalston
  • profile picture
  • Member

Posted 16 April 2012 - 16:01 PM

Hello,

I've spent some time learning Codeigniter and got a hold of Ion Auth for user authentication. In my particular project I have two MySQL tables, one for users and one for events.

What I'd like to have happen is when a particular user successfully signs in, the events that this user created will be displayed with grocery crud.

What method(s) in grocery crud will help me accomplish this?

carlinchisart

carlinchisart
  • profile picture
  • Member

Posted 16 April 2012 - 16:05 PM

$crud->where('id',$id) this id can you take of Ion Auth function.

dalston

dalston
  • profile picture
  • Member

Posted 17 April 2012 - 01:46 AM

Thanks carlinchisart! So basically the code in my case would look like this:

$user = this->ion_auth->user()->row();
$crud->where('userId", $user->id);

carlinchisart

carlinchisart
  • profile picture
  • Member

Posted 17 April 2012 - 04:37 AM

I don't know Ion auth, but the library dx auth have one function that return the id of user, if this is the function in ion auth, is ok

remerber the firts parameter int where function of grocery is the name of field in the table, the second is the value.