diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2010-01-24 20:14:01 -0800 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2010-01-24 20:14:01 -0800 |
commit | 865995305cbd709db4f8587d73e7178a277a8d8b (patch) | |
tree | 1e607d0184f29bee7665df42df99b3a32cf2c2ff /modules/rest/helpers | |
parent | 26eb000637fb83c04919e1e18c67b1441db76da6 (diff) |
Add the active notifications and rest api key to user profile page.
Diffstat (limited to 'modules/rest/helpers')
-rw-r--r-- | modules/rest/helpers/rest_event.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/rest/helpers/rest_event.php b/modules/rest/helpers/rest_event.php index 860c8e41..f9aa34e3 100644 --- a/modules/rest/helpers/rest_event.php +++ b/modules/rest/helpers/rest_event.php @@ -74,4 +74,21 @@ class rest_event { ->class("g-form-static") ->label(t("Remote access key")); } + + static function show_user_profile($data) { + if ($data->display_all) { + $view = new View("user_profile_rest.html"); + $key = ORM::factory("user_access_token") + ->where("user_id", "=", $data->user->id) + ->find(); + + if (!$key->loaded()) { + $key->user_id = $data->user->id; + $key->access_key = md5($data->user->name . rand()); + $key->save(); + } + $view->rest_key = $key->access_key; + $data->content[] = (object)array("title" => t("Rest api"), "view" => $view); + } + } } |