Autor Tópico: Veja quem leu o tópico  (Lida 3844 vezes)

0 Membros e 1 Visitante estão a ver este tópico.

Offline candidosa2

  • Suporte Tecnico
  • Fundador
  • *
  • Mensagens: 5072
  • Rank: 1658
  • Sexo: Masculino
  • Suporte
    • Hosting Moçambique
Veja quem leu o tópico
« em: 31 de Dezembro de 2022, 12:39 »
Um bom mod para aqueles que estão se perguntando quais membros lêem seus tópicos.

/Sources/Display.php
Pesquisar
Código: [Seleccione]
// What are you gonna display if these are empty?!
if (empty($topic))
fatal_lang_error('no_board', false);

Alterar
Código: [Seleccione]
// What are you gonna display if these are empty?!
if (empty($topic))
fatal_lang_error('no_board', false);
 if(!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'log') {
        DisplayLog();
    }


Pesquisar
Código: [Seleccione]
?>[/color]

Adicionar
Código: [Seleccione]
function DisplayLog()
{
    global $context, $scripturl, $topic, $smcFunc;

    $request = $smcFunc['db_query']('', "
        SELECT
        lt.ID_MEMBER, lt.id_topic, mem.real_name
        FROM {db_prefix}log_topics AS lt
        LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = lt.id_member)
        WHERE id_topic = {int:topic}",
        array(
               'topic' => $topic,
        )
    );
    while ($row = $smcFunc['db_fetch_assoc']($request))
    {
        // Build the array.
        $context['logs'][] = array(
            'member' => array(
                'id' => $row['id_member'],
                'name' => $row['real_name'],
                'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>',
                'href' => $scripturl . '?action=profile;u=' . $row['id_member'],
            ),
        );
    }
    $smcFunc['db_free_result']($request);

    $context['sub_template'] = 'displaylog';
}

?>



/Themes/default/Display.template.php

Pesquisar
Código: [Seleccione]
?>
Adicionar
Código: [Seleccione]
function template_displaylog()
{
    global $context, $settings, $options, $txt, $scripturl, $modSettings;

    echo '
    <table border="0" cellpadding="0" cellspacing="0" style="padding-top: 1ex;" align="center">
        <tr class="titlebg">
            <td>Quem leu o tópico</td>
        </tr>';

    foreach($context['logs'] as $log) {
        echo '
        <tr class="windowbg">
            <td>', $log['member']['link'], '</td>
        </tr>';
    }
    echo '
    </table>';
}

?>


Pesquisar
Código: [Seleccione]
<h3 class="catbg">
<img src="', $settings['images_url'], '/topic/', $context['class'], '.gif" align="bottom" alt="" />
<span id="author">', $txt['author'], '</span>
', $txt['topic'], ': ', $context['subject'], ' &nbsp;(', $txt['read'], ' ', $context['num_views'], ' ', $txt['times'], ')
</h3>

Alterar
Código: [Seleccione]
<h3 class="catbg">
<img src="', $settings['images_url'], '/topic/', $context['class'], '.gif" align="bottom" alt="" />
<span id="author">', $txt['author'], '</span>
', $txt['topic'], ': ', $context['subject'], ' &nbsp;(', $txt['read'], ' ', $context['num_views'], ' ', $txt['times'], ')<a style="float: right;" href="' . $scripturl . '?topic='. $context['current_topic'] . '.0;sa=log">Konuyu Okumuş Olanlar</a>
</h3>