diff options
-rw-r--r-- | controllers/UsersController.php | 16 |
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'); } |