News:

Want to get involved in developing SMF, then why not lend a hand on our github!

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

diplomat.

Quote from: forgyx on December 02, 2004, 12:33:23 PM
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....


anyway that could be done but also block them from seeing the last post that was in that board...so instead if it saying:

Date
In: Wow, what a game!!!!
By: Diplomat

they see something like

Date
Protected Board
avidSOUND.com: Where Aspiring Musicians Can Be HEARD!

Elijah Bliss

Has anyone been able to figure out how to just show individual boards?

[Unknown]

Sources/BoardIndex.php, find:

WHERE $user_info[query_see_board]

Replace with:

WHERE ($user_info[query_see_board]" . ($user_info['is_guest'] ? " OR b.ID_BOARD IN (##, ##, ##)" : '') . ")

Where ##, ##, ## is a list of board IDs.

How do I modify files?

-[Unknown]

Elijah Bliss

Quote from: [Unknown] on January 15, 2005, 04:00:02 AM
Sources/BoardIndex.php, find:

WHERE $user_info[query_see_board]

Replace with:

WHERE ($user_info[query_see_board]" . ($user_info['is_guest'] ? " OR b.ID_BOARD IN (##, ##, ##)" : '') . ")

Where ##, ##, ## is a list of board IDs.

How do I modify files?

-[Unknown]

It works (I had to uncheck guest access to the board I wanted to showcase). It doesn't quite work with childboards, as a guest, the childboards are visible in the board index but not visible in the message index.

[Unknown]

You have to change MessageIndex.php too for the child boards to show from there.

-[Unknown]

Elijah Bliss

Quote from: [Unknown] on January 17, 2005, 01:04:57 AM
You have to change MessageIndex.php too for the child boards to show from there.

-[Unknown]

I'm not quite sure which one of these lines to edit since the "WHERE $user_info[query_see_board]" line isn't present in the MessageIndex.php:

$result = db_query("
SELECT
b.ID_BOARD, b.name, b.description, b.numTopics, b.numPosts,
m.posterName, m.posterTime, m.subject, m.ID_MSG, m.ID_TOPIC,
IFNULL(mem.realName, m.posterName) AS realName, " . (!$user_info['is_guest'] ? "
(IFNULL(lb.logTime, 0) >= b.lastUpdated) AS isRead," : "1 AS isRead,") . "
IFNULL(mem.ID_MEMBER, 0) AS ID_MEMBER, IFNULL(mem2.ID_MEMBER, 0) AS ID_MODERATOR,
mem2.realName AS modRealName
FROM {$db_prefix}boards AS b
LEFT JOIN {$db_prefix}messages AS m ON (m.ID_MSG = b.ID_LAST_MSG)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)" . (!$user_info['is_guest'] ? "
LEFT JOIN {$db_prefix}log_boards AS lb ON (lb.ID_BOARD = b.ID_BOARD AND lb.ID_MEMBER = $ID_MEMBER)" : '') . "
LEFT JOIN {$db_prefix}moderators AS mods ON (mods.ID_BOARD = b.ID_BOARD)
LEFT JOIN {$db_prefix}members AS mem2 ON (mem2.ID_MEMBER = mods.ID_MEMBER)
WHERE b.childLevel = " . ($board_info['child_level'] + 1) . "
AND b.ID_PARENT = $board
AND $user_info[query_see_board]
ORDER BY b.boardOrder", __FILE__, __LINE__);

[Unknown]

Same thing:

AND $user_info[query_see_board]

Just replace it with the same thing, but use AND instead of WHERE.

-[Unknown]

Elijah Bliss

Quote from: [Unknown] on January 17, 2005, 06:17:46 AM
Same thing:

AND $user_info[query_see_board]

Just replace it with the same thing, but use AND instead of WHERE.

-[Unknown]

It worked, thanks!

IaGcT

Quote from: Oldiesmann on December 02, 2004, 01:31:00 PM
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';


I don't know if it's just me, but for some reason I did this and the guests don't get a "You have to register" message. I put in all the code from the previous posts, too. Under "Edit Features and Options", am I supposed to check off "Allow guests to browse forums"? Because with this on, when I log out and I'm a guest, I can see all the boards and topics and stuff.

[Unknown]

Umm, this is specifically to make that happen.  If you want them to be able to view the board, just use regular access permissions.

-[Unknown]

IaGcT

Sorry... I think you misunderstood...

What I mean is that a guest can browse the forums. When he/she clicks on a board, he/she can read all the posts, but can't post a reply or make a new topic.

What I was trying to do is to have a guest browse the forums and then when they click on a board, it'll say, "You have to register" or something like that. And I think that's what this topic is about.

So I did everything here and it wouldn't work. Guests can still browse the forums and read topics and posts.

Elijah Bliss

Quote from: IaGcT on January 17, 2005, 07:30:22 PM
Sorry... I think you misunderstood...

What I mean is that a guest can browse the forums. When he/she clicks on a board, he/she can read all the posts, but can't post a reply or make a new topic.

What I was trying to do is to have a guest browse the forums and then when they click on a board, it'll say, "You have to register" or something like that. And I think that's what this topic is about.

So I did everything here and it wouldn't work. Guests can still browse the forums and read topics and posts.

Apply [Unknown]'s modifications to the BoardIndex.php and the MessageIndex.php.
Next go to "Manage Boards" and in the permissions uncheck guest access.

Guest will still be able to see the board but will have no access.

Now as far as guests viewing threads in the message index but not being able read them; I believe I saw a mod for that around here for that, it was a line of code, you'll have to search. I know babylonking has his forum setup like that.

diplomat.

you could do something like this...

open Display.template.php

look for:

function template_main()
{
global $context, $settings, $options, $txt, $scripturl, $modSettings;


add after:

if ($context['user']['is_guest'])
{
echo '
<div align="center">Please login or register to view topics</div>';
}
else
{


then look for at the very bottom:

?>


and add above it:

}



that should work
avidSOUND.com: Where Aspiring Musicians Can Be HEARD!

ThaJester

The answer to my question may already be here, and I just haven't looked hard enough, however, what was the working way to allow guests and members to see forums that are restricted to them, and not access them?


And to the person that didn't understand why anyone would want to be able to do this, it's simple.

You have the forum "100 Post Club" that only allows a member group that has atleast 100 posts to access it, and you're using this as motivation to keep your members active. Well, this does no good if people with less then 100 posts can't see the forum.
[email protected]

Website | Forums | Public Directory

"People's desires a powerful. The stronger they grow the more beyond ones control they become. Perhaps the gap between love and hate is paper thin."
- Kenshin

Javis

How would I go about making the same effect for ungrouped members?

I'll explain. I'm using Unknown's code from this thread in my current setup:

WHERE ($user_info[query_see_board]" . ($user_info['is_guest'] ? " OR b.ID_BOARD IN (1, 2, 3)" : '') . ")

This causes it so guests can see only those boards, but when they click on it they get a message that they need access.

So what I need to accomplish is, let's say board ID 4 is a special permission board. It's viewable as a member but you get the same message saying they don't have access. That is until they are added to a group that does.

Hengis

Hi guys,

Great Mod - have applied it to my forum: PC Help Forum.com

One question - when visitors click to go into a topic/board that I have restricted to members they get the "An Error Has Occurred!
The topic or board you are looking for appears to be either missing or off limits to you." message and not the "Only registered members are allowed to access this section.
Please login below or register an account with..." message. :(

Is there a way to change this as the "Error" message is a bit - well - non-friendly?


Visit www.pchelpforum.com for all your PC support needs

[Unknown]

Quote from: Javis on March 29, 2005, 11:46:49 PM
How would I go about making the same effect for ungrouped members?

WHERE ($user_info[query_see_board]" . ($user_info['is_guest'] ? " OR b.ID_BOARD IN (1, 2, 3)" : ' OR b.ID_BOARD IN (4)') . ")

Quote from: Hengis on April 16, 2005, 06:47:15 AM
Is there a way to change this as the "Error" message is a bit - well - non-friendly?

Find, Sources/Load.php:
fatal_lang_error('topic_gone', false);

Replace:
loadLanguage('Errors');
is_not_guest($txt['topic_gone']);


-[Unknown]

Hengis

[Unknown] is simply an SMF god!

It works, of course :)

Thank you for your time on this.
Visit www.pchelpforum.com for all your PC support needs

SeaOfSin

Not sure if this was answered above but how do you make it possible for guests to see and access all board but one?  I have a forum where there is one board that is hidden from guests, but I want the guest to see the board but not access it!

† ÐëepÇuT¹ †

Quote from: SeaOfSin on April 18, 2005, 01:58:48 AM
Not sure if this was answered above but how do you make it possible for guests to see and access all board but one?  I have a forum where there is one board that is hidden from guests, but I want the guest to see the board but not access it!

You could just simply allow that board to be accessible to guests via the Board Manager > Permissions page... (lol)



Personal Website
x3Generation - gaming
graphics and anime.
 

Favorite Forums
> SimpleMachines Forum
> GamerzPlanet Forums


Advertisement: