summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--controllers/UsersController.php42
1 files changed, 5 insertions, 37 deletions
diff --git a/controllers/UsersController.php b/controllers/UsersController.php
index 23cad20..d272d4f 100644
--- a/controllers/UsersController.php
+++ b/controllers/UsersController.php
@@ -13,7 +13,6 @@ use li3_flash_message\extensions\storage\FlashMessage;
use lithium\template\helper\Html;
class UsersController extends \lithium\action\Controller {
- public $secret = "marshmallows"; //I don't know why either?
//Make login a public action.
public $publicActions = array('login', 'logout', 'signup', 'confirm');
@@ -113,12 +112,11 @@ class UsersController extends \lithium\action\Controller {
{
$status = true;
- return array('sucseeded' => true, 'message' => 'You are now following $username');
+ return array('succeeded' => true, 'message' => 'You are now following $username');
}
}
}
}
-
/**
* Calls the user to addFriend method, then returns the status.
* @param username The name of the user to add as a friend
@@ -183,42 +181,12 @@ class UsersController extends \lithium\action\Controller {
{
//Get the currently logged in user
$user = Auth::check('default');
-
- //If there is a user logged in (There should be since feed isn't a public function)
- if ($user)
- {
- //Get that user from the database
- $user = User::find('first', array('conditions' => array('username' => $user['username'])));
-
- //Set the feed variable scope (since we are going to use it outside the loop)
- $feed;
+ $user = User::find($user['id']);
- if (isset($user->feed)) {
- //For each post ID in $users feed,
- foreach ($user->feed as $post)
- {
- //Find the post by it's ID
- $post = Post::find($post);
-
- //If a post was found,
- if (!empty($post))
- {
- //Add it to the feed
- $feed[] = $post;
- }
- //Else we should remove the the ID from the users feed.
- }
-
- /* new posts are appended to the end of the feed array, therefore new posts naturally end up at the bottom of the feed
- * therefore, we reverse the order of the array so that new posts end up at the top of the feed.
- * This is probably faster than doing sorting by date at the database level, though it for some reason
- * posts don't get inserted in the right order it could cause them to come out wrong in the view */
- $feed = array_reverse($feed);
- //This renders a custom layout we use for the feed, then passes user and feed to the view for the variables.
- }
- return compact('user', 'feed');
- }
+
+
+ return compact('user', 'feed');
}
/*