Location: PHPKode > projects > ProjectPress > projectpress/view_comments.php
<?php
/**
 * ProjectPress view all feed post comment(s)
 *
 * @package ProjectPress
 * @since 2.0
 */

// Starts the session.
session_start();
define('access',true);
require_once(dirname(__FILE__) . '/config.inc.php');
require_once(PM_DIR . 'pm-includes/global.inc.php');
require_once(PM_DIR . 'pm-includes/functions.php');

// Checks if user is logged in; if not redirect to login page.
if($current_user->hasPermission('access_site') != true) { pm_redirect(PM_URI . '/index.php'); }

// Enable for error checking and troubleshooting.
# display_errors();
	
	$comments = pmdb::connect()->query("SELECT *,UNIX_TIMESTAMP() - date_created AS CommentTimeSpent FROM ". DB ."wall_posts_comments where post_id = ".$_REQUEST['postId']." order by date_created asc limit 2, ".$_REQUEST['totals']);
		
	$comment_num_row = $comments->num_rows;
	
	if($comment_num_row > 0)
	{
		while ($rows = $comments->fetch_object())
		{
			$days2 = floor($rows->CommentTimeSpent / (60 * 60 * 24));
			$remainder = $rows->CommentTimeSpent % (60 * 60 * 24);
			$hours = floor($remainder / (60 * 60));
			$remainder = $remainder % (60 * 60);
			$minutes = floor($remainder / 60);
			$seconds = $remainder % 60;	?>
			
			<div class="commentPanel" align="left">
				<?php echo get_user_avatar($rows->c_user,$rows->email); ?>
				<label class="postedComments">
					<a href="<?php echo PM_URI ?>/profile/profile.php?username=<?php echo $rows->c_user; ?>"><span id="name"><?php echo get_name($rows->c_user); ?></span></a> <?php echo clickable_link($rows->comments);?>
				</label>
				<br clear="all" />
				<span style="margin-left:43px; color:#666666; font-size:11px">
				<?php
				
				if($days2 > 0)
				echo date('F d Y', $rows->date_created);
				elseif($days2 == 0 && $hours == 0 && $minutes == 0)
				echo "few seconds ago";		
				elseif($days2 == 0 && $hours == 0)
				echo $minutes.' minutes ago';
				elseif($days2 == 0 && $hours > 0)
				echo $hours.' hour ago';
				else
				echo "few seconds ago";	
				?>
				<?php
				$username = $_SESSION['username'];
				if($rows->c_user == $username){?>
				&nbsp;&nbsp;<a href="#" id="CID-<?php  echo $rows->c_id;?>" class="c_delete">Delete</a>
				<?php
				}?>
				</span>
				
			</div>
		<?php
		}
	}
Return current item: ProjectPress