User Activity Tracking In Yii

Hi! … i need to create a functionality in which each and every user activity can be tracked and can be stored into the database. Please let me know if there is any default functionality available in Yii for this task…

I don’t have a development machine at hand right now, so the below is from the top of my head.

One solution could be to implement the beforeAction() or afterAction() methods in the base controller (protected/controllers/Controller.php) The controller has some properties that might be useful for tracking what page the user navigated to and what parameters where supplied. So in (pseudo)code it would look something like this in its basic form:




// protected/controllers/Controller/php


public function beforeAction($action)

{

    $target = $action->controller->uniqueId . '/' . $action->id;

    // for a blog module, listing all comments, $target could look like:

    // blog/comments/index


    $params = $action->controller->actionParams;

    // returns $_GET by default, see controller documentation for more details


    // Log $target and $params to database.


    return true;  // Important. If false, the action will not be executed.

}



hi

user activity is best method is aftersave.i have use in aftersave method is working fine.in this method using very simple.refer this link is very useful http://www.yiiframework.com/forum/index.php/topic/24530-issues-related-to-aftersave-method/