MyBB Community Forums

Full Version: Guest Can't View Threads
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This plugin helps from people reading threads. My only problem is that when I activate this plugin it blocks all of my forums from people being able to read the threads. How can I customize it to certain forums only.

<?php
$plugins->add_hook('showthread_start', 'gcvt_thread');
$plugins->add_hook('archive_thread_start', 'gcvt_thread');

function gcvt_info()
{
	return array(
		'name'			=> 'Guests Can\'t View Threads',
		'description'	=> 'Guests cannot view threads.',
		'website'		=> 'http://mybbplug.in/',
		'author'		=> 'Jammerx2',
		'authorsite'	=> 'http://mybbplug.in/',
		'version'		=> '1.1',
		'guid'        => '8ac34edb831b6a420c48602ed5384b59'
	);
}

function gcvt_activate()
{
}

function gcvt_deactivate()
{
}
function gcvt_thread()
{
	global $db, $mybb,$lang, $thread;

                	if($mybb->user['uid'] == 0)
                	{
                    	error("Guests cannot view threads.","DeathTroopers");
                	}
		
		
	
	$lang->send_thread = "";
}
?>

What would I need to edit to block people from reading/viewing certain forum section only? Any help would be really appreciated.

Thank you in advance!
if($mybb->user['uid'] == 0 && $thread['fid'] == 2)

That should work fine. Replace "2" with the fid of the forum.
I don't think you need plugin for that, go to ACP -> Forums & Posts -> [forums which should have unviewable threads] -> Edit Forum Settings -> Set Custom Permissions next to Guests -> uncheck Can view threads within forum? -> Save
(2014-02-03, 02:41 PM)Destroy666 Wrote: [ -> ]I don't think you need plugin for that, go to ACP -> Forums & Posts -> [forums which should have unviewable threads] -> Edit Forum Settings -> Set Custom Permissions next to Guests -> uncheck Can view threads within forum? -> Save

That would hide all threads, essentially showing there aren't any threads in the forum. OP wants the threads to be visible, but not readable.