diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2010-01-24 15:27:33 -0800 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2010-01-24 15:27:33 -0800 |
commit | 7c06e21ec443a46bd78bc9e99d8284283ff85c59 (patch) | |
tree | f30063fc106eaace4a02c01a9c857924213f7eb9 /modules/comment/helpers | |
parent | 3b16d0662b8a4b06f4be72165c858a1231e9bd67 (diff) |
Refactor creating the user profile page content into the the event module. The show_user_profile is used to provide content to the user profile page. Add the list of the users comments to the profile page.
Diffstat (limited to 'modules/comment/helpers')
-rw-r--r-- | modules/comment/helpers/comment_event.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/comment/helpers/comment_event.php b/modules/comment/helpers/comment_event.php index bd336cda..12e8d73f 100644 --- a/modules/comment/helpers/comment_event.php +++ b/modules/comment/helpers/comment_event.php @@ -76,4 +76,16 @@ class comment_event_Core { $data[] = $row->text; } } + + static function show_user_profile($data) { + $view = new View("user_profile_comments.html"); + $view->comments = ORM::factory("comment") + ->order_by("created", "DESC") + ->where("state", "=", "published") + ->where("author_id", "=", $data->user->id) + ->find_all(); + if ($view->comments->count()) { + $data->content[] = (object)array("title" => t("Comments"), "view" => $view); + } + } } |