MyBB Community Forums

Full Version: Prevent guests from viewing threads
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How to prevent guests from viewing threads

If they click on any thread they should see log in page.

How to do this??
It shows error " Guests Cant view threads"

I want to show login page
maybe possible via a plugin. hackforums.net has it. better to ask them
I've got this on my forum but I done it through a hard written change in showthread.php, it's only a few lines.

Find
// Does the user have permission to view this thread?
if($forumpermissions['canview'] != 1 || $forumpermissions['canviewthreads'] != 1)
{
	error_no_permission();
}

And change it to be like
// Does the user have permission to view this thread?
if($forumpermissions['canview'] != 1 || $forumpermissions['canviewthreads'] != 1)
{
	error_no_permission();
}

/****** Guests can see threads but not read any*****/
if ($mybb->user['usergroup'] == 1)
{
    error_no_permission();
} 
/**** END Guests ****/


If you want to include awaiting activation people into the mix then change
if ($mybb->user['usergroup'] == 1)
to
if ($mybb->user['usergroup'] == 1 || $mybb->user['usergroup'] == 5)


This is all assuming that your usergroup ID's are defualt where 1 = guest and 5 = awaiting.

If you want to make it so they can read some forums/category's but not others let me know.
Thanks... i want to know more. Is your code shows login page if user is guest??
And it blocks all forums or not?

I want to block all forums..
(2012-10-12, 09:51 AM)pro Wrote: [ -> ]Thanks... i want to know more. Is your code shows login page if user is guest??
And it blocks all forums or not?

I want to block all forums..

It blocks all forums. They can enter into them and see there are threads there and read the titles but if they click on any it goes to the login page that says "No permission etc...; please log in"

Exactly like HF if you're familiar with their setup.
Thank you so much..
AdminCP -> Users & Groups -> Groups -> Guests -> Forums and Posts -> Viewing Options -> Can view threads?
Hi, how can I do this: user clicks on forum name and he/she has login page (and no "forum empty")?

Thank you in advance
(2012-10-12, 03:34 AM)Client Wrote: [ -> ]I've got this on my forum but I done it through a hard written change in showthread.php, it's only a few lines.

Find
// Does the user have permission to view this thread?
if($forumpermissions['canview'] != 1 || $forumpermissions['canviewthreads'] != 1)
{
	error_no_permission();
}

And change it to be like
// Does the user have permission to view this thread?
if($forumpermissions['canview'] != 1 || $forumpermissions['canviewthreads'] != 1)
{
	error_no_permission();
}

/****** Guests can see threads but not read any*****/
if ($mybb->user['usergroup'] == 1)
{
    error_no_permission();
} 
/**** END Guests ****/


If you want to include awaiting activation people into the mix then change
if ($mybb->user['usergroup'] == 1)
to
if ($mybb->user['usergroup'] == 1 || $mybb->user['usergroup'] == 5)


This is all assuming that your usergroup ID's are defualt where 1 = guest and 5 = awaiting.

If you want to make it so they can read some forums/category's but not others let me know.

Well yes it works perfectly.
But is there a way to do it for specific Sections only?

I need a small help.

Thanks