TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 195,994
  • Total Topics: 21,325
  • Online today: 348
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 256
  • Total: 256

recent topic block with excluded boards

Started by wildenborch, November 29, 2015, 09:00:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wildenborch

Hi all,

I know that there is a special php block code for this functionality but that block lacks the "new" image and therefore I use the default recent topic block.

I found that the layout of this current topic block is in TPSubs.template.php

I changed this part of the code:

// leave out the recycle board, if any
if(isset($modSettings['recycle_board']))
$bb = array($modSettings['recycle_board']);
else
$bb = array();


into

// leave out the recycle board, if any
if(isset($modSettings['recycle_board']))
$bb = array(1);
else
$bb = array();


and now all topics in the "number 1" board are excluded.

Since I realy don't know if what I have done is correct coding and I also don't know what recycle boards are I wonder if - although it seems to work OK, I did something stupid?

I also changed the layout a bit!

Becuase I wanted to see some more of the subject line I changed in TPSubs.php line:

'short_subject' => shorten_subject($row['subject'], 25),

into

'short_subject' => shorten_subject($row['subject'], 65),

Best regards,
Fred



illori

do you have a board where all deleted posts and topics go? if so that is the recycle board.

i have not tested but if it is looking for an array, you could just do
$bb = array($modSettings['recycle_board'],1,2,3,4);

that should work, i have not tested it though.

Skhilled


wildenborch

Hi Illori,

Thank you very much for your reply.
Your code is indeed working so I have replaced mine with yours.

Fred

wildenborch

#4
Illori,

I was too quick..... this code does not exclude the boards I want to exclude.

And the code I used ($bb = array(1,7); only exclude the first listed board.

Since board 1 is the board I want to exclude and I don't use the recycle board I can use this code but not if I want to exclude some more in the future.

Best regards,
Fred

illori

try this?


// leave out the recycle board, if any
if(isset($modSettings['recycle_board']))
$bb = array($modSettings['recycle_board']);
else
$bb = array(1,7);

wildenborch

No that wasn't the trick either.

Well maybe Sayaka Maizono can create a nice recent topic block based upon the current functionality in TPSubs.template.php  ;D

illori

i think found the issue...

$what = tp_recentTopics($context['TPortal']['recentboxnum'], $bb, 'array'); find that in TPsubs.template.php

replace with this

$what = tp_recentTopics($context['TPortal']['recentboxnum'], $exclude_boards = array(1), 'array');

replace 1 with the board that you want to exclude.

wildenborch

Hi Illori,

This works for the board I want to exclude.
I also tried this with multiple boards but then only the first board is excluded.

BTW, do you know why the output part in the code that shows the recents topics without avatar is referring to ssi_recentTopics and the part that shows the avatar is referring to tp_recentTopics ?

Best regards.
Fred

illori

then change the code to this


$what = tp_recentTopics($context['TPortal']['recentboxnum'], $exclude_boards = array(1,2,3,4), 'array');

i only had one board with topics... so i assume that should work out fine.

one shows the avatar the other does not. so TP modified the SSI code to have the avatar shown.

This website is proudly hosted on Crocweb Cloud Website Hosting.