Use something like

$user_id = $this->Auth->User('id');

And if you have a function made where you get the posts / records pass the
$id off

$this->Model->getUsersInfo( $id);

Function getuserInfo ( $id ) {

$this->Model->find('all', conditions you need where User.id = $id);

So your only getting data related to the auth User.

Dave

-----Original Message-----
From: cakebaker [mailto:[email protected]] 
Sent: October-20-10 11:32 AM
To: CakePHP
Subject: Re: login page Redirection...

But how can i retrieve the results based on the user log in..
For example if A is login he must be redirected to a landing page
where he can see his own posts. not others
I can write a sql query select * from....where table.username =
'$username' but I am not sure how can i write this...
I am like a newbie in cake...
would you please help me..

On Oct 19, 11:32 am, Tilen Majerle <[email protected]> wrote:
> no, just make method in users controller called idk  eg "users_login" and
> use this for users login, and admin_login for admin logins with different
> redirection after successfull login :D
> --
> Tilen Majerlehttp://majerle.eu
>
> 2010/10/19 cakebaker <[email protected]>
>
> > Hi Tilen
> > Thanks for reply...
> > But Do NOT i need to have  a table called users_posts? and
> > controller,model,views for users_posts??
> > Where do i need to put users_posts?? posts model or controller??
> > thanks for help
>
> > On Oct 19, 6:34 am, Tilen Majerle <[email protected]> wrote:
> > > hmmm....make new method in posts section called idk
users_posts($userid =
> > > null)
>
> > > and then get posts from user id
> > > --
> > > Tilen Majerlehttp://majerle.eu
>
> > > 2010/10/18 cakebaker <[email protected]>
>
> > > > I am trying to learn and work on cakephp FW.
> > > > I have a DB with Posts blog.
> > > > I have implemented the ACL.
> > > > I have Admin and User groups.
> > > > When an Admin (some one belongs 2 admin grp) log in he needs to be
> > > > redirected to a page where he can see all posts(belongs to all
people)
> > > > This is working
> > > > I have implemented this with the following command in
> > > > users_controller.php:
> > > > function login() {
> > > > if($this->Auth->user('role')=='admin')
> > > > {
> > > > $this->redirect(array('controller'=>'posts','action' => 'index'));
> > > > }
> > > > BUT When a user (some 1 belongs to user grp - NOT ADMIN) log in he
> > > > needs to be redirected to see ( or redirect to posts page where he
can
> > > > see only his posts) ONLY his posts not others..
> > > > How can I implement this>???
>
> > > > Thanks
>
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> > others
> > > > with their CakePHP related questions.
>
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "CakePHP" group.
> > > > To post to this group, send email to [email protected]
> > > > To unsubscribe from this group, send email to
> > > >
[email protected]<cake-php%[email protected]
m>
> >
<cake-php%[email protected]<cake-php%252bunsubscr...@googlegrou
ps.com>>For
> > more options, visit this group at
> > > >http://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google
Groups
> > "CakePHP" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> >
[email protected]<cake-php%[email protected]
m>For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others
with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to