function getFeedFromFollowers($uid, $page = 1, $limit = 10) { global $db, $session; // Get activities published by user $ats = getActivitiesFromUser($uid); // Get the users the uid is following $following = getFollowing($uid); // Flatten the uid list $fgraph = array(); foreach ($following as $f) { if (!in_array($fgraph, $f['user_id'])) { $fgraph[] = $f['user_id']; } } // Pull out their experiment ids $responses = array(); for ($i = 0; $i < count($ats) - 1; $i++) { $aid = $ats[$i]['experiment_id']; $v = getResponsesForActivity($aid); if (count($v) > 0) { for ($j = 0; $j < count($v); $j++) { array_push($responses, $v[$j]); } } } return $responses; }
} */ $data['activity_responses'] = getResponsesFromUser($id); // Compile the user's media foreach ($data as $key => $value) { if (is_array($value)) { foreach ($value as $v) { $v['type'] = $key; $output[] = $v; } } } usort($output, 'timeobj_cmp'); // Grab the user's graph $followers = getFollowers($id); $following = getFollowing($id); $is_following = "No"; if ($id == $session->userid) { $is_following = "You"; } else { $is_following = doesFollow($session->userid, $id) ? "Yes" : "No"; } $smarty->assign('is_following', $is_following); $smarty->assign('followers', $followers); $smarty->assign('following', $following); $smarty->assign('is_owner', $is_owner); $smarty->assign('results', $output); $smarty->assign('errors', $errors); $counts = array('sessions' => count($data['session']), 'experiments' => count($data['experiment']), 'vises' => count($data['vis']), 'images' => count($data['image']), 'videos' => count($data['video'])); $smarty->assign('counts', $counts); if ($is_owner) {
<button type="submit" name="unfollow" class="button">Unfollow</button> </form>'; } else { print '<form method="POST"> <input type="hidden" name="id" value="' . $get['user_id'] . '"> <button type="submit" name="follow" class="button">Follow</button> </form>'; } } if ($sess['user_id'] == $get['user_id']) { print '<p><a href="following.php">Following: ' . count($following) . '</a></p>'; } else { print '<p id="following">Following: ' . count($following) . '</p>'; print '<div class="following">'; print '<div id="online_img">'; $following = getFollowing($get['user_id']); if (count($following) == 0) { print $get['username'] . " isn't following anyone..."; } else { print '<div id="online_container">'; foreach ($following as $following) { print '<div class="whos_online">'; print '<a href="profile.php?profile=' . $following['username'] . '" title="' . $following['username'] . '">' . getProfilePic($following['following'], '50px') . '</a>'; print '</div>'; } print '</div>'; } print '</div>'; print '</div>'; } print '<p id="followers">Followers: ' . count($followers) . '</p>';