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.
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
I put
if($mybb->user['uid'] == 0)
{
error_no_permission();
}
On line 28, after $parser = new postParser;
Though, when signed in, you get redirected to the index page. Any fix to that?