Пример #1
0
function toggleFollowUser($followerId, $followedId)
{
    if (userFollows($followerId, $followedId)) {
        unfollowUser($followerId, $followedId);
    } else {
        followUser($followerId, $followedId);
    }
}
Пример #2
0
		<p><span>Username: </span><?php 
echo $user['username'];
?>
</p>
		<p><span>Last Online: </span><?php 
echo formatDate($user['lastlogin']);
?>
</p>
		<p><span>Member Since: </span><?php 
echo formatDate($user['member_since']);
?>
</p>

		<?php 
if ($userId != $id) {
    if (userFollows($userId, $id)) {
        echo '<p><button type="submit" class="btn btn-danger" id="followButton">Unfollow</button></p>';
    } else {
        echo '<p><button type="submit" class="btn btn-primary" id="followButton">Follow</button></p>';
    }
}
?>
	</div>
</div>
<div class="container">
	<div class="col-md-6 posts">
	<?php 
$postSnippetLength = 500;
foreach (getUserPosts($id) as $post) {
    echo '<div class="panel panel-default">';
    echo '<div class="panel-heading">';