News: Welcome to the TinyPortal Support site.

Login  |  Register
HTML5 Icon HTML5 Icon
TP on Social Media
Welcome, Guest. Please login or register.
Did you miss your activation email?

July 23, 2019, 11:26:59 AM

Login with username, password and session length

Recent

Members
Stats
  • Total Posts: 188522
  • Total Topics: 20737
  • Online Today: 43
  • Online Ever: 629
  • (November 08, 2018, 01:36:54 PM)
Users Online
Users: 0
Guests: 30
Total: 30

Author Topic: A way to block ID's for specific forums from showing up in Recent Topics?  (Read 563 times)

0 Members and 1 Guest are viewing this topic.

Offline jernatety

  • Sr. Member
  • ****
  • Posts: 265
Is there a way to do this for the recent topics block? I just added a whole bunch of new forums and don't want the new topics showing up. Currently every new topic is showing up and in the recent list.

Thank you

Offline @rjen

  • Support Team
  • *
  • Posts: 1695
    • FJR-club Nederland
Nope, not without coding
Running TP1.6.3 on SMF2.0 at: www.fjr-club.nl

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

Offline jernatety

  • Sr. Member
  • ****
  • Posts: 265
Ok, thank you.

Offline @rjen

  • Support Team
  • *
  • Posts: 1695
    • FJR-club Nederland
Had a quick look at it. If you don't mind getting your hands (a bit) dirty you can adapt the code in TPsubs.template.php.

Easiest way is to just INCLUDE the board that you do want in the recent topics.

Find this code:
Code: [Select]
// TPortal recent topics block
function TPortal_recentbox()
{
global $scripturl, $context, $settings, $txt, $modSettings, $forum_version;

// is it a number?
if(!is_numeric($context['TPortal']['recentboxnum']))
$context['TPortal']['recentboxnum']='10';

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

$include_boards = null;

$what = ssi_recentTopics($num_recent = $context['TPortal']['recentboxnum'] , $exclude_boards = array($bb),  $include_boards, $output_method = 'array');

and change the line :
    $include_boards = null;

You can add an array including all the board id's that you want included in the recent topics..

like so:
    $include_boards = array(1,2,3,24,26);

The numbers are the board id's to be included
Running TP1.6.3 on SMF2.0 at: www.fjr-club.nl

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

Offline lurkalot

  • Administrator
  • *
  • Posts: 6075
    • Camera Craniums
There's also this php block snippet which does seem to work in SMF2. just tried it.

It has many options which you might find useful for your needs, and I'm sure with a bit of tweaking you could get it looking the way you want too.

Just follow the instructions, Multi-Functional posts and topics snippet

Offline @rjen

  • Support Team
  • *
  • Posts: 1695
    • FJR-club Nederland
Ok, here is how to exclude. You will have to put the board id's in an array twice.

Find:
Code: [Select]
// TPortal recent topics block
function TPortal_recentbox()
{
global $scripturl, $context, $settings, $txt, $modSettings, $forum_version;

// is it a number?
if(!is_numeric($context['TPortal']['recentboxnum']))
$context['TPortal']['recentboxnum']='10';

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

$include_boards = null;

$what = ssi_recentTopics($num_recent = $context['TPortal']['recentboxnum'] , $exclude_boards = array($bb),  $include_boards, $output_method = 'array');

and replace with

Code: [Select]
// TPortal recent topics block
function TPortal_recentbox()
{
global $scripturl, $context, $settings, $txt, $modSettings, $forum_version;

// is it a number?
if(!is_numeric($context['TPortal']['recentboxnum']))
$context['TPortal']['recentboxnum']='10';

// leave out the recycle board, if any, to exclude certain boards put board id's in $bb array below
if(isset($modSettings['recycle_board']))
$bb = array($modSettings['recycle_board'],26,70,19);
else
$bb = array(26,70,19);

// to include only certain boards put board id's in array below
$include_boards = array();

$what = ssi_recentTopics($num_recent = $context['TPortal']['recentboxnum'] , $exclude_boards = $bb,  $include_boards, $output_method = 'array');

You need to replace the string 26,70,19 in the code with the list of board ID's you wish to exclude. You need to do that in TWO places...
Running TP1.6.3 on SMF2.0 at: www.fjr-club.nl

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

Offline jernatety

  • Sr. Member
  • ****
  • Posts: 265
Thank you @Mick, I think I'm going to go with @rjen's 2nd suggestion.

@rjen, does the second suggestion also get reconfigured in "TPsubs.template.php"

And @rjen, you didn't have to do that, I can assure you though I greatly appreciate it.

Thanks, Ross

Offline @rjen

  • Support Team
  • *
  • Posts: 1695
    • FJR-club Nederland
Yep, same file
Running TP1.6.3 on SMF2.0 at: www.fjr-club.nl

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

Offline lurkalot

  • Administrator
  • *
  • Posts: 6075
    • Camera Craniums

Thank you @Mick, I think I'm going to go with @rjen's 2nd suggestion.


No worries, was just throwing it into the mix.  ;)

Offline jernatety

  • Sr. Member
  • ****
  • Posts: 265
Yep, same file

I don't see this file in the current theme ACP. In the sources directory I do see a TPsubs.php file but not .template.pnp file.

Am I looking in the correct place?