Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Adding Author field in forum_threads_list_panel

Asked Modified Viewed 3,173 times
A
alexxfender
A
  • Junior Member, joined since
  • Contributed 47 posts on the community forums.
  • Started 6 threads in the forums
  • Started this discussions
asked
Junior Member

Can someone help me add an author field in this forum_threads_list_panel.php

Thanks..

<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright (C) 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: forum_threads_list_panel.php
| Author: Nick Jones (Digitanium)
| Modified by HobbyMan [http://www.hobbysites.net/]
| Boxover.js By Oliver Bryant with help of Matthew Tagg [http://boxover.swazz.org]
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }

global $lastvisited;

if (!isset($lastvisited) || !isnum($lastvisited)) { $lastvisited = time(); }

echo "<script type='text/javascript' language='JavaScript' src='".INFUSIONS."forum_threads_list_panel/boxover.js'></script>";

$data = dbarray(dbquery("SELECT tt.thread_lastpost
   FROM ".DB_FORUMS." tf
   INNER JOIN ".DB_THREADS." tt ON tf.forum_id = tt.forum_id
   WHERE ".groupaccess('tf.forum_access')."
   ORDER BY tt.thread_lastpost DESC LIMIT ".($settings['numofthreads']-1).", ".$settings['numofthreads']));

$timeframe = empty($data['thread_lastpost']) ? 0 : $data['thread_lastpost'];

$result = dbquery(
   "SELECT tt.thread_id, tt.thread_subject, tt.thread_views, tt.thread_lastuser, tt.thread_lastpost,
   tt.thread_poll, tf.forum_id, tf.forum_name, tf.forum_access, tt.thread_lastpostid, tt.thread_postcount, tu.user_id, tu.user_name
   FROM ".DB_THREADS." tt
   INNER JOIN ".DB_FORUMS." tf ON tt.forum_id=tf.forum_id
   INNER JOIN ".DB_USERS." tu ON tt.thread_lastuser=tu.user_id
   WHERE ".groupaccess('tf.forum_access')." AND tt.thread_lastpost >= ".$timeframe."
   ORDER BY tt.thread_lastpost DESC LIMIT 0,".$settings['numofthreads']
);

if (dbrows($result)) {
   $i = 0;
   opentable($locale['global_040']);
   echo "<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border'>\n<tr>\n";
   echo "<td class='tbl2'>&nbsp;</td>\n";
   echo "<td width='100%' class='tbl2'><strong>".$locale['global_044']."</strong></td>\n";
   echo "<td width='1%' class='tbl2' style='text-align:center;white-space:nowrap'><strong>".$locale['global_045']."</strong></td>\n";
   echo "<td width='1%' class='tbl2' style='text-align:center;white-space:nowrap'><strong>".$locale['global_046']."</strong></td>\n";
   echo "<td width='1%' class='tbl2' style='text-align:center;white-space:nowrap'><strong>".$locale['global_047']."</strong></td>\n";
   echo "</tr>\n";
   while ($data = dbarray($result)) {
      $row_color = ($i % 2 == 0 ? "tbl1" : "tbl2");
      echo "<tr>\n<td class='".$row_color."'>";
      if ($data['thread_lastpost'] > $lastvisited) {
         $thread_match = $data['thread_id']."\|".$data['thread_lastpost']."\|".$data['forum_id'];
         if (iMEMBER && preg_match("(^\.{$thread_match}$|\.{$thread_match}\.|\.{$thread_match}$)", $userdata['user_threads'])) {
            echo "<img src='".get_image("folder")."' alt='' />";
         } else {
            echo "<img src='".get_image("foldernew")."' alt='' />";
         }
      } else {
         echo "<img src='".get_image("folder")."' alt='' />";
      }
      if ($data['thread_poll']) {
         $thread_poll = "<span class='small' style='font-weight:bold'>[".$locale['global_051']."]</span> ";
      } else {
         $thread_poll = "";
      }
      $data_ms = dbarray(dbquery("SELECT * FROM ".DB_POSTS." WHERE thread_id='".$data['thread_id']."' ORDER BY post_id DESC LIMIT 1"));
      $post_message = $data_ms['post_smileys'] == 1 ? parsesmileys($data_ms['post_message']) : $data_ms['post_message'];
      $post_message = phpentities(nl2br(parseubb($post_message)));
      $subject = stripinput($data['thread_subject']);
      $post = stripinput($data_ms['post_message']);
      
      echo "</td>\n";
      echo "<td width='100%' class='".$row_color."'>".$thread_poll."<a href='".FORUM."viewthread.php?thread_id=".$data['thread_id']."&amp;pid=".$data['thread_lastpostid']."#post_".$data['thread_lastpostid']."' title=\"header=[ ".str_replace("]", "]]", str_replace("[", "[[", trimlink($subject, 30)))."] body=[".str_replace("]", "]]", str_replace("[", "[[", trimlink($post, 250)))."] delay=[0] fade=[on]\">".trimlink($data['thread_subject'], 30)."</a><br />\n".$data['forum_name']."</td>\n";
      echo "<td width='1%' class='".$row_color."' style='text-align:center;white-space:nowrap'>".$data['thread_views']."</td>\n";
      echo "<td width='1%' class='".$row_color."' style='text-align:center;white-space:nowrap'>".($data['thread_postcount']-1)."</td>\n";
      echo "<td width='1%' class='".$row_color."' style='text-align:center;white-space:nowrap'><a href='".BASEDIR."profile.php?lookup=".$data['thread_lastuser']."'>".$data['user_name']."</a><br />\n".showdate("forumdate", $data['thread_lastpost'])."</td>\n";
      echo "</tr>\n";
      $i++;
   }
   echo "</table>\n";
   if (iMEMBER) {
      echo "<div class='tbl1' style='text-align:center'><a href='".INFUSIONS."forum_threads_list_panel/my_threads.php'>".$locale['global_041']."</a> ::\n";
      echo "<a href='".INFUSIONS."forum_threads_list_panel/my_posts.php'>".$locale['global_042']."</a> ::\n";
      echo "<a href='".INFUSIONS."forum_threads_list_panel/new_posts.php'>".$locale['global_043']."</a>";
      if($settings['thread_notify']) {
         echo " ::\n<a href='".INFUSIONS."forum_threads_list_panel/my_tracked_threads.php'>".$locale['global_056']."</a>";
      }
      echo "</div>\n";
   }
   closetable();
}
?>
0 replies

4 posts

W
wheeler
W
Michael Wheeler
  • Member, joined since
  • Contributed 87 posts on the community forums.
  • Started 21 threads in the forums
answered
Member

Hi

This does still work still on the latest version of PHPFusion, But ive noticed the author and last user are the same when in use, if that makes sense - Any idea?
Edited by wheeler on 01-08-2013 10:13,
0 replies
— 2 years earlier —
A
Ankur
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums
answered
Veteran Member

Quote

alexxfender wrote:
Thank you so much..


No Problem Mate. Always Welcome ! ;)
0 replies
A
alexxfender
A
  • Junior Member, joined since
  • Contributed 47 posts on the community forums.
  • Started 6 threads in the forums
  • Started this discussions
answered
Junior Member

Perfect... Thank you so much..
0 replies
A
Ankur
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums
answered
Veteran Member

Here it is :
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright (C) 2002 - 2010 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: forum_threads_list_panel.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION"wink) { die("Access Denied"wink; }

global $lastvisited;

if (!isset($lastvisited) || !isnum($lastvisited)) { $lastvisited = time(); }

$data = dbarray(dbquery(
"SELECT tt.thread_lastpost
FROM ".DB_FORUMS." tf
INNER JOIN ".DB_THREADS." tt ON tf.forum_id = tt.forum_id
WHERE ".groupaccess('tf.forum_access'wink." AND thread_hidden='0'
ORDER BY tt.thread_lastpost DESC LIMIT ".($settings['numofthreads']-1).", ".$settings['numofthreads']
));

$timeframe = empty($data['thread_lastpost']) ? 0 : $data['thread_lastpost'];

$result = dbquery(
"SELECT tt.thread_id, tt.thread_author, tt.thread_subject, tt.thread_views, tt.thread_lastuser, tt.thread_lastpost,
tt.thread_poll, tf.forum_id, tf.forum_name, tf.forum_access, tt.thread_lastpostid, tt.thread_postcount, tu.user_id, tu.user_name,
tu.user_status
FROM ".DB_THREADS." tt
INNER JOIN ".DB_FORUMS." tf ON tt.forum_id=tf.forum_id
INNER JOIN ".DB_USERS." tu ON tt.thread_lastuser=tu.user_id
WHERE ".groupaccess('tf.forum_access'wink." AND tt.thread_lastpost >= ".$timeframe." AND tt.thread_hidden='0'
ORDER BY tt.thread_lastpost DESC LIMIT 0,".$settings['numofthreads']
);

if (dbrows($result)) {
$i = 0;
opentable($locale['global_040']);
echo "<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border'>\n<tr>\n";
echo "<td class='tbl2'>&nbsp;</td>\n";
echo "<td width='100%' class='tbl2'><strong>".$locale['global_044']."</strong></td>\n";
echo "<td width='1%' class='tbl2' style='text-align:center;white-space:nowrap'><strong>".$locale['global_045']."</strong></td>\n";
echo "<td width='1%' class='tbl2' style='text-align:center;white-space:nowrap'><strong>".$locale['global_046']."</strong></td>\n";
echo "<td width='1%' class='tbl2' style='text-align:center;white-space:nowrap'><strong>".$locale['global_047']."</strong></td>\n";
echo "<td width='1%' class='tbl2' style='text-align:center;white-space:nowrap'><strong>".$locale['global_050']."</strong></td>\n";
echo "</tr>\n";
while ($data = dbarray($result)) {
$row_color = ($i % 2 == 0 ? "tbl1" : "tbl2"wink;
echo "<tr>\n<td class='".$row_color."'>";
if ($data['thread_lastpost'] > $lastvisited) {
$thread_match = $data['thread_id']."\|".$data['thread_lastpost']."\|".$data['forum_id'];
if (iMEMBER && preg_match("(^\.{$thread_match}$|\.{$thread_match}\.|\.{$thread_match}$)", $userdata['user_threads'])) {
echo "<img src='".get_image("folder"wink."' alt='' />";
} else {
echo "<img src='".get_image("foldernew"wink."' alt='' />";
}
} else {
echo "<img src='".get_image("folder"wink."' alt='' />";
}
if ($data['thread_poll']) {
$thread_poll = "<span class='small' style='font-weight:bold'>[".$locale['global_051']."]</span> ";
} else {
$thread_poll = "";
}
echo "</td>\n";
echo "<td width='100%' class='".$row_color."'>".$thread_poll."<a href='".FORUM."viewthread.php?thread_id=".$data['thread_id']."&amp;pid=".$data['thread_lastpostid']."#post_".$data['thread_lastpostid']."' title='".$data['thread_subject']."'>".trimlink($data['thread_subject'], 30)."</a><br />\n".$data['forum_name']."</td>\n";
echo "<td width='1%' class='".$row_color."' style='text-align:center;white-space:nowrap'>".$data['thread_views']."</td>\n";
echo "<td width='1%' class='".$row_color."' style='text-align:center;white-space:nowrap'>".($data['thread_postcount']-1)."</td>\n";
echo "<td width='1%' class='".$row_color."' style='text-align:center;white-space:nowrap'>".profile_link($data['thread_lastuser'], $data['user_name'], $data['user_status'])."<br />\n".showdate("forumdate", $data['thread_lastpost'])."</td>\n";
echo "<td width='1%' class='".$row_color."' style='text-align:center;white-space:nowrap'>".profile_link($data['thread_author'], $data['user_name'], $data['user_status'])."</td>\n";
echo "</tr>\n";
$i++;
}
echo "</table>\n";
if (iMEMBER) {
echo "<div class='tbl1' style='text-align:center'><a href='".INFUSIONS."forum_threads_list_panel/my_threads.php'>".$locale['global_041']."</a> ::\n";
echo "<a href='".INFUSIONS."forum_threads_list_panel/my_posts.php'>".$locale['global_042']."</a> ::\n";
echo "<a href='".INFUSIONS."forum_threads_list_panel/new_posts.php'>".$locale['global_043']."</a>";
if($settings['thread_notify']) {
echo " ::\n<a href='".INFUSIONS."forum_threads_list_panel/my_tracked_threads.php'>".$locale['global_056']."</a>";
}
echo "</div>\n";
}
closetable();
}
?>
[/syntaxhighlighter]
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 4 posts
  • Votes 0 votes
  • Topic users 3 members

3 participants

W
W
Michael Wheeler
  • Member, joined since
  • Contributed 87 posts on the community forums.
  • Started 21 threads in the forums
A
A
  • Junior Member, joined since
  • Contributed 47 posts on the community forums.
  • Started 6 threads in the forums
  • Started this discussions
A
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet