MyBB Community Forums

Full Version: Guests can't view threads.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
What code do I use and put on showthread.php, to disallow guests to view threads?

Something in style of this... (taken from modcp.php)

if($mybb->user['uid'] == 0 || $mybb->usergroup['canmodcp'] != 1)
{
	error_no_permission();
}

And, NO. I do not want any plugins.
there's no need to edit anything, just change the visitors group's permissions.
No. Because then this happens.

[Image: jnHCOoXASo0m3.png]
(2011-10-11, 02:01 PM)Clone Wrote: [ -> ]And, NO. I do not want any plugins.

(2011-10-11, 02:09 PM)PJGIH Wrote: [ -> ]http://mods.mybb.com/view/guest-s-can-t-view-threads

Please read the thread.
I think you'll have to use a plugin.
(2011-10-11, 02:12 PM)Grime Wrote: [ -> ]I think you'll have to use a plugin.

No, I've done this before but I don't remember how.
$mybb->user['uid'] == 0 <-- checking if user is registered member OR guest
$mybb->usergroup['canmodcp'] != 1 <-- checking if usergroup has access to moderator panel

now can you refine your code ...
Ok, in showthread.php after line 354, add:

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

	$lang->send_thread = "";

And then in archive/index.php after line 109:

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

	$lang->send_thread = "";


(2011-10-11, 02:15 PM)PJGIH Wrote: [ -> ]Ok, in showthread.php after line 354, add:

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

	$lang->send_thread = "";

And then in archive/index.php after line 109:

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

	$lang->send_thread = "";

Thanks, but I want that error message that shows up with no permission.
And the code didn't work :/
Managed to solve it Smile

I put

 if($mybb->user['uid'] == 0)
                    {
                          error_no_permission();  
                    }

On line 28, after $parser = new postParser;

Big Grin
Though, when signed in, you get redirected to the index page. Any fix to that?
Pages: 1 2