MyBB Hacks

Full Version: Member only view list of thread but can't view thread
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi all
Thanks for RateU and others who supported me in my last thread. Yipi

I need some help from u guys..
let me explain about the situation first.

in example, I have a forum with 4 usergroups beside admin, mod, supmod, awaiting activation and banned. let see those groups are A, B, C and D.
when somebody register on my forum, they will automatically in A group and after certain of post, they will promote to B, C, and D.

for some reason, I have to make a private subforum and I set only member on B, C and D group can view and post like normal forum.

my problem is, I can set A group permissions so they only can see the specify forum not thread within the specify forum in Admin CP of mybb, but what I want is they can see the list of threads within specify forum, but they can't view it or when they click it, they will see error page or rules page or something like that.

is possible to do this?

I found plugin called guest can't view thread
can I use the codes with some modifications for my purpose?

code is like this

PHP Code:
<?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("I'm afraid I cannot let you view that! Guest thread viewing is disabled, but why not sign up and join-in on the fun? We're not that scary, are we?","Error");
                    }
                    
    $lang->send_thread = "";
}
?>

If I understand correctly, you can change this:

PHP Code:
if($mybb->user['uid'] == 0)


To something like this:

PHP Code:
if($mybb->user['gid'] == 'A' && $thread['fid'] == 'X')


Where X is the forum ID of the desired forum, and A is the group that cannot see the thread.

Changing the error text seems necessary as well.

@sama34
thanks for your response
but, for me it's not work

if I don't want to use that plugin, where should I put that code?
Ad this:

PHP Code:
if($mybb->user['gid'] == 'A' && $thread['fid'] == 'X')
{
error_no_permission();
}


And after (showthread.php):

PHP Code:
$plugins->run_hooks("showthread_start");


And after (archive/index.php):

PHP Code:
$plugins->run_hooks("archive_thread_start");

sorry it works!
thanks bro, i miss ' code Biggrin
Alright, glad to hear.
sorry, need your help again
I decided to use that plugin with your advice
it's only work for 1 subforum
how can I make it works for multi subforum

I'm trying like this and that plugin not works

PHP Code:
if($mybb->user['gid'] == '5' && $thread['fid'] == '1,2,5')

maybe

Code:
if($mybb->user['gid'] == '5' && $thread['fid'] IN ('1,2,5'))

@leefish
error for me bro...
yea, sorry - that was why it was a maybe.

Best not to call me bro. I am female Biggrin ....
Pages: 1 2
Reference URL's