HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media


Welcome to TinyPortal. Please login or sign up.

July 17, 2024, 08:39:39 PM

Login with username, password and session length
  • Total Posts: 195,323
  • Total Topics: 21,233
  • Online today: 106
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 65
  • Total: 66
  • @rjen

[Block] Recent comments on articles.

Started by freddy888, October 16, 2009, 05:42:31 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


Yes this is perfect!

Thank you very much @rjen and Tino!

And for future support requests I shall mention:

"Well it's not so important ....
If - in the future - you have some time to look into it the code it would be a nice .....



Hi Arjan, Tino,

I assume that with TP version 2 the code for showing the comments is no longer working?

// *** Config ***
// Set the maximum number of comments to show.
$limit = 25;
// Set the maximum number of characters per comment to show.
$commlim = 90;
// *** End Of Config ***

// Now the code..
global $scripturl, $db_prefix, $smcFunc, $txt;

$request = $smcFunc['db_query']('', '
SELECT n.value2, n.value3, n.value4, n.value5, m.subject, m.author_id,, m.shortname, o.member_name AS member_name
FROM {db_prefix}tp_articles m
      LEFT OUTER JOIN {db_prefix}tp_variables n ON n.value5 =
      LEFT OUTER JOIN {db_prefix}members o ON n.value3 = o.id_member
WHERE n.type = {string:type}
ORDER BY n.value4 DESC
LIMIT {int:limit}',
array('type' => 'article_comment', 'limit' => $limit)

while ($row = $smcFunc['db_fetch_assoc']($request))
// Let's make these variable a little more readable...
$details = array(
'commenter' => '<a href="' . $scripturl . '?action=profile;u=' . $row['value3'] . '">' . $row['member_name'] . '</a>',
'comment' => $row['value2'],
'date' => $row['value4'],
'articleid' => $row['value5'],
'subject' =>  $row['subject'],
'query' => $row['shortname'],
        'id' => $row['value3']
if (strlen(html_entity_decode($details['comment'])) > $commlim)
             $details['comment'] = htmlentities(substr(html_entity_decode($details['comment']), 0, ($commlim-3)) . '...');
// Build the output...
echo '
<div class="tborder tp_article_frame">
<div class="catbg tp_subject" style="padding: 7px 0px 7px 0px;">

' , ($details['query'] != '' ? '<a href="' . $scripturl . '?page=' . $details['query'] . '">' . $details['subject'] . '</a>' : '<a href="' . $scripturl . '?page=' . $details['articleid'] . '">' . $details['subject'] . '</a>') , '
</div><span style="font:smalltext;">
<div class="">On
<span class="tp_thindivider"></span>
<span>' , date("l",$details['date']) , '</span>
<span>' , date("d",$details['date']) , '</span>
<span>' , $txt['months_short'][date("n", $details['date'])] , '</span>
<span> ' , date("Y",$details['date']) , '</span>
<span> ' , date("H:i:s",$details['date']) , '</span>
<span><b> ' , (($details['id'] > 0) ? $details['commenter']  :  $txt['tp-guest']) , '</b></span>

<span class="">commented: </B></span>

<div class="" style="color: #330000; font-size: 16px""><br>

' ,$details['comment'], '


What should be changed to make it working again?


Running Latest TP on SMF2.1 at:


Quote from: @rjen on March 15, 2021, 04:20:01 PM
What makes you assume that?

Probably the fact I moved the article comments to their own table. The table is now tp_comments and is mapped as per this change.

So all the value# need to be changed to their respective new column name and the block updated accordingly.


And I assume that this commmand is affected by this change as well?


this was



Yes tpmod was changed tportal in a lot of instances. Or if it was an admin area it's tpadmin now.


But have you an idea why index.php?action=tportal;sa=showcomments;showall isn't working (not showing any comment)?



Quote from: wildenborch on March 15, 2021, 10:28:24 PM
But have you an idea why index.php?action=tportal;sa=showcomments;showall isn't working (not showing any comment)?


Looking at the code. It seems it was missed in the updates. Not even sure how it's actually called atm, other than manually.


Hi Tino,

I really tried it but I really don't know what I'm doing and what to change or delete.

If you have some time, would you mind changing the script?



I'll look at it this weekend. The comments one will be a new patch release, probably 2.0.2. I don't know of any other bugs in that one so it might be a while before it's officially released, you can take the earlier release mind.