Location: PHPKode > projects > ProjectPress > projectpress/projects/forum/discussions.php
<?php 
/**
 * ProjectPress project forum topics
 *
 * @package ProjectPress
 * @since 2.0
 */

// Starts the session.
session_start();

define('access',true);

include(dirname(dirname(dirname(__FILE__))) . '/config.inc.php');
include(PM_DIR . 'pm-includes/global.inc.php');
require(PM_DIR . 'pm-includes/functions.php');
include(PM_DIR . 'pm-includes/header.php');

if($current_user->hasPermission('access_site') != true) { pm_redirect(PM_URI . '/index.php'); }

// Enable for error checking and troubleshooting.
# display_errors();

$sql = "SELECT * FROM " . DB . "project_forum_topics WHERE pt_id = '".$_GET['p_id']."' ORDER BY pt_id DESC";
// ORDER BY gft_id DESC is order result by descending 
$result = pmdb::connect()->query($sql);

?>

				<div id="page-title">
					<img src="<?php echo PM_URI; ?>/images/comment.png" alt="" /><h1>Group Forum</h1>
				</div>

				<div id="tabs">
					<ul>
						<li <?php if (basename($_SERVER["REQUEST_URI"]) == "project.php?p_id=".$_GET['p_id']) echo "class='active_link'";?>>
							<a href="<?php echo PM_URI ?>/projects/project.php?p_id=<?php echo $_GET['p_id']; ?>"><span>Project</span></a>
						</li>
						<li <?php if (basename($_SERVER["REQUEST_URI"]) == "discussions.php?p_id=".$_GET['p_id']) echo "class='active_link'";?>
							<?php if (basename($_SERVER["REQUEST_URI"]) == "add_ptopic.php?p_id=".$_GET['p_id']) echo "class='active_link'";?>>
							<a href="<?php echo PM_URI ?>/projects/forum/discussions.php?p_id=<?php echo $_GET['p_id']; ?>"><span>Forum</span></a>
						</li>
						<li <?php if (basename($_SERVER["REQUEST_URI"]) == "contact.php?p_id=".$_GET['p_id']) echo "class='active_link'";?>>
							<a href="<?php echo PM_URI ?>/projects/contact.php?p_id=<?php echo $_GET['p_id']; ?>"><span>Email</span></a>
						</li>
						<li <?php if (basename($_SERVER["REQUEST_URI"]) == "project_members.php?p_id=".$_GET['p_id']) echo "class='active_link'";?>>
							<a href="<?php echo PM_URI ?>/projects/project_members.php?p_id=<?php echo $_GET['p_id']; ?>"><span>Members</span></a>
						</li>
					</ul>
				</div>

				<div id="middle">
				<div id="groups-page">
<h2>Forum Topics</h2>
<table width="504" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td width="63%" align="center" bgcolor="#E6E6E6"><strong>Topic</strong></td>
<td width="13%" align="center" bgcolor="#E6E6E6"><strong>Replies</strong></td>
<td width="19%" align="center" bgcolor="#E6E6E6"><strong>Date/Time</strong></td>
</tr>

<?php
while($rows = $result->fetch_object()) { // Start looping table row
$query = pmdb::connect()->query("SELECT COUNT(p_id) FROM " . DB . "project_forum_posts WHERE topic_id = '".$rows->pt_id."'");
$r = $query->fetch_array();
?>
<tr>
<td bgcolor="#FFFFFF"><a style="margin-left:5px;" href="view_ptopic.php?p_id=<?php echo $_GET['p_id']; ?>&id=<?php echo $rows->pft_id; ?>"><?php echo $rows->pft_topic; ?></a><br /></td>
<td align="center" bgcolor="#FFFFFF"><?php echo $r['COUNT(p_id)']; ?></td>
<td align="center" bgcolor="#FFFFFF"><?php echo date('M d, y h:i A',strtotime($rows->pft_datetime)); ?></td>
</tr>

<?php
// Exit looping and close connection 
}
?>

<tr>
<td colspan="5" align="right" bgcolor="#E6E6E6"><a href="<?php echo PM_URI ?>/projects/forum/add_ptopic.php?p_id=<?php echo $_GET['p_id']; ?>"><strong>Create New Topic</strong> </a></td>
</tr>
</table>
</div><!--Ends groups-page-->
</div><!--middle-->


<?php

include(PM_DIR . 'pm-includes/footer.php');
Return current item: ProjectPress