Yii Framework Forum: Filtering out posts by author - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Filtering out posts by author Rate Topic: -----

#1 User is offline   gorgekara 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 16-August 12

Posted 16 August 2012 - 06:58 AM

Hi, I'm new to yii and I would like to know how to filter posts shown on the front page by author when the author loggs in assuming the author logs in by email. So I would like to display posts like this:

Author Name:

1. Post 1
2. Post 2
0

#2 User is offline   kiran sharma 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 492
  • Joined: 21-May 11
  • Location:India

Posted 16 August 2012 - 07:19 AM

If you using Yii standerd to fetch Post data, so you can filter data by author id( i assume author identify by author_id )
// $authorId is identification of author

$model = PostModel::model()->findAll("author_id=$authorId");


now you got all Post created by particular author.
Thanks,
Kiran Sharma.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users