From b36745e2187bf369d135fc787d252c531b97664d Mon Sep 17 00:00:00 2001 From: Michael Francis Date: Mon, 20 Jun 2011 19:02:01 -0400 Subject: Settings page for users --- controllers/UsersController.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'controllers/UsersController.php') diff --git a/controllers/UsersController.php b/controllers/UsersController.php index c168066..8ee5079 100644 --- a/controllers/UsersController.php +++ b/controllers/UsersController.php @@ -374,6 +374,28 @@ class UsersController extends \lithium\action\Controller { } } + public function settings() + { + //Get the user using their login information (from auth) + $user = Auth::check('default'); + $user = User::find($user['_id']); + + //If the request isn't empty + if(!empty($this->request->data)) { + //Foreach key/value pair in the request data + foreach($this->request->data as $key => $value) + { + //TODO: Make sure to lock the schema to prevent wierd values + $user->$key = $value; + } + + //Save the user. + $user->save(null, array('validate' => false)); + } + + return compact('user'); + } + public function requestFriend($username) { //If the user isn't blocking this user, -- cgit v1.2.3