Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome, Guest. Please login or register.
Did you miss your activation email?

September 24, 2022, 05:33:42 PM

Login with username, password and session length
Members
Stats
  • Total Posts: 193513
  • Total Topics: 21092
  • Online today: 40
  • Online ever: 3540
  • (September 02, 2022, 06:38:54 PM)
Users Online
Users: 0
Guests: 39
Total: 39

Author Topic: [Block] Recent comments on articles.  (Read 34605 times)

0 Members and 1 Guest are viewing this topic.

Offline wildenborch

  • Support Team
  • *
  • Posts: 364
Re: [Block] Recent comments on articles.
« Reply #30 on: November 14, 2018, 05:49:32 AM »
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 .....

 ;D

Offline wildenborch

  • Support Team
  • *
  • Posts: 364
Re: [Block] Recent comments on articles.
« Reply #31 on: March 15, 2021, 05:57:17 AM »
Hi Arjan, Tino,

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

Code: [Select]
// *** 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.author, 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 = m.id
      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'], '

</div>
<br></div>
</div>';
}
$smcFunc['db_free_result']($request);

What should be changed to make it working again?



Offline @rjen

  • Support Team
  • *
  • Posts: 3300
    • FJR-club Nederland
Re: [Block] Recent comments on articles.
« Reply #32 on: March 15, 2021, 10:20:01 AM »
What makes you assume that?
Running Latest TP on SMF2.1 at: www.fjr-club.nl

Testing TP on SMF2.0
Testing TP on SMF2.1 (latest Github)
Want to check what php version I am testing on? See: PHP Info

Offline tino

  • Developer
  • *
  • Posts: 2615
Re: [Block] Recent comments on articles.
« Reply #33 on: March 15, 2021, 11:32:00 AM »
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.

https://github.com/Tinyportal/TinyPortal/blob/7b6c194a411f3187004f6c5a50b41a41a751214d/install.php#L985

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

Offline wildenborch

  • Support Team
  • *
  • Posts: 364
Re: [Block] Recent comments on articles.
« Reply #34 on: March 15, 2021, 11:40:43 AM »
And I assume that this commmand is affected by this change as well?

index.php?action=tportal;sa=showcomments;showall

this was

index.php?action=tpmod;sa=showcomments;showall

Offline tino

  • Developer
  • *
  • Posts: 2615
Re: [Block] Recent comments on articles.
« Reply #35 on: March 15, 2021, 12:22:23 PM »
Yes tpmod was changed tportal in a lot of instances. Or if it was an admin area it’s tpadmin now.

Offline wildenborch

  • Support Team
  • *
  • Posts: 364
Re: [Block] Recent comments on articles.
« Reply #36 on: March 15, 2021, 04:28:24 PM »
But have you an idea why index.php?action=tportal;sa=showcomments;showall isn't working (not showing any comment)?

Fred

Offline tino

  • Developer
  • *
  • Posts: 2615
Re: [Block] Recent comments on articles.
« Reply #37 on: March 15, 2021, 04:45:30 PM »
But have you an idea why index.php?action=tportal;sa=showcomments;showall isn't working (not showing any comment)?

Fred

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

Offline wildenborch

  • Support Team
  • *
  • Posts: 364
Re: [Block] Recent comments on articles.
« Reply #38 on: March 17, 2021, 07:13:43 AM »
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?

Fred 

Offline tino

  • Developer
  • *
  • Posts: 2615
Re: [Block] Recent comments on articles.
« Reply #39 on: March 17, 2021, 10:40:47 AM »
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.