summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Francis <edude03@gmail.com>2011-07-01 01:02:34 -0400
committerMichael Francis <edude03@gmail.com>2011-07-01 01:02:34 -0400
commitb099b7e6f2eda9b34177b9b08a8e668afcbf018c (patch)
tree4cfd349ee0c464470b8a2662ab1354c89f5711ad
parent797d6ffc9fe17f18b79e0713b291904a0c44b035 (diff)
downloadotakuhub-b099b7e6f2eda9b34177b9b08a8e668afcbf018c.tar.xz
Implemented friend requests in the backend
-rw-r--r--controllers/UsersController.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/controllers/UsersController.php b/controllers/UsersController.php
index 3c57b2e..3991738 100644
--- a/controllers/UsersController.php
+++ b/controllers/UsersController.php
@@ -411,7 +411,11 @@ class UsersController extends \lithium\action\Controller {
return compact('user');
}
- public function requestFriend($username) {
+ public function requestFriend($username = null) {
+ if ($username == null)
+ {
+ $username = $this->request->query['username'];
+ }
//If the user isn't blocking this user,
//And the user doesn't have private set
@@ -419,10 +423,14 @@ class UsersController extends \lithium\action\Controller {
//Send them a DM with a confirm key
$key = confirmKey::create();
$thisUser = auth::check('default');
- $link = Html::link('here', "/users/confirmFriend/$this->username/$key->key");
- $post = Post::create(array('body' => "$thisUser->username want's to be your friend. Click $link to confirm"));
+ $url = \lithium\net\http\Router::match(array('controller' => 'users',
+ 'action' => 'confirmFriend',
+ 'args'=>array($thisUser['username'], $key->key)), null, array('absolute' => 'false'));
+ $post = Post::create(array('body' => $thisUser['username'] . " want's to be your friend. Click $url to confirm"));
+
+ $post->directMessage($thisUser);
- $post->directMessage($username);
+ return $this->redirect('users::feed');
}