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 +++++++++++ views/users/settings.html.php | 83 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 views/users/settings.html.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, diff --git a/views/users/settings.html.php b/views/users/settings.html.php new file mode 100644 index 0000000..6f65786 --- /dev/null +++ b/views/users/settings.html.php @@ -0,0 +1,83 @@ +

Settings

+ +
Name
Name)): ?>
Set
+
+
+
Your real name
Name) ? $user->Name : "Not Set"; ?>
+
+
+
Username
Change
+
+
+
How you're known on the site
username ?>
+
+
+
E-Mail Address
Change
+
+
+
The Address we'll contact you at
email) ? $user->email : "Not Set"; ?>
+
+
+
Password
Change
+
+
+
The password you login with
+
+
+ + +form->create($user->settings); ?> +
Privacy Mode
+
+
+
Only allow friends to see your posts?
form->checkbox('private'); ?>
+
+ form->submit('Save Settings'); ?> +form->end(); ?> +
+
+ +
Linked Accounts
Change
+
+
+
Your OpenID
Not Set
+
+
+ + + + + + + + + + +
+
+
+
+
\ No newline at end of file -- cgit v1.2.3