From b099b7e6f2eda9b34177b9b08a8e668afcbf018c Mon Sep 17 00:00:00 2001 From: Michael Francis Date: Fri, 1 Jul 2011 01:02:34 -0400 Subject: Implemented friend requests in the backend --- controllers/UsersController.php | 16 ++++++++++++---- 1 file 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'); } -- cgit v1.2.3