News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Konuyu Okumuş Olanlar

Started by [SiNaN], June 22, 2008, 07:56:14 AM

Previous topic - Next topic

[SiNaN]

Mod haline getirildi:

http://www.simplemachines.org/community/index.php?topic=253817.0

Bu ipucu sayesinde konuyu kimin okumuş olduğunu görüntüleyebileceğiz.

Vakit bulduğum bir zamanda geliştirirek modifikasyon olarak da yayınlayacağım.

../Sources/Display.php

Bul:

fatal_lang_error('smf232', false);

Değiştir:

fatal_lang_error('smf232', false);

if(!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'log') {
DisplayLog();
}


Bul:

?>

Değiştir:

function DisplayLog()
{
global $context, $scripturl, $db_prefix, $topic;

$request = db_query("
SELECT
lt.ID_MEMBER, lt.ID_TOPIC, mem.realName
FROM {$db_prefix}log_topics AS lt
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = lt.ID_MEMBER)
WHERE ID_TOPIC = $topic", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
{
// Build the array.
$context['logs'][] = array(
'member' => array(
'id' => $row['ID_MEMBER'],
'name' => $row['realName'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>',
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
),
);
}
mysql_free_result($request);

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

?>


../Themes/default/Display.template.php

Bul:

?>

Değiştir:

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>Konuyu Kimler Okumuş</td>
</tr>';

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

echo '
</table>';
}

?>


Bul:

<div class="nav" style="margin-bottom: 2px;"> ', $context['previous_next'], '</div>

Değiştir:

<div class="nav" style="margin-bottom: 2px;"> ', $context['previous_next'], '</div>';
echo '
<a href="' . $scripturl . '?topic='. $context['current_topic'] . '.0;sa=log">Konuyu Okumuş Olanlar</a>';
echo '


Bir süre burada durduktan sonra İpuçları ve Hileler bölümüne taşınacak.

Tamamiyle [SiNaN] yapımıdır.
Former SMF Core Developer | My Mods | SimplePortal

Alpay

Hımm cok güzel bir modifikasyon 2,0 içinde yaparmısın :)

[SiNaN]

Zor bir modifikasyon değil, sen çevirmeyi dene. Takıldığın yer olursa yardımcı olurum bu konudan. :)
Former SMF Core Developer | My Mods | SimplePortal

Yağız...

#3
2.0 için:

../Sources/Display.php

Bul:

        fatal_lang_error('no_board', false);

Değiştir:

        fatal_lang_error('no_board', false);

    if(!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'log') {
        DisplayLog();
    }


Bul:

?>

Değiştir:
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

Bul:

?>

Değiştir:

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>Konuyu Kimler Okumuş</td>
        </tr>';

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

?>


Bul:

            <div class="nav" style="margin-bottom: 2px;"> ', $context['previous_next'], '</div>

Değiştir:

            <div class="nav" style="margin-bottom: 2px;"> ', $context['previous_next'], '</div>';
        echo '
            <a href="' . $scripturl . '?topic='. $context['current_topic'] . '.0;sa=log">Konuyu Okumuş Olanlar</a>';
        echo '

[SiNaN]

Teşekkürler Yağız. Ama şu kısmı düzeltir misin?

DisplayLog() fonksiyonundaki sorgu şu şekilde olmalı sanırım:

    $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,
        )
    );


Former SMF Core Developer | My Mods | SimplePortal

Yağız...

Evet orayı kaçırmışım :) . Teşekkürler.

Alpay

Parse error: syntax error, unexpected T_ARRAY
Display.php de =)

Yağız...

Sanırım hata Sinan'ın verdiği kodda.
WHERE id_topic = {int:topic}" kodunun sonuna virgül ( , ) geliyor.

Alpay

bir hata daha var Yağız
Hata mesaji almamıza neden oluyor id_member ve id_topic ler ID_MEMBER ve ID_TOPIC olucak ;)

Yağız...

#9
Hayır. 2.0'da hepsi küçüldü.

Alpay

#10
Quote from: Yağız on June 22, 2008, 10:24:17 AM
Hayır. 2.0'da hepsi küçüldü.

O kadarını bilmiyorum ama kücükken hata mesaji veriordu büyültütüm denedim düzeldi.

edit :

8: Undefined index: id_member
gibi tahmin ettigin gibi =)

Yağız...

Aldığın hataları yazar mısın?

perver46

bende bu hatayi verdi


Parse error: syntax error, unexpected $end in /home/fir30081/public_html/forum/Sources/Display.php on line 1243

[SiNaN]

Former SMF Core Developer | My Mods | SimplePortal

perver46

Tamam düzeltim flod yaptigim icin kusura bakmayin Kodlari yapistirirken düzgün atmamisim, Bir sorum daha olacakti bunu sadece adminlerin görebilecegi sekilde nasil ayarlariz acaba? Suan ziyaretciler haric herkes görebiliyorda.

[SiNaN]

Bul:

         <div class="nav" style="margin-bottom: 2px;"> ', $context['previous_next'], '</div>';
         echo '
         <a href="' . $scripturl . '?topic='. $context['current_topic'] . '.0;sa=log">Konuyu Okumuş Olanlar</a>';
      echo '


Değiştir:

         <div class="nav" style="margin-bottom: 2px;"> ', $context['previous_next'], '</div>';
         if($context['allow_admin'])
         echo '
         <a href="' . $scripturl . '?topic='. $context['current_topic'] . '.0;sa=log">Konuyu Okumuş Olanlar</a>';
      echo '


Bul:

   if(!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'log') {

Değiştir:

   if(!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'log' && allowedTo('moderate_forum')) {
Former SMF Core Developer | My Mods | SimplePortal

kemiktozu

Ben yapmaya çalıştım ama hiç bir değişiklik olmadı :S

Mithotyn

#17
Teşekkürler [SiNaN], Çalışıyor.




atlantis41

#18
ben yapamadım çünkü    ./Themes/default/Display.template.php de      <div class="nav" style="margin-bottom: 2px;"> ', $context['previous_next'], '</div>    kodunu bulamadım acaba eklediğim başka bir mod yüzünden olabilrmi 

S a S u K e

Parça parça arat.Mesela

', $context['previous_next'], '

Şöyle :)

Türkçe'yi Katlet, Özümüzü Mahfet, Pilli Bebek Gibi Konuşma Velet !

Advertisement: