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

Avinash4

Yeah, we really need this in 1.1. This method wont work for my RC2.
McMaster University's Largest Online Community
http://mac-central.com
Powered by SMF and Mambo

definitive

Hello is it possible to allow guests to see the first 250 chars of the topics and then a message "You must register to read the rest" ?

I am using 1.1 RC2

Thanks

L.G.S

Quote from: Avinash4 on January 25, 2006, 12:15:56 AM
Yeah, we really need this in 1.1. This method wont work for my RC2.

I have RC2 and it worked perfect.

Make sure you have 'Aloow guests to browse the boards' in features and options ticked
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


fiver

#123
Quote from: definitive on February 12, 2006, 11:29:21 AM
Hello is it possible to allow guests to see the first 250 chars of the topics and then a message "You must register to read the rest" ?

I am using 1.1 RC2

Thanks

You can combine Read Topic Permission with MessagePreview Inline.

Demo: http://www.fivearts.net/rc2/index.php?board=1.0

definitive

Quote from: fivearts on February 13, 2006, 12:32:07 AM
Quote from: definitive on February 12, 2006, 11:29:21 AM
Hello is it possible to allow guests to see the first 250 chars of the topics and then a message "You must register to read the rest" ?

I am using 1.1 RC2

Thanks

You can combine Read Topic Permission with MessagePreview Inline.

Demo: http://www.fivearts.net/rc2/index.php?board=1.0

thanks, but this work when guest enters a board, no way when he enters a topic

md80forum

Got my package manager screaming when I tried to install the Read Topic Permission mod ...

Jan-Erik

bugsmi0

Now that I understand how to allow visitors to see boards without accessing

how would I set up just one board or category to remain hidden until user logs in ?

Dinagyang

what about to limit guest access by time or page views?

~dragonfly~

I've tried this mod and I'm getting an error.  I'm new to this and have read through this entire thread, but I'm not sure if I did it wrong, or there is another issue.  I'm using 1.1 RC2

In Sources/BoardIndex, I replaced

QuoteWHERE $user_info[query_see_board]

with

QuoteWHERE ($user_info[query_see_board]" . ($user_info['is_guest'] ? " OR b.ID_BOARD IN (2, 3, 4, 5, 6, 7, 8, 14, 15)" : '') . ") .

That is on line 82.

The error message I get is

QuoteParse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /Sources/BoardIndex.php on line 82

I also unchecked guest permission in each of the boards.  Any thoughts would be appreciated  :)

~dragonfly~

I read through the more recent posts in the thread and figured it out the one minor change I needed to make.  Its working for me now using RC2.   :)




mrandall131

There was a post from unknown, in response to me, pretty early on in the thread.  I put that code in, RC2 even, and I have no problems and the mod works great.

Here is the only change I made, in BoardIndex.php

You want to replace this:

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


With:

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.

(This was from post 58)

BigPapaPorsche

Thanks to whoever started this thread and all who contributed within.  I need a little bit of help to complete this mod on my forums.  I am currently running 1.1rc2.  I have edited the Sources/Boardindex.php file with the suggested code.

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


After I did this smf shows all of the board id's specified within the WHERE statement to guests.  When they click on the link to see the topics within the board they are prompted for their username and password.  I would like them to be able to see the topic titles and promted for username and password when they click the link to enter a specific topic.  In other words I do not want guests to see the actual content of the site.  I know Uknown mentioned something about editing Sources/Messageindex.php but I was hoping someone could clarify this for me.  The string he suggested that needed editing has two appearences within the file.


I believe this is what Uknown suggested to be edited


1st apearence
// Load up the child boards.
                $result = db_query("
                        SELECT
                                b.ID_BOARD, b.ID_PARENT, 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, ID_PARENT,
                                " . ($user_info['is_guest'] ? '1' : '(IFNULL(lb.ID_MSG, 0) >= b.ID_MSG_UPDATED)') . " AS isRead,
                                IFNULL(mem.ID_MEMBER, 0) AS ID_MEMBER
                        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)" : '') . "
                        WHERE " . (empty($modSettings['countChildPosts']) ? "b.ID_PARENT IN (" . implode(',', $theboards) . ")" : "childLevel > 0") . "
                                [color=red]AND $user_info[query_see_board]", __FILE__, __LINE__);[/color]
                $parent_map = array();
                while ($row = mysql_fetch_assoc($result))



2nd apearence
// Aren't children wonderful things?
        $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.ID_MSG, 0) >= b.ID_MSG_UPDATED) 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.ID_PARENT = $board
                        [color=red]AND $user_info[query_see_board]", __FILE__, __LINE__);[/color]
        if (mysql_num_rows($result) != 0)



I am not exactly sure of the code I should be editing them with or if either or both statments should be edited.  Can someone please clarify for me?

Thanks,
David

Avinash4

Quote from: ~dragonfly~ on March 04, 2006, 11:26:38 PM
I read through the more recent posts in the thread and figured it out the one minor change I needed to make.  Its working for me now using RC2.   :)





care to share?
McMaster University's Largest Online Community
http://mac-central.com
Powered by SMF and Mambo

jfertic

Well I have read this thread for hours now and can not seem to make it work. I have tried all three versions of the hack and it will not work as described. I am running RC2 with MK RC1. Maybe that has something to do with it.

The best it did for me was make the board not viewable by guests. I ticked the boxes, and unticked the boxes. Still nothing.

Is there a set way that this works. I see three different ways to change the code for this hack and none seen to work for me? And...has this been packaged as a mod?

jfertic
Searchable Directory of Tower Construction Resources:

http://towerclimbersgroup.com

mrandall131

If you used the hack I posted a few posts up, then all you have to do is just make it so that the guests don't have access to the board (uncheck the guests on the board access list, that's it).  Then, using the hack, the board shows up on the index. 

jfertic

Thanks for the reply. That was the code I modified in boardindex.php. When I unchecked the box for guest access, the board disappeared when viewing the site as a guest. I even tried clearing the cache but was the same.. I will try it again today and see if I somehow got something wrong.

Thanks Again!

jfertic
Searchable Directory of Tower Construction Resources:

http://towerclimbersgroup.com

jfertic

Ok, I have tried the code you mentioned in your post. Cut an paste it properly into boardindex.php, and unchecked the access for that particular board. I logged out of admin to guest, and the boards are not visable anymore. This is the same thing that happened the last time.

My best guess is that it might be one of my mods creating the problem. Any ideas? I will g=be glad to listen. I would really like to use this hack on my site.

jfertic
Searchable Directory of Tower Construction Resources:

http://towerclimbersgroup.com

mrandall131

Did you make sure you listed the boards you wanted to be visible in both areas of the hack?  That's all I can figure that would be wrong. 

jfertic

I did list in both sides of the code. The only thing I can think of is trying to turn off "allow guests to browse forums" in the admin panel.

When I turn off individual boards, they disappear from the forum index. The only other thing that I can think is one of the mods is blocking the hack from working correctly. At least two of them I know for sure modify the boardindex.php file as well as the SSI.php file.

Well, thanks again for the advice! I will keep messing with it.

jfertic
Searchable Directory of Tower Construction Resources:

http://towerclimbersgroup.com

bugsmi0

Quote from: mrandall131 on March 05, 2006, 11:26:06 AM
There was a post from unknown, in response to me, pretty early on in the thread.  I put that code in, RC2 even, and I have no problems and the mod works great.

Here is the only change I made, in BoardIndex.php

You want to replace this:

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


With:

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.

(This was from post 58)

curious, does this apply to childboards as well ? i tried it and it shows the childboard, is there anyway to also restrict certain childboards as well ?

Advertisement: