Dene ve gör :D
Bu özellik size üyenin attığı tüm iletileri gösterme olanağı sağlayacaktır. Not sadece size izin verilen bölümlerdeki iletilerini görebilirsiniz.
İletileri Göster Menü//Count unread replies on index MOD- Start
$user_info['unread_topics'] = 0;
$user_info['unread_replies'] = 0;
//Only count for members, and those who can see at least one board
if (!$user_info['is_guest'] && !empty($user_info['query_wanna_see_board']))
$request = $smcFunc['db_query']('', '
SELECT MIN(lmr.id_msg), member_groups
FROM {db_prefix}boards AS b
LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = {int:id_member})
WHERE {query_wanna_see_board}',
array(
'id_member' => $id_member,
)
);
list ($earliest_msg) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
// This is needed in case of topics marked unread.
if (empty($earliest_msg))
$earliest_msg = 0;
else
{
// This query is pretty slow, but it's needed to ensure nothing crucial is ignored.
$request = $smcFunc['db_query']('', '
SELECT MIN(id_msg)
FROM {db_prefix}log_topics
WHERE id_member = {int:id_member}',
array(
'id_member' => $id_member,
)
);
list ($earliest_msg2) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
if ($earliest_msg2 == 0)
$earliest_msg2 = -1;
$earliest_msg = min($earliest_msg2, $earliest_msg);
}
//Select the boards to choose from... all
$request = $smcFunc['db_query']('', '
SELECT b.id_board
FROM {db_prefix}boards AS b
WHERE {query_wanna_see_board}' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
AND b.id_board != ' . (int) $modSettings['recycle_board'] : ''));
$boards = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$boards[] = $row['id_board'];
$smcFunc['db_free_result']($request);
if (empty($boards))
fatal_lang_error('error_no_boards_selected');
$query_this_board = 'id_board IN (' . implode(', ', $boards) . ')';
//Count unread topics
$request = $smcFunc['db_query']('', '
SELECT COUNT(*), b.member_groups, t.*
FROM {db_prefix}boards AS b
LEFT JOIN {db_prefix}topics AS t ON (b.id_board = t.id_board)
LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = {int:id_member})
LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = t.id_board AND lmr.id_member = {int:id_member})
WHERE {query_see_board}
AND t.id_last_msg > {int:earliest_msg}
AND IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) < t.id_last_msg',
array(
'earliest_msg' => $earliest_msg,
'id_member' => $id_member,
'query_see_board' => $query_this_board,
)
);
list ($user_info['unread_topics']) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
//Count unread replies
$request = $smcFunc['db_query']('', '
SELECT COUNT(DISTINCT t.id_topic)
FROM ({db_prefix}boards AS b, {db_prefix}messages AS m)
LEFT JOIN {db_prefix}topics AS t ON (b.id_board = t.id_board)
LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = {int:id_member})
LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = t.id_board AND lmr.id_member = {int:id_member})
WHERE {query_see_board}
AND m.id_topic = t.id_topic
AND m.id_member = {int:id_member}
AND IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) < t.id_last_msg',
array(
'id_member' => $id_member,
'query_see_board' => $query_this_board,
)
);
list ($user_info['unread_replies']) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
}
//Count unread replies on index MOD- End
// Check for moderators and see if they have access to the board.