หมวดไฟฟ้า/อิเล็กทรอนิกส์/คอมพิวเตอร์ => ห้อง SMF 2.0.X => Programming => ห้องคอมพิวเตอร์ => ห้อง MOD => ข้อความที่เริ่มโดย: Auto Man ที่ 21 พฤษภาคม 2559, 13:37:11

หัวข้อ: มอดดูหัวข้อได้ แต่คลิ๊กเข้าไปอ่านไม่ได้
เริ่มหัวข้อโดย: Auto Man ที่ 21 พฤษภาคม 2559, 13:37:11
ไปดูกันที่นี่

http://custom.simplemachines.org/mods/index.php?mod=610

View Only Boards  มองเห็นกระทู้ แต่...เข้าไปดูไม่ได้

   อธิบายสั้นๆเพราะไม่มีรูปประกอบให้   การทำงานก็ประมาณว่า ให้สมาชิกมองเห็นบอร์ดได้และหััวข้อต่างๆ ได้
แต่ไม่ได้รับอนุญาตให้เข้าดู ถ้าจะเข้าดูได้ ก็ต้องได้รับการอนุญาต โดยการตั้งค่าที่ mod โดยอ้างถึง กลุ่มสมาชิก
ประมาณนี้ (เข้าใจกันป่าวเนี่ย)  5 5 5

 :o

มาจากที่นี่ (http://postnook.com/?topic=792.0-View-Only-Boards--%E0%B8%A1%E0%B8%AD%E0%B8%87%E0%B9%80%E0%B8%AB%E0%B9%87%E0%B8%99%E0%B8%81%E0%B8%A3%E0%B8%B0%E0%B8%97%E0%B8%B9%E0%B9%89-%E0%B9%81%E0%B8%95%E0%B9%88...%E0%B9%80%E0%B8%82%E0%B9%89%E0%B8%B2%E0%B9%84%E0%B8%9B%E0%B8%94%E0%B8%B9%E0%B9%84%E0%B8%A1%E0%B9%88%E0%B9%84%E0%B8%94%E0%B9%89.html)
หัวข้อ: มอดดูหัวข้อได้ แต่คลิ๊กเข้าไปอ่านไม่ได้
เริ่มหัวข้อโดย: Auto Man ที่ 02 ตุลาคม 2559, 16:34:09
Mod View Only Boards จ๊า...

ตรงนี้มีภาพ! แต่ท่านจะมองไม่เห็น , ท่านต้อง  สมัครสมาชิก หรือ ลงชื่อเข้าระบบ
 (http://upic.me/show/62303019)
หัวข้อ: มอดดูหัวข้อได้ แต่คลิ๊กเข้าไปอ่านไม่ได้
เริ่มหัวข้อโดย: Auto Man ที่ 02 ตุลาคม 2559, 16:49:21
File Edits

./Sources/Subs-BoardIndex.php
Find:
โค๊ด: [Select]
$this_category[$row_board['id_board']] = array(
'new' => empty($row_board['is_read']),

Add After:
โค๊ด: [Select]
'protected' => !empty($user_info['view_only_boards']) && in_array($row_board['id_board'], $user_info['view_only_boards']), //- View Only Boards MOD-
Find:
โค๊ด: [Select]
$this_category[$row_board['id_parent']]['children'][$row_board['id_board']] = array(
'id' => $row_board['id_board'],

Add After:
โค๊ด: [Select]
'protected' => !empty($user_info['view_only_boards']) && in_array($row_board['id_board'], $user_info['view_only_boards']), //- View Only Boards MOD-
Find:
โค๊ด: [Select]
$this_last_post = array(
'id' => $row_board['id_msg'],

Add After:
โค๊ด: [Select]
'protected' => !empty($user_info['view_only_boards']) && in_array($row_board['id_board'], $user_info['view_only_boards']), //- View Only Boards MOD-
Find:
โค๊ด: [Select]
// Set the last post in the parent board.
if ($row_board['id_parent'] == $boardIndexOptions['parent_id'] || ($isChild && !empty($row_board['poster_time']) && $this_category[$row_board['id_parent']]['last_post']['timestamp'] < forum_time(true, $row_board['poster_time'])))

Replace With:
โค๊ด: [Select]
// Set the last post in the parent board. //- View Only Boards MOD- modified condition
if ($row_board['id_parent'] == $boardIndexOptions['parent_id'] || ($isChild && !empty($row_board['poster_time']) && (!$this_last_post['protected'] || !empty($modSettings['vob_allowMessageIndexView'])) && $this_category[$row_board['id_parent']]['last_post']['timestamp'] < forum_time(true, $row_board['poster_time'])))

./Sources/ManageBoards.php

Find:
โค๊ด: [Select]
// Change '1 & 2' to '1 &amp; 2', but not '&amp;' to '&amp;amp;'...Add Before:
โค๊ด: [Select]
//-View Only Boards MOD- Start - prepare the view information to save
$boardOptions['access_groups_view'] = array();
if (!empty($_POST['groupsView']))
foreach ($_POST['groupsView'] as $group)
$boardOptions['access_groups_view'][] = (int) $group;
//-View Only Boards MOD- End


Find:
อ้างถึง
'member_groups' => array(0, -1),
Add After:
โค๊ด: [Select]
'member_groups_view' => array(), //-View Only Boards MOD-
Find:
โค๊ด: [Select]
'checked' => in_array('-1', $curBoard['member_groups']),Add After:
โค๊ด: [Select]
'view' => in_array('-1', $curBoard['member_groups_view']), //-View Only Boards MOD-
Find:
โค๊ด: [Select]
'checked' => in_array('0', $curBoard['member_groups']),Add After:
โค๊ด: [Select]
'view' => in_array('0', $curBoard['member_groups_view']), //-View Only Boards MOD-
Find:
โค๊ด: [Select]
'checked' => in_array($row['id_group'], $curBoard['member_groups']),Add After:

โค๊ด: [Select]
'view' => in_array($row['id_group'], $curBoard['member_groups_view']), //-View Only Boards MOD-
./Sources/Subs-Boards.php

Find:
โค๊ด: [Select]
// Who's allowed to access this board.Add Before:
โค๊ด: [Select]
//-View Only Boards MOD- Who's allowed to view this board.
if (isset($boardOptions['access_groups_view']))
$boardUpdates[] = 'member_groups_view = \'' . implode(',', $boardOptions['access_groups_view']) . '\'';


Find:
โค๊ด: [Select]
b.member_groups,Add After:
โค๊ด: [Select]
b.member_groups_view,
Find:
โค๊ด: [Select]
// Getting all the board and category information you'd ever wanted.Add After:
โค๊ด: [Select]
//-View Only Boards MOD- query modified
Find:
โค๊ด: [Select]
'member_groups' => explode(',', $row['member_groups']),
Add After:
โค๊ด: [Select]
'member_groups_view' => explode(',', $row['member_groups_view']), //-View Only Boards MOD-
หัวข้อ: มอดดูหัวข้อได้ แต่คลิ๊กเข้าไปอ่านไม่ได้
เริ่มหัวข้อโดย: Auto Man ที่ 02 ตุลาคม 2559, 17:00:24
./Sources/Load.php
Find: [Select]
b.member_groups,
Add After: [Select]
 b.member_groups_view,

Find: [Select]
$board_info['groups'] = $row['member_groups'] == '' ? array() : explode(',', $row['member_groups']);
Add After: [Select]

         $board_info['groups_view'] = $row['member_groups_view'] == '' ? array() : explode(',', $row['member_groups_view']);//-View Only Boards MOD-

Find: [Select]
      if (count(array_intersect($user_info['groups'], $board_info['groups'])) == 0 && !$user_info['is_admin'])
         $board_info['error'] = 'access';
Replace With: [Select]
      //-View Only Boards MOD- Start
      if (count(array_intersect($user_info['groups'], $board_info['groups'])) == 0 && !$user_info['is_admin'])
         if (!empty($topic) || isset($_REQUEST['action']))
            $board_info['error'] = 'access';
         elseif (count(array_intersect($user_info['groups'], $board_info['groups_view'])) == 0 || empty($modSettings['vob_allowMessageIndexView']))
            $board_info['error'] = 'access';
      //-View Only Boards MOD- End

Find: [Select]
// Load the mod cache so we can know what additional boards they should see, but no sense in doing it for guests
Add Before: [Select]
   //-View Only Boards MOD- Start
   $user_info['view_only_boards'] = array();

   $result = $smcFunc['db_query']('', '
      SELECT b.id_board
      FROM {db_prefix}boards as b
      WHERE (FIND_IN_SET(' . implode(', b.member_groups_view) OR FIND_IN_SET(', $user_info['groups']) . ', b.member_groups_view)) AND NOT ' . $user_info['query_see_board']
   );

   while ($row = $smcFunc['db_fetch_row']($result))
      $user_info['view_only_boards'][] = $row[0];

   $query_see_board = $user_info['query_see_board'];
   if ($user_info['query_see_board'] != '1=1' && (empty($_REQUEST['action']) || !in_array($_REQUEST['action'], array('recent','profile','.xml','search','search2'))))
      if (!$user_info['is_guest'])
         $user_info['query_see_board'] =  substr($query_see_board,0,-1) . ' OR FIND_IN_SET(\'' . implode('\', b.member_groups_view) OR FIND_IN_SET(\'', $user_info['groups']) . '\', b.member_groups_view))';
      else
         $user_info['query_see_board'] =  '(' . $query_see_board . ' OR FIND_IN_SET(-1, b.member_groups_view))';
   //-View Only Boards MOD- End


./Sources/Subs-Recent.php
Find: [Select]
            'id' => $row['id_board'],
Add After: [Select]

            'protected' => !empty($user_info['view_only_boards']) && in_array($row['id_board'], $user_info['view_only_boards']), //- View Only Boards MOD-

./Sources/Recent.php
Find: [Select]
      // Censor everything.
      censorText($row['body']);
      censorText($row['subject']);
Add Before: [Select]
      //- View Only Boards MOD- START
      // Do not show protected topics
      if (empty($modSettings['vob_allowMessageIndexView']) && !empty($user_info['view_only_boards']) && in_array($row['id_board'], $user_info['view_only_boards']))
         continue;
      //- View Only Boards MOD- END


Find: [Select]
      if ($row['id_poll'] > 0 && $modSettings['pollMode'] == '0')
         continue;
Add Before: [Select]

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


Find: [Select]
'views' => comma_format($row['num_views']),
         'board' => array(
            'id' => $row['id_board'],
Add After: [Select]

            'protected' => !empty($user_info['view_only_boards']) && in_array($row['id_board'], $user_info['view_only_boards']), //- View Only Boards MOD-

./Sources/ManageSettings.php
Find: [Select]
array('check', 'allow_guestAccess'),
Add After: [Select]

         array('check', 'vob_allowMessageIndexView'), //-View Only Boards MOD-

./Themes/default/BoardIndex.template.php
Find: [Select]
if (!empty($board['last_post']['id']))
               echo '
                  <p><strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', $board['last_post']['member']['link'] , '

                  ', $txt['in'], ' ', $board['last_post']['link'], '

                  ', $txt['on'], ' ', $board['last_post']['time'],'
                  </p>';
Replace With: [Select]
if (!empty($board['last_post']['id']))
               echo '
                  <p><strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', ($board['last_post']['protected'] ? '<span class="vob_protected">' . (empty($modSettings['vob_allowMessageIndexView']) ? $txt['vob_protected'] : $board['last_post']['member']['link']) . '</span>' : $board['last_post']['member']['link']) , '

                  ', $txt['in'], ' ', ($board['last_post']['protected'] ? '<span class="vob_protected">' . (empty($modSettings['vob_allowMessageIndexView']) ? $txt['vob_protected'] : $board['last_post']['link']) . '</span>' : $board['last_post']['link']), '

                  ', $txt['on'], ' ', $board['last_post']['time'],'
                  </p>';

Find: [Select]
foreach ($category['boards'] as $board)
         {
            echo '
            <tr id="board_', $board['id'], '" class="windowbg2">
Replace With: [Select]
foreach ($category['boards'] as $board)
         {
            echo '
            <tr id="board_', $board['id'], '" class="windowbg2' , ($board['protected'] ? ' vob_protected"' : '') , '">

Find: [Select]
$children[] = $child['new'] ? '<strong>' . $child['link'] . '</strong>' : $child['link'];
Replace With: [Select]
$children[] =  $child['protected'] ? '<span class="vob_protected">' . $child['link'] . '</span>' : ($child['new'] ? '<strong>' . $child['link'] . '</strong>' : $child['link']);

Find: [Select]
<strong><a href="', $scripturl, '?action=recent">', $txt['recent_posts'], '[/url]</strong>
            <p id="infocenter_onepost" class="middletext">
Replace With: [Select]
<strong><a href="', $scripturl, '?action=recent">', $txt['recent_posts'], '[/url]</strong>
            <p id="infocenter_onepost" class="middletext', ($context['latest_post']['protected'] ? ' vob_protected' : '') ,'">

Find: [Select]
foreach ($context['latest_posts'] as $post)
            echo '
               <dt>
Replace With: [Select]
foreach ($context['latest_posts'] as $post)
            echo '
               <dt ' , ($post['board']['protected'] ? 'class="vob_protected"' : '') , '>

./Themes/default/MessageIndex.template.php
Find: [Select]
foreach ($context['boards'] as $board)
      {
         echo '
            <tr id="board_', $board['id'], '" class="windowbg2">
Replace With: [Select]
foreach ($context['boards'] as $board)
      {
         echo '
            <tr id="board_', $board['id'], '" class="windowbg2' , ($board['protected'] ? ' vob_protected"' : '') , '">

Find: [Select]
if (!empty($board['last_post']['id']))
            echo '
                  <p><strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', $board['last_post']['member']['link'], '

                  ', $txt['in'], ' ', $board['last_post']['link'], '

                  ', $txt['on'], ' ', $board['last_post']['time'],'
                  </p>';
Replace With: [Select]
if (!empty($board['last_post']['id']))
            echo '
                  <p><strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', ($board['last_post']['protected'] ? '<span class="vob_protected">' . (empty($modSettings['vob_allowMessageIndexView']) ? $txt['vob_protected'] : $board['last_post']['member']['link']) . '</span>' : $board['last_post']['member']['link']), '

                  ', $txt['in'], ' ', ($board['last_post']['protected'] ? '<span class="vob_protected">' . (empty($modSettings['vob_allowMessageIndexView']) ? $txt['vob_protected'] : $board['last_post']['link']) . '</span>' : $board['last_post']['link']), '

                  ', $txt['on'], ' ', $board['last_post']['time'],'
                  </p>';

Find: [Select]
$children[] = $child['new'] ? '' . $child['link'] . '</strong>' : $child['link'];
Replace With:
[Select]
$children[] =  $child['protected'] ? '<span class="vob_protected">' . $child['link'] . '</span>' : ($child['new'] ? '<strong>' . $child['link'] . '</strong>' : $child['link']);
This operation isn't vital to the installation of this mod.

Find: [Select]
$children[] = $child['new'] ? '<strong>' . $child['link'] . '</strong>' : $child['link'];
Replace With: [Select]
$children[] =  $child['protected'] ? '<span class="vob_protected">' . $child['link'] . '</span>' : ($child['new'] ? '<strong>' . $child['link'] . '</strong>' : $child['link']);
This operation isn't vital to the installation of this mod.

./Themes/default/Recent.template.php
Find: [Select]
         $color_class2 = !empty($color_class) ? $color_class . '2' : '';

         echo '
                  <tr>
Replace With: [Select]
         $color_class2 = !empty($color_class) ? $color_class . '2' : '';

         echo '
                  <tr ', ($topic['board']['protected'] ? 'class="vob_protected"' : '') ,'>

Find: [Select]
         $color_class2 = !empty($color_class) ? $color_class . '2' : '';

         echo '
                  <tr>
Replace With: [Select]
         $color_class2 = !empty($color_class) ? $color_class . '2' : '';

         echo '
                  <tr ', ($topic['board']['protected'] ? 'class="vob_protected"' : '') ,'>

./Themes/default/ManageBoards.template.php
Find: [Select]
<input type="checkbox" name="groups[]" value="', $group['id'], '" id="groups_', $group['id'], '"', $group['checked'] ? ' checked="checked"' : '', ' class="input_check" />
Add After: [Select]
 <input type="checkbox" name="groupsView[]" value="', $group['id'], '" id="groupsView_', $group['id'], '"', $group['view'] ? ' checked="checked"' : '', ' class="input_check" />

./Themes/default/css/index.css
Find (at the end of the file): [Select]
?>
Add Before: [Select]

/* //-View Only Boards MOD- START */
/* You can customize here the appearence of the protected areas */
.vob_protected
{
cursor: default;
}

.vob_protected, .vob_protected a:link, .vob_protected a:visited, .vob_protected a:hover
{
color: #666 !important;
text-decoration: none;
cursor: default;
}
/* //-View Only Boards MOD- END */

./Themes/default/languages/ManageBoards.english.php
Find: [Select]
$txt['mboards_groups_desc'] = 'Groups allowed to access this board.
Note: if the member is in any group or post group checked, they will have access to this board.';
Replace With: [Select]
$txt['mboards_groups_desc'] = 'Groups allowed to access this board.
Note: if the member is in any group or post group checked, they will have access to this board. <strong>Important:</strong> The first checkbox controls the <strong>access</strong> while the second the <strong>visibility</strong>. Access overrrides visibility but not the other way around. Hence visibility is optional in case access is checked.'; //-View Only Boards MOD- modified

./Themes/default/languages/Modifications.english.php
Find (at the end of the file): [Select]
?>
Add Before: [Select]

//-View Only Boards MOD- Start
$txt['vob_allowMessageIndexView'] = 'Show the message index for "view only" boards';
$txt['vob_protected'] = 'Protected';
//-View Only Boards MOD- End

ยาวจริงๆ ติดตั้งแบบออโต้ เกิดเออเรอร์มาก ว่างๆ ค่อยแมนวลเอา