Advertisement:

Author Topic: Allowing guests to see all Boards but not entering  (Read 244704 times)

Offline diplomat.

  • SMF Friend
  • Full Member
  • *
  • Posts: 545
  • Gender: Male
  • avidSOUND
    • avidSOUND
Re: Allowing guests to see all Boards but not entering
« Reply #20 on: December 04, 2004, 07:12:15 PM »
Wow! I find a solution!
I don't believe in myself!!!

well, in boardindex.php i changed:
Code: [Select]
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:
Code: [Select]
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!

Offline Elijah Bliss

  • Sophist Member
  • *****
  • Posts: 1,340
Re: Allowing guests to see all Boards but not entering
« Reply #21 on: January 14, 2005, 09:38:38 PM »
Has anyone been able to figure out how to just show individual boards?

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Guests
« Reply #22 on: January 15, 2005, 04:00:02 AM »
Sources/BoardIndex.php, find:

Code: [Select]
WHERE $user_info[query_see_board]
Replace with:

Code: [Select]
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]

Offline Elijah Bliss

  • Sophist Member
  • *****
  • Posts: 1,340
Re: Allowing guests to see all Boards but not entering
« Reply #23 on: January 16, 2005, 07:35:27 PM »
Sources/BoardIndex.php, find:

Code: [Select]
WHERE $user_info[query_see_board]
Replace with:

Code: [Select]
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.

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Allowing guests to see all Boards but not entering
« Reply #24 on: January 17, 2005, 01:04:57 AM »
You have to change MessageIndex.php too for the child boards to show from there.

-[Unknown]

Offline Elijah Bliss

  • Sophist Member
  • *****
  • Posts: 1,340
Re: Allowing guests to see all Boards but not entering
« Reply #25 on: January 17, 2005, 06:16:00 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:

Code: [Select]
$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__);

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Allowing guests to see all Boards but not entering
« Reply #26 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]

Offline Elijah Bliss

  • Sophist Member
  • *****
  • Posts: 1,340
Re: Allowing guests to see all Boards but not entering
« Reply #27 on: January 17, 2005, 06:53:10 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!

Offline IaGcT

  • Newbie
  • *
  • Posts: 9
Re: Allowing guests to see all Boards but not entering
« Reply #28 on: January 17, 2005, 04:17:26 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
Code: [Select]
// 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
Code: [Select]
// 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.

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Allowing guests to see all Boards but not entering
« Reply #29 on: January 17, 2005, 04:31:42 PM »
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]

Offline IaGcT

  • Newbie
  • *
  • Posts: 9
Re: Allowing guests to see all Boards but not entering
« Reply #30 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.

Offline Elijah Bliss

  • Sophist Member
  • *****
  • Posts: 1,340
Re: Allowing guests to see all Boards but not entering
« Reply #31 on: January 17, 2005, 08:30:15 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.

Offline diplomat.

  • SMF Friend
  • Full Member
  • *
  • Posts: 545
  • Gender: Male
  • avidSOUND
    • avidSOUND
Re: Allowing guests to see all Boards but not entering
« Reply #32 on: January 17, 2005, 08:44:46 PM »
you could do something like this...

open Display.template.php

look for:
Code: [Select]
function template_main()
{
global $context, $settings, $options, $txt, $scripturl, $modSettings;

add after:
Code: [Select]
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:
Code: [Select]
?>

and add above it:
Code: [Select]
}


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

Offline ThaJester

  • Semi-Newbie
  • *
  • Posts: 31
  • Gender: Male
  • Webmaster/Graphics Designer
    • Your Fate
Re: Allowing guests to see all Boards but not entering
« Reply #33 on: January 17, 2005, 09:05:08 PM »
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.
jester@your-fate.com

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

Offline Javis

  • Semi-Newbie
  • *
  • Posts: 10
Re: Allowing guests to see all Boards but not entering
« Reply #34 on: March 29, 2005, 11:46:49 PM »
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:

Code: [Select]
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.

Offline Hengis

  • Semi-Newbie
  • *
  • Posts: 90
  • Gender: Male
    • PC Help Forum.com
Re: Allowing guests to see all Boards but not entering
« Reply #35 on: April 16, 2005, 06:47:15 AM »
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

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Allowing guests to see all Boards but not entering
« Reply #36 on: April 16, 2005, 04:49:34 PM »
How would I go about making the same effect for ungrouped members?

Code: [Select]
WHERE ($user_info[query_see_board]" . ($user_info['is_guest'] ? " OR b.ID_BOARD IN (1, 2, 3)" : ' OR b.ID_BOARD IN (4)') . ")
Is there a way to change this as the "Error" message is a bit - well - non-friendly?

Find, Sources/Load.php:
Code: [Select]
fatal_lang_error('topic_gone', false);
Replace:
Code: [Select]
loadLanguage('Errors');
is_not_guest($txt['topic_gone']);

-[Unknown]

Offline Hengis

  • Semi-Newbie
  • *
  • Posts: 90
  • Gender: Male
    • PC Help Forum.com
Re: Allowing guests to see all Boards but not entering
« Reply #37 on: April 16, 2005, 07:22:28 PM »
[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

  • Guest
Re: Allowing guests to see all Boards but not entering
« Reply #38 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!

Offline † ÐëepÇuT¹ †

  • Jr. Member
  • **
  • Posts: 353
  • Gender: Male
  • YaBBSe
    • x3Generation
Re: Allowing guests to see all Boards but not entering
« Reply #39 on: April 18, 2005, 03:25:15 PM »
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