Mod to hide specific topics from the board view?

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Suggested Hosts
Locked
User avatar
PinkFroggy
Registered User
Posts: 13
Joined: Sun Jul 17, 2011 1:09 am

Mod to hide specific topics from the board view?

Post by PinkFroggy »

Hello,
Does anyone know if there is a Mod that can hide topics from the menu or board view.
But can still be seen by anyone who clicks a link from another topic to view them?

-OR-

Is there a mod that can make certain subforums invisible but the topics inside still visible if linked to from another topic?

(Or anything close to the above?)

Would this be hard to make if it doesn't already exist?
User avatar
Tom
Former Team Member
Posts: 2665
Joined: Tue Jun 20, 2006 2:12 am
Name: Tom Catullo
Contact:

Re: Mod to hide specific topics from the board view?

Post by Tom »

PinkFroggy wrote:Does anyone know if there is a Mod that can hide topics from the menu or board view.
But can still be seen by anyone who clicks a link from another topic to view them?
This would be a fairly easy MOD to make. In fact, I just wrote out instructions for such a MOD myself below. Tested and working fine on phpBB 3.0.9.

MOD Installation Instructions

Run this SQL Query in phpMyAdmin (if using MySQL)
Note: If your forum's database table prefix is not phpbb_ then be sure to change the table name in the query below!

Code: Select all

ALTER TABLE `phpbb_topics` ADD `display_in_forum` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '1'
Now, for the file edits . . .

Open viewforum.php
FIND:

Code: Select all

		'WHERE'		=> 't.forum_id IN (' . $forum_id . ', 0)
			AND t.topic_type IN (' . POST_ANNOUNCE . ', ' . POST_GLOBAL . ')',
REPLACE WITH:

Code: Select all

		'WHERE'		=> 't.forum_id IN (' . $forum_id . ', 0)
			AND t.topic_type IN (' . POST_ANNOUNCE . ', ' . POST_GLOBAL . ')
			AND t.display_in_forum = 1',
FIND

Code: Select all

	WHERE $sql_where
		AND t.topic_type IN (" . POST_NORMAL . ', ' . POST_STICKY . ")
REPLACE WITH

Code: Select all

	WHERE $sql_where
		AND t.topic_type IN (" . POST_NORMAL . ', ' . POST_STICKY . ")
		AND t.display_in_forum = 1
FIND:

Code: Select all

		'WHERE'			=> $db->sql_in_set('t.topic_id', $topic_list),
REPLACE WITH:

Code: Select all

		'WHERE'			=> $db->sql_in_set('t.topic_id', $topic_list) . ' AND t.display_in_forum = 1',
Open posting.php
FIND:

Code: Select all

	$post_data['enable_bbcode']		= (!$bbcode_status || isset($_POST['disable_bbcode'])) ? false : true;
AFTER ADD:

Code: Select all

	$post_data['display_in_forum']	= ($_POST['display_in_forum']) ? true : false;
FIND:

Code: Select all

				'post_approved'			=> (isset($post_data['post_approved'])) ? $post_data['post_approved'] : false,
AFTER ADD:

Code: Select all

				'display_in_forum' 		=> ($post_data['display_in_forum']) ? true : false,
FIND:

Code: Select all

$lock_post_checked	= (isset($post_lock)) ? $post_lock : $post_data['post_edit_locked'];
AFTER ADD:

Code: Select all

$display_in_forum_checked = (($post_data['display_in_forum'] && $mode == 'edit') || $mode == 'post') ? true : false;
FIND:

Code: Select all

	'S_BBCODE_CHECKED'			=> ($bbcode_checked) ? ' checked="checked"' : '',
AFTER ADD:

Code: Select all

	'S_DISPLAY_IN_FORUM_CHECKED'			=> (!$display_in_forum_checked) ? '' : ' checked="checked"',
FIND:

Code: Select all

	'S_BBCODE_QUOTE'		=> $quote_status,
AFTER ADD:

Code: Select all

	'S_DISPLAY_IN_FORUM' 	=> $post_data['display_in_forum'],
	'S_IS_REPLY' 			=> ($mode == 'reply') ? true : false,
Open includes/functions_posting.php
FIND:

Code: Select all

				'topic_attachment'			=> (!empty($data['attachment_data'])) ? 1 : 0,
AFTER ADD:

Code: Select all

				'display_in_forum' 			=> ($data['display_in_forum']) ? 1 : 0,
FIND:

Code: Select all

				'topic_attachment'			=> (!empty($data['attachment_data'])) ? 1 : (isset($data['topic_attachment']) ? $data['topic_attachment'] : 0),
AFTER ADD:

Code: Select all

				'display_in_forum' 			=> ($data['display_in_forum']) ? 1 : 0,
Open styles/prosilver/template/posting_editor.html
FIND:

Code: Select all

			<!-- IF S_BBCODE_ALLOWED -->
				<div><label for="disable_bbcode"><input type="checkbox" name="disable_bbcode" id="disable_bbcode"{S_BBCODE_CHECKED} /> {L_DISABLE_BBCODE}</label></div>
			<!-- ENDIF -->
BEFORE ADD:

Code: Select all

			<!-- IF not S_IS_REPLY -->
				<div><label for="display_in_forum"><input type="checkbox" name="display_in_forum" id="display_in_forum"{S_DISPLAY_IN_FORUM_CHECKED} /> Display in forum</label></div>
			<!-- ENDIF -->
After making these edits and running the first SQL Query: Be sure to go to the Admin Control Panel and Purge the Cache. After that, a checkbox option will appear every time you post a new topic or edit an existing topic saying "Display in forum". By default, the box is checked and the topic is displayed in the forum. However, you can uncheck the box to hide the topic from being displayed in the topiclist for its respective forum. But you can still link directly to a topic and view it, even if it is marked to not be displayed in the forum.

Please give the code edits a try and let me know if you run into any problems. Hopefully this properly addresses your request.
Tom Catullo - Former Moderator Team Member
phpBB3 Smiley Pak Generator | Legend Repositioning MOD | My GitHub | My Site
User avatar
PinkFroggy
Registered User
Posts: 13
Joined: Sun Jul 17, 2011 1:09 am

Re: Mod to hide specific topics from the board view?

Post by PinkFroggy »

Thank you so much, that's just what I was looking for. It works like a dream. :D
Locked

Return to “[3.0.x] MOD Requests”