News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Allowing guests to see all Boards but not entering

Started by trenchteam, September 05, 2004, 11:19:01 PM

Previous topic - Next topic

trenchteam

I want guests to be able to see all the boards, but when the click the board, its says they have no access to it without login. How do I do this. WHen i set permissons in the admin, when your a guest the board just doesnt appear at all to them.   I want it to be able to be seen, but disable access until they are registered.  not sure if this makes sense.

[edit] changed topic title [/edit]

[Unknown]

Sources/BoardIndex.php, find:

WHERE $user_info[query_see_board]

Replace with:

WHERE ($user_info[query_see_board]" . ($user_info['is_guest'] ? " OR FIND_IN_SET('0', b.memberGroups)" : '') . ")

--> Tips and Tricks.

-[Unknown]

CapriSkye

ha i thought you could just do this with the permissions...but i guess not

trenchteam

#3
thanks. worked perfectly.

trenchteam

Quote from: CapriSkye on September 05, 2004, 11:51:57 PM
ha i thought you could just do this with the permissions...but i guess not
No it doesnt. I attempted that.  Didn't work.

[Unknown]

For Sources/MessageIndex.php, find:

$user_info[query_see_board]

Replace with:

($user_info[query_see_board]" . ($user_info['is_guest'] ? " OR FIND_IN_SET('0', b.memberGroups)" : '') . ")

-[Unknown]

farg

and allow all member's group to view all board?

for example:
now, with this mod, a guest can view a board for registred members but its says they (guests) have no access to it without login.. ok!...
but if a board is for supermoderator only? Guest and registred members not see it  :(

i want that all board are visible for all user...

who's able to help me?

(excuse for may bad english!  :P)

Oldiesmann

Why do you want a board for super moderators to be visible to guests and all registered members who can't post in it?
Michael Eshom
Christian Metal Fans

farg

ehm..
i've create a forum for Vip (user with 40 posts) and i want that this forum is visible for all (but non entering/access)!!
smf has many option for permission but it hasn't most important permission (like ipb2)
i hope so  ;)

Oldiesmann

I'll see what I can come up with, but I still don't understand why you'd want a board to be visible to everyone who can't post there...
Michael Eshom
Christian Metal Fans

farg

because i want it  ;D

for me: if a user view a forum inaccessible but  interesting, he is induces to post and post and post  ;)
but if a forum is hided the user go out from site!  :'(

Oldiesmann

Ok. Give me a minute to look at something and see what I can do here...
Michael Eshom
Christian Metal Fans

Oldiesmann

Ok. Try this and see if it works.

Sources/BoardIndex.php

Find
WHERE $user_info[query_see_board]
AND b.ID_CAT = c.ID_CAT
AND b.childLevel <= 1
ORDER BY c.catOrder, b.childLevel, b.boardOrder", __FILE__, __LINE__);


Replace
WHERE $user_info[query_see_board] || b.ID_BOARD = '{boardid}'
AND b.ID_CAT = c.ID_CAT
AND b.childLevel <= 1
ORDER BY c.catOrder, b.childLevel, b.boardOrder", __FILE__, __LINE__);


Just replace {boardid} with the ID number of the board you want them to see. I think that will work, but if it doesn't, let me know.
Michael Eshom
Christian Metal Fans

farg

thank's but it doesn't works  :(
the forum id that i choice doesn't shows, and board index show all other forums 3 times  ??? ::)
(if it works is possible to choice many forum id to show?)

farg

Wow! I find a solution!
I don't believe in myself!!!

well, in boardindex.php i changed:
WHERE $user_info[query_see_board]
AND b.ID_CAT = c.ID_CAT
AND b.childLevel <= 1
ORDER BY c.catOrder, b.childLevel, b.boardOrder", __FILE__, __LINE__);



with:
WHERE  b.ID_CAT = c.ID_CAT
AND b.childLevel <= 1
ORDER BY c.catOrder, b.childLevel, b.boardOrder", __FILE__, __LINE__);


it's work, now all forum are visible (only eheh ;D)

thank's Oldiesmann for lost time with me....

Oldiesmann

As long as you don't mind letting all users see every board, that will work just fine. I thought $user_info[query_see_board] returned either TRUE or FALSE, but maybe it doesn't... Anyway, just for future reference, here's how you would accomplish this:

Sources/Load.php

Find
// Just build this here, it makes it easier to change/use.
if ($user_info['is_guest'])
$user_info['query_see_board'] = 'FIND_IN_SET(-1, b.memberGroups)';
// Administrators can see all boards.
elseif ($user_info['is_admin'])
$user_info['query_see_board'] = '1';


Replace
// Administrators (and guests) can see all boards. (Guests get a "you have to register" message :D)
if ($user_info['is_admin'] || $user_info['is_guest'])
$user_info['query_see_board'] = '1';
Michael Eshom
Christian Metal Fans

farg

well! the guest and Admin view all boards, but a Junior Member (10posts) not see a forum for Vip Member (60 posts)... (or for moderator's category)

[Unknown]

It is often a much longer string.  You want to use parenthesis when doing ORs in queries.

Remember...

x AND y OR z AND v

Is what you had.  But, what you want is:

x AND (y OR z) AND v

There's a huge difference.

-[Unknown]

Trekkie101

AND

0   0    0
0   1    0
1   0    0
1   1    1

OR

0    0   0
0    1   1
1    0   1
1    1   1

Dunno why was just needed, lol, ask for more if you want.


Advertisement: