Advertisement:

Author Topic: View Only Boards  (Read 231053 times)

Offline Hj Ahmad Rasyid Hj Ismail

  • SMF Hero
  • ******
  • Posts: 4,916
  • Gender: Male
  • Busy mode is on.
    • ahmad.rasyid.ismail on Facebook
    • ahrasis on GitHub
    • ahrasis on LinkedIn
    • @ahrasis on Twitter
    • ElkArte Malaysia
Re: View Only Boards
« Reply #480 on: August 04, 2010, 08:30:44 PM »
3. Edit your ManageBoards.template.php
I have fixed that so you don't need to edit. Modified file is attached.

EDITED: Attachement removed. Please use this one: http://www.simplemachines.org/community/index.php?topic=146964.msg2734095#msg2734095
« Last Edit: August 08, 2010, 08:30:49 AM by ahrasis »

Offline sharks

  • Sr. Member
  • ****
  • Posts: 891
  • Gender: Male
  • There's always a way.
Re: View Only Boards
« Reply #481 on: August 06, 2010, 12:02:08 PM »
There is a bug with the 2.0 RC3 version. If the option to list all recent posts is enabled, it will list all the latest posts, even if some of the posts are in boards which have been set to invisible and/or inaccessible to guests.
SMF 2.0 Theme Color Editor
http://www.colorizeit.com/browse/24/smf-20-themes.html

SMF Package Parser to view all edits made by any modification package:
http://resourcez.biz/PackageParser/

Firefox is the best browser for SMF!
http://www.mozilla.com/en-US/firefox/fx/

Offline Hj Ahmad Rasyid Hj Ismail

  • SMF Hero
  • ******
  • Posts: 4,916
  • Gender: Male
  • Busy mode is on.
    • ahmad.rasyid.ismail on Facebook
    • ahrasis on GitHub
    • ahrasis on LinkedIn
    • @ahrasis on Twitter
    • ElkArte Malaysia
Re: View Only Boards
« Reply #482 on: August 06, 2010, 02:21:49 PM »
There is a bug with the 2.0 RC3 version. If the option to list all recent posts is enabled, it will list all the latest posts, even if some of the posts are in boards which have been set to invisible and/or inaccessible to guests.
I agree with you sharks. I have made some effort to check and (I think I had) fixed it. Please try and see how it goes. It is working on my site.

EDITED: Attached mod refixed due the error reported by sharks.
« Last Edit: August 07, 2010, 12:58:16 PM by ahrasis »

Offline sharks

  • Sr. Member
  • ****
  • Posts: 891
  • Gender: Male
  • There's always a way.
Re: View Only Boards
« Reply #483 on: August 07, 2010, 10:58:37 AM »
In the boards set to visible only, but not accessible, normally, on the board index, you should see this:
Last post by Protected
in Protected

but instead, i still see the actual last post and the last topic, which should both not be visible.
SMF 2.0 Theme Color Editor
http://www.colorizeit.com/browse/24/smf-20-themes.html

SMF Package Parser to view all edits made by any modification package:
http://resourcez.biz/PackageParser/

Firefox is the best browser for SMF!
http://www.mozilla.com/en-US/firefox/fx/

Offline Hj Ahmad Rasyid Hj Ismail

  • SMF Hero
  • ******
  • Posts: 4,916
  • Gender: Male
  • Busy mode is on.
    • ahmad.rasyid.ismail on Facebook
    • ahrasis on GitHub
    • ahrasis on LinkedIn
    • @ahrasis on Twitter
    • ElkArte Malaysia
Re: View Only Boards
« Reply #484 on: August 07, 2010, 11:17:21 AM »
In the boards set to visible only, but not accessible, normally, on the board index, you should see this:
Last post by Protected
in Protected

but instead, i still see the actual last post and the last topic, which should both not be visible.
What you are saying does not make sense to me. If the board is visible, the topic is also visible but not accessible. If the board is not accessible and not visible then it would not show, at all.

Offline waqarhassan

  • Semi-Newbie
  • *
  • Posts: 18
  • YouGeo.com
    • GSM Mobile Phones Prices, Specifications, News & Reviews
Re: View Only Boards
« Reply #485 on: August 07, 2010, 11:20:15 AM »
i have also installed it this is very useful thing its works fine in my forum

Offline sharks

  • Sr. Member
  • ****
  • Posts: 891
  • Gender: Male
  • There's always a way.
Re: View Only Boards
« Reply #486 on: August 07, 2010, 11:34:07 AM »
In the boards set to visible only, but not accessible, normally, on the board index, you should see this:
Last post by Protected
in Protected

but instead, i still see the actual last post and the last topic, which should both not be visible.
What you are saying does not make sense to me. If the board is visible, the topic is also visible but not accessible. If the  board is not accessible and not visible then it would not show, at all.

But that's the way it works when installed in SMF 1.1.11
I would expect it to behave the same way in SMF 2.0 RC3.
And v2 still does not fix the problem with posts appearing in the recent posts list on the index forum page, when some board has been set to visible only, but not accessible. Try it out on SMF 1.1.11 and you will see the differences of what i mean.

Here is what i see in Features and Options on SMF 1.1.11

Allow guests to browse the forum     (checked)
Show the message index for "view only" boards (unchecked)

Both options also exist in SMF 2.0 RC3 but the second option does not work 100%. If unchecked, that second option should "protect" the last topic title and last post in the visible-only board. That's the way it works on SMF 1.1.11
« Last Edit: August 07, 2010, 11:46:54 AM by sharks »
SMF 2.0 Theme Color Editor
http://www.colorizeit.com/browse/24/smf-20-themes.html

SMF Package Parser to view all edits made by any modification package:
http://resourcez.biz/PackageParser/

Firefox is the best browser for SMF!
http://www.mozilla.com/en-US/firefox/fx/

Offline Hj Ahmad Rasyid Hj Ismail

  • SMF Hero
  • ******
  • Posts: 4,916
  • Gender: Male
  • Busy mode is on.
    • ahmad.rasyid.ismail on Facebook
    • ahrasis on GitHub
    • ahrasis on LinkedIn
    • @ahrasis on Twitter
    • ElkArte Malaysia
Re: View Only Boards
« Reply #487 on: August 07, 2010, 11:39:33 AM »
Yes. It doesn't work similarly to 1.1.x. The name is clearly view only board which means the board can be made viewable or otherwise the default accessible (of course viewable) or not.

It does not protect the post access but it protects board access. So it is possible to list all this board topics and posts, recent or otherwise, without users being able to access when it is set to view only.

Offline sharks

  • Sr. Member
  • ****
  • Posts: 891
  • Gender: Male
  • There's always a way.
Re: View Only Boards
« Reply #488 on: August 07, 2010, 11:46:59 AM »
Bad News:

My 2.0 RC3 forum's error log is flooding like crazy right now, after installing v2. I get these 2 errors repeatedly.

8: Undefined variable: post
Only show the errors from this file
File: /home/user/sharks/Sources/Subs-Recent.php
Line: 84

8: Undefined index: ID_BOARD
Only show the errors from this file
File: /home/user/sharks/Sources/Subs-Recent.php
Line: 76
« Last Edit: August 07, 2010, 11:52:17 AM by sharks »
SMF 2.0 Theme Color Editor
http://www.colorizeit.com/browse/24/smf-20-themes.html

SMF Package Parser to view all edits made by any modification package:
http://resourcez.biz/PackageParser/

Firefox is the best browser for SMF!
http://www.mozilla.com/en-US/firefox/fx/

Offline Hj Ahmad Rasyid Hj Ismail

  • SMF Hero
  • ******
  • Posts: 4,916
  • Gender: Male
  • Busy mode is on.
    • ahmad.rasyid.ismail on Facebook
    • ahrasis on GitHub
    • ahrasis on LinkedIn
    • @ahrasis on Twitter
    • ElkArte Malaysia
Re: View Only Boards
« Reply #489 on: August 07, 2010, 11:50:37 AM »
Bad News:

My 2.0 RC3 forum's error log is flooding like crazy right now, after installing v2. I get these 2 errors repeatedly.

8: Undefined variable: post
Only show the errors from this file
File: /home/user/sharks/Sources/Subs-Recent.php
Line: 84

8: Undefined index: ID_BOARD
Only show the errors from this file
File: /home/user/sharks/Sources/Subs-Recent.php
Line: 76
Can your post from 10 lines before line 76 and 10 lines after line 84 in your Subs-Recent.php so I can check it?

Offline sharks

  • Sr. Member
  • ****
  • Posts: 891
  • Gender: Male
  • There's always a way.
Re: View Only Boards
« Reply #490 on: August 07, 2010, 11:52:20 AM »
It happens to all members when logged in and when guests are also browsing the boards. Help!
SMF 2.0 Theme Color Editor
http://www.colorizeit.com/browse/24/smf-20-themes.html

SMF Package Parser to view all edits made by any modification package:
http://resourcez.biz/PackageParser/

Firefox is the best browser for SMF!
http://www.mozilla.com/en-US/firefox/fx/

Offline Hj Ahmad Rasyid Hj Ismail

  • SMF Hero
  • ******
  • Posts: 4,916
  • Gender: Male
  • Busy mode is on.
    • ahmad.rasyid.ismail on Facebook
    • ahrasis on GitHub
    • ahrasis on LinkedIn
    • @ahrasis on Twitter
    • ElkArte Malaysia
Re: View Only Boards
« Reply #491 on: August 07, 2010, 11:54:14 AM »
It happens to all members when logged in and when guests are also browsing the boards. Help!
Can your post from 10 lines before line 76 and 10 lines after line 84 in your Subs-Recent.php so I can check it?

Btw, looking from ID_BOARD, you might have old code (not fully have clean uninstall from previous mod) before installing the one above. There is no ID_BOARD in the code.
« Last Edit: August 07, 2010, 11:57:17 AM by ahrasis »

Offline sharks

  • Sr. Member
  • ****
  • Posts: 891
  • Gender: Male
  • There's always a way.
Re: View Only Boards
« Reply #492 on: August 07, 2010, 11:55:36 AM »
I just uploaded my Subs-Recent.php. Find it attached to this post.

Btw, looking from ID_BOARD, you might have old code (not fully have clean uninstall from previous mod) before installing the one above. There is no ID_BOARD in the code.
What should i edit then? I have tried to execute a clean uninstall, but the previous mod was a forced installation to begin with, so it messed up my code.
« Last Edit: August 07, 2010, 12:03:20 PM by sharks »
SMF 2.0 Theme Color Editor
http://www.colorizeit.com/browse/24/smf-20-themes.html

SMF Package Parser to view all edits made by any modification package:
http://resourcez.biz/PackageParser/

Firefox is the best browser for SMF!
http://www.mozilla.com/en-US/firefox/fx/

Offline sharks

  • Sr. Member
  • ****
  • Posts: 891
  • Gender: Male
  • There's always a way.
Re: View Only Boards
« Reply #493 on: August 07, 2010, 12:07:41 PM »
Here is the code part you requested:

Code: [Select]
// Find all the posts.  Newer ones will have higher IDs.  (assuming the last 20 * number are accessable...)
// !!!SLOW This query is now slow, NEEDS to be fixed.  Maybe break into two?
$request = $smcFunc['db_query']('substring', '
SELECT
m.poster_time, m.subject, m.id_topic, m.id_member, m.id_msg,
IFNULL(mem.real_name, m.poster_name) AS poster_name, t.id_board, b.name AS board_name,
SUBSTRING(m.body, 1, 385) AS body, m.smileys_enabled
FROM {db_prefix}messages AS m
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
WHERE m.id_msg >= {int:likely_max_msg}' .
(!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
AND b.id_board != {int:recycle_board}' : '') . '
AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}
AND m.approved = {int:is_approved}' : '') . '
ORDER BY m.id_msg DESC
LIMIT ' . $latestPostOptions['number_posts'],
array(
'likely_max_msg' => max(0, $modSettings['maxMsgID'] - 50 * $latestPostOptions['number_posts']),
'recycle_board' => $modSettings['recycle_board'],
'is_approved' => 1,
)
);
$posts = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
// Censor the subject and post for the preview ;).
censorText($row['subject']);
censorText($row['body']);

$row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br />' => '')));
if ($smcFunc['strlen']($row['body']) > 128)
$row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';


//- View Only Boards MOD- START
// Do not show protected topics
if (empty($modSettings['vob_allowMessageIndexView']) && in_array($row['ID_BOARD'],$user_info['view_only_boards']))
continue;
//- View Only Boards MOD- END

// Build the array.
$posts[] = array(
'board' => array(
'id' => $row['id_board'],
'protected' => in_array($post['board'], $user_info['view_only_boards']), //- View Only Boards MOD-
'name' => $row['board_name'],
'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['board_name'] . '</a>'
),
'topic' => $row['id_topic'],
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => empty($row['id_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_member'],
'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>'
),
'subject' => $row['subject'],
'short_subject' => shorten_subject($row['subject'], 24),
'preview' => $row['body'],
'time' => timeformat($row['poster_time']),
'timestamp' => forum_time(true, $row['poster_time']),
'raw_timestamp' => $row['poster_time'],
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#msg' . $row['id_msg'],
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#msg' . $row['id_msg'] . '" rel="nofollow">' . $row['subject'] . '</a>'
);
}
$smcFunc['db_free_result']($request);

return $posts;
}

// Callback-function for the cache for getLastPosts().

There is too much error flooding and it is causing some spikes in server load.
I will have to remove your mod until it is stable. Too bad, it looked useful.
I advise everyone to stick to the old code, until this one is properly fixed, otherwise you'll break your forum.
« Last Edit: August 07, 2010, 12:12:04 PM by sharks »
SMF 2.0 Theme Color Editor
http://www.colorizeit.com/browse/24/smf-20-themes.html

SMF Package Parser to view all edits made by any modification package:
http://resourcez.biz/PackageParser/

Firefox is the best browser for SMF!
http://www.mozilla.com/en-US/firefox/fx/

Offline Hj Ahmad Rasyid Hj Ismail

  • SMF Hero
  • ******
  • Posts: 4,916
  • Gender: Male
  • Busy mode is on.
    • ahmad.rasyid.ismail on Facebook
    • ahrasis on GitHub
    • ahrasis on LinkedIn
    • @ahrasis on Twitter
    • ElkArte Malaysia
Re: View Only Boards
« Reply #494 on: August 07, 2010, 12:17:15 PM »
Code: [Select]
if (empty($modSettings['vob_allowMessageIndexView']) && in_array($row['ID_BOARD'],$user_info['view_only_boards']))
This should be not be in capital ID_BOARD but lower id_board.
Code: [Select]
if (empty($modSettings['vob_allowMessageIndexView']) && in_array($row['id_board'],$user_info['view_only_boards']))Sorry, I didn't see this. Do uninstall the mod. I'll try to fix the mod right away.

Offline Hj Ahmad Rasyid Hj Ismail

  • SMF Hero
  • ******
  • Posts: 4,916
  • Gender: Male
  • Busy mode is on.
    • ahmad.rasyid.ismail on Facebook
    • ahrasis on GitHub
    • ahrasis on LinkedIn
    • @ahrasis on Twitter
    • ElkArte Malaysia
Re: View Only Boards
« Reply #495 on: August 07, 2010, 12:20:40 PM »
I've fixed the ID_BOARD to id_board in the mod and already updated the attached mod in that post http://www.simplemachines.org/community/index.php?topic=146964.msg2734095#msg2734095

Offline sharks

  • Sr. Member
  • ****
  • Posts: 891
  • Gender: Male
  • There's always a way.
Re: View Only Boards
« Reply #496 on: August 07, 2010, 12:27:44 PM »
I have installed your v2 fixed mod, but still getting this error repeatedly.

8: Undefined variable: post
Only show the errors from this file
File: /home/user/sharks/Sources/Subs-Recent.php
Line: 84
SMF 2.0 Theme Color Editor
http://www.colorizeit.com/browse/24/smf-20-themes.html

SMF Package Parser to view all edits made by any modification package:
http://resourcez.biz/PackageParser/

Firefox is the best browser for SMF!
http://www.mozilla.com/en-US/firefox/fx/

Offline Hj Ahmad Rasyid Hj Ismail

  • SMF Hero
  • ******
  • Posts: 4,916
  • Gender: Male
  • Busy mode is on.
    • ahmad.rasyid.ismail on Facebook
    • ahrasis on GitHub
    • ahrasis on LinkedIn
    • @ahrasis on Twitter
    • ElkArte Malaysia
Re: View Only Boards
« Reply #497 on: August 07, 2010, 12:40:49 PM »
I have installed your v2 fixed mod, but still getting this error repeatedly.

8: Undefined variable: post
Only show the errors from this file
File: /home/user/sharks/Sources/Subs-Recent.php
Line: 84
I am actually trying to see what is causing that. I have tested the mod without having the same problem. I am looking at it now.

Offline Hj Ahmad Rasyid Hj Ismail

  • SMF Hero
  • ******
  • Posts: 4,916
  • Gender: Male
  • Busy mode is on.
    • ahmad.rasyid.ismail on Facebook
    • ahrasis on GitHub
    • ahrasis on LinkedIn
    • @ahrasis on Twitter
    • ElkArte Malaysia
Re: View Only Boards
« Reply #498 on: August 07, 2010, 12:59:54 PM »
Alright. Got it. I updated the refixed copy on that post. Sorry, for the trouble. Just merely trying to help.

Offline sharks

  • Sr. Member
  • ****
  • Posts: 891
  • Gender: Male
  • There's always a way.
Re: View Only Boards
« Reply #499 on: August 07, 2010, 01:43:47 PM »
I tested the v2 re-fixed version and there are no errors. And no need for apologies, your efforts are very much appreciated. :)

Great job!
SMF 2.0 Theme Color Editor
http://www.colorizeit.com/browse/24/smf-20-themes.html

SMF Package Parser to view all edits made by any modification package:
http://resourcez.biz/PackageParser/

Firefox is the best browser for SMF!
http://www.mozilla.com/en-US/firefox/fx/