public function recentComments($count = 3) { $criteria = new CDbCriteria(); $criteria->condition = 'id = ' . $this->id; $criteria->order = 'createtime DESC'; $criteria->limit = $count; return YumProfileComment::model()->findAll($criteria); }
public function actionDelete($id) { $comment = YumProfileComment::model()->findByPk($id); if ($comment->user_id == Yii::app()->user->id || $comment->profile_id == Yii::app()->user->id) { $comment->delete(); $this->redirect(array(Yum::module('profile')->profileView, 'id' => $comment->profile->user_id)); } else { throw new CHttpException(403, Yum::t('You are not the owner of this Comment or this Profile!')); } }