Member only view list of thread but can't view thread
lenkbreak Offline
Junior Member
**
Posts: 23
Joined: Apr 2012
Post: #1
Member only view list of thread but can't view thread
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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?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 = "";
}
?>

(This post was last modified: 06-05-2012 04:21 PM by lenkbreak.)
06-05-2012 04:11 PM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #2
RE: Member only view list of thread but can't view 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.


Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
06-05-2012 04:56 PM
Visit this user's website Find all posts by this user Quote this message in a reply
lenkbreak Offline
Junior Member
**
Posts: 23
Joined: Apr 2012
Post: #3
RE: Member only view list of thread but can't view thread
@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?
06-05-2012 06:12 PM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #4
RE: Member only view list of thread but can't view thread
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");


Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
(This post was last modified: 06-05-2012 06:21 PM by Sama34.)
06-05-2012 06:21 PM
Visit this user's website Find all posts by this user Quote this message in a reply
lenkbreak Offline
Junior Member
**
Posts: 23
Joined: Apr 2012
Post: #5
RE: Member only view list of thread but can't view thread
sorry it works!
thanks bro, i miss ' code Biggrin
06-05-2012 06:21 PM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #6
RE: Member only view list of thread but can't view thread
Alright, glad to hear.

Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
06-05-2012 06:22 PM
Visit this user's website Find all posts by this user Quote this message in a reply
lenkbreak Offline
Junior Member
**
Posts: 23
Joined: Apr 2012
Post: #7
RE: Member only view list of thread but can't view thread
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')

(This post was last modified: 06-05-2012 06:46 PM by lenkbreak.)
06-05-2012 06:45 PM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #8
RE: Member only view list of thread but can't view thread
maybe

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



[Image: leelink.gif]
MYBB1.6 & XThreads
06-05-2012 06:49 PM
Visit this user's website Find all posts by this user Quote this message in a reply
lenkbreak Offline
Junior Member
**
Posts: 23
Joined: Apr 2012
Post: #9
RE: Member only view list of thread but can't view thread
@leefish
error for me bro...
06-05-2012 06:59 PM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #10
RE: Member only view list of thread but can't view thread
yea, sorry - that was why it was a maybe.

Best not to call me bro. I am female Biggrin ....


[Image: leelink.gif]
MYBB1.6 & XThreads
06-05-2012 07:20 PM
Visit this user's website Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: