SMF 2.1.1 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


I got this to work beautifully.  Thank you!  It was just what I was looking for. 

How do I make it so that the login screen shows up instead of this:
QuoteAn Error Has Occurred!
The topic or board you are looking for appears to be either missing or off limits to you. 


I posted that somewhere else.  Search for "is_not_guest".



Here is so many try now that i dont know which one work and not work? Can somebody please help me and point out the working modification?

I need users to read forums but as fast they try to read some message they cant do it before registering. Also all interesting subjects are visible but when they try to open it for reading it say something "You have to register first" or something like that  8)



Thank you very much for this! I was searching for this answer :) The code worked perfectly!



Is it possible to allow membergroup -1 (guests) to be able to view the same boards as membergroup 1 (ungrouped), and not the admin/global mod boards like the recycle bin?

I don't really feel it's very effective to have to change the board numbers in the source code each time we mess around with the boards.


I just did this mod by editing the BoardIndex.php and Load.php.  Everything works well now... guests can now view all the boards, and they must login to enter a board.  But now my Users Online Today mod is not working.  Can anyone help?



What happens to the online users today mod? Have you tried reinstalling it?

Sea Of Sin


This is what I did...

Quote from: [Unknown] on September 05, 2004, 11:37:51 PM
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)" : '') . ")

Quote from: [Unknown] on April 16, 2005, 04:49:34 PM

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);


The first batch of code is to lock the boards for guest.  The second code is to display the login box.  And now the Users Online Today field on the bottom of the forum is empty.  Did I do something wrong?

No I haven't reinstall the mod.  Will I lose the old records if I reinstall it?


This shouldn't affect that mod in any way.  You may wish to contact the mod's author - in the topic about the mod.




This isn't working with 1.0.5.  Is there something else that needs to be modified?


It's working on mine.  Just modify the quoted code above.

And don't forget the uncheck Guest access on each board.


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?


This is what I have been looking for.  I assume, since I want to show just some boards, that all I need to do is use this mod (boardindex change).  When I moded the line though, I got a fatal error further down in the code, in this area:

Quote// Counting child board posts is... slow :/.
         if (!empty($modSettings['countChildPosts']))
            $this_category[$row_board['ID_PARENT']]['posts'] += $row_board['numPosts'];
            $this_category[$row_board['ID_PARENT']]['topics'] += $row_board['numTopics'];

Here is what I changed:

QuoteWHERE $user_info[query_see_board]" . (empty($modSettings['countChildPosts']) ? "

QuoteWHERE ($user_info[query_see_board]" . ($user_info['is_guest'] ? " OR b.ID_BOARD IN (12, 13)" : '') . ") . (empty($modSettings['countChildPosts']) ? "

Also tried to remove . (empty($modSettings['countChildPosts']) ? "  and it gave me a database error.


You want to replace this:

WHERE $user_info[query_see_board]" . (empty($modSettings['countChildPosts']) ? "
AND b.childLevel <= 1" : ''), __FILE__, __LINE__);


WHERE ($user_info[query_see_board]" . ($user_info['is_guest'] ? " OR b.ID_BOARD IN (12, 13)" : '') .')' . (empty($modSettings['countChildPosts']) ? "
AND b.childLevel <= 1" : ''), __FILE__, __LINE__);



I still get a database error when I add your mod to it.   :'(

         It works!!  Must have been too sleepy last night to copy and paste it right!!  Thanks [unknown]!!!


One other question (sorry).  The mod works great for guests.  Is there any way to make it so that guests and regular members can see but not get into the board?  That way, only members of a specific group will be able to have access to the board.

Edit:  I should clarify this.  Once I did the mod, it worked perfectly.  The only problem is that if a user is registered, they can not see boards 12 and 13 once they log in.  These boards are set up for a specific group only and because you look for guest, they disappear once logged in.

Jay T

I am more confused now than before.

ALot different mods to do different things

What I want is for registered members to be able to see a moderator only thread but not to be able to read or post in it. It should only be visible on the index page.


You want to replace this:

WHERE $user_info[query_see_board]" . (empty($modSettings['countChildPosts']) ? "
AND b.childLevel <= 1" : ''), __FILE__, __LINE__);


WHERE ($user_info[query_see_board]" . ($user_info['is_guest'] ? " OR b.ID_BOARD IN (12, 13, 27)" : ' OR b.ID_BOARD IN (12, 13, 27)') . ')' . (empty($modSettings['countChildPosts']) ? "
AND b.childLevel <= 1" : ''), __FILE__, __LINE__);

Just put your board number in both spots and you are all set, worked for me.


All right, I'm pretty green when it comes to codes. I want guests to be able to view all the boards on my forum, but I want to block access only to some of my boards, not all of them. Is this possible?