24 Mar 2023 07:02 Yeni Konu Oluştur

Haberler:

Üye kayıt esnasında E-posta adresinizin doğru olduğuna ve Aktivasyon Mailinize bakmayı unutmayın.


[Soru] Bir üyenin en son attığı gönderiyi nasıl çekebilirim

Başlatan Babc, 23 Eyl 2021 15:16

« önceki - sonraki »

0 Üyeler ve 1 Ziyaretçi konuyu incelemekte.

*

  1. 7

  2. 4

bir kullanıcının profil kısmına en son atığı gönderiyi nasıl çekebilirim?

*

  1. 1,197

  2. 120

  3. 401
Default temanızın Profile.template.php
function template_summary()burda <div id="detailedinfo">
<dl class="settings">';
bu kodda gösterim yapabilirsiniz.

Örnek
if ($context['member']['show_last_login'])
echo '
<dt>', $txt['lastLoggedIn'], ': </dt>
<dd>', $context['member']['last_login'], (!empty($context['member']['is_hidden']) ? ' (' . $txt['hidden'] . ')' : ''), '</dd>';
sonrasına
echo '
<dt>Deneme</dt>
<dd>Merhaba</dd>';
Olucak şekilde düzenleme yapılabilir.

Şimdi istenilen soru cevabı için Sources/Profile-View.php
Bul // Any custom profile fields?
if (!empty($context['custom_fields']))
foreach ($context['custom_fields'] as $custom)
$context['print_custom_fields'][$context['cust_profile_fields_placement'][$custom['placement']]][] = $custom;

}
Değiş
// Any custom profile fields?
if (!empty($context['custom_fields']))
foreach ($context['custom_fields'] as $custom)
$context['print_custom_fields'][$context['cust_profile_fields_placement'][$custom['placement']]][] = $custom;

$request = $smcFunc['db_query']('', '
SELECT
b.id_board, b.name AS bname, c.id_cat, c.name AS cname, m.id_topic, m.id_msg,
t.id_member_started, t.id_first_msg, t.id_last_msg, m.smileys_enabled,
m.subject, m.poster_time, m.approved
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}categories AS c ON (c.id_cat = b.id_cat)
WHERE m.id_member = {int:current_member}
AND {query_see_board}' . (!$modSettings['postmod_active'] || $context['user']['is_owner'] ? '' : '
AND t.approved = {int:is_approved} AND m.approved = {int:is_approved}') . '
ORDER BY m.id_msg DESC
LIMIT {int:limit}',
array(
'current_member' => $memID,
'is_approved' => 1,
'limit' => 1,
)
);

while ($row = $smcFunc['db_fetch_assoc']($request))
{
// Censor....
censorText($row['subject']);

// And the array...
$context['posts'] = array(
'category' => array(
'name' => $row['cname'],
'id' => $row['id_cat']
),
'board' => array(
'name' => $row['bname'],
'id' => $row['id_board']
),
'topic' => $row['id_topic'],
'subject' => $row['subject'],
'start' => 'msg' . $row['id_msg'],
'time' => timeformat($row['poster_time']),
'timestamp' => forum_time(true, $row['poster_time']),
'id' => $row['id_msg'],
'can_reply' => false,
'can_mark_notify' => !$context['user']['is_guest'],
'can_delete' => false,
'approved' => $row['approved'],
);
}
$smcFunc['db_free_result']($request);

}

default/Profile.template.php
Bul:
if ($context['member']['show_last_login'])
echo '
<dt>', $txt['lastLoggedIn'], ': </dt>
<dd>', $context['member']['last_login'], (!empty($context['member']['is_hidden']) ? ' (' . $txt['hidden'] . ')' : ''), '</dd>';

echo '
</dl>';
Değiş:
if ($context['member']['show_last_login'])
echo '
<dt>', $txt['lastLoggedIn'], ': </dt>
<dd>', $context['member']['last_login'], (!empty($context['member']['is_hidden']) ? ' (' . $txt['hidden'] . ')' : ''), '</dd>';

echo '
<dt>Son Konu</dt>
<dd><strong><a href="', $scripturl, '?board=', $context['posts']['board']['id'], '.0">', $context['posts']['board']['name'], '</a> / <a href="', $scripturl, '?topic=', $context['posts']['topic'], '.', $context['posts']['start'], '#msg', $context['posts']['id'], '">', $context['posts']['subject'], '</a></strong></dd>';

echo '
</dl>';

İyi Çalışmalar. Hata vs.. varsa konu altında belirtebilirsiniz.

*

  1. 7

  2. 4
bul değiş dediğiniz kısımları aradım fakat çıkmıyor

*

  1. 1,197

  2. 120

  3. 401

Smf 2.1 değil mi ? Kod satırları
Profile.template.php de
155 satır
293 satır
Sources/Profile-View.php
211 Satır
default/Profile.template.php
429 satır

Bakarsanız görmeniz lazım.Bu konulara yabancı iseniz biraz kurcalamanız gerekicek.

*

  1. 7

  2. 4

*

  1. 1,197

  2. 120

  3. 401
Profile-View.php Sources de satır 243 sonrasına yani aşadaki kod
    loadCustomFields($memID);Sonrasına ekleyin
    $request = $smcFunc['db_query']('', '
        SELECT
            b.id_board, b.name AS bname, c.id_cat, c.name AS cname, m.id_topic, m.id_msg,
            t.id_member_started, t.id_first_msg, t.id_last_msg, m.body, m.smileys_enabled,
            m.subject, m.poster_time, m.approved
        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}categories AS c ON (c.id_cat = b.id_cat)
        WHERE m.id_member = {int:current_member}
            AND {query_see_board}' . (!$modSettings['postmod_active'] || $context['user']['is_owner'] ? '' : '
            AND t.approved = {int:is_approved} AND m.approved = {int:is_approved}') . '
        ORDER BY m.id_msg DESC
        LIMIT 1',
        array(
            'current_member' => $memID,
            'is_approved' => 1,
        )
    );

    $row = $smcFunc['db_fetch_assoc']($request);

        censorText($row['subject']);

        // And the array...
        $context['posts'] = array(
            'body' => $row['body'],
            'category' => array(
                'name' => $row['cname'],
                'id' => $row['id_cat']
            ),
            'board' => array(
                'name' => $row['bname'],
                'id' => $row['id_board']
            ),
            'topic' => $row['id_topic'],
            'subject' => $row['subject'],
            'start' => 'msg' . $row['id_msg'],
            'time' => timeformat($row['poster_time']),
            'timestamp' => forum_time(true, $row['poster_time']),
            'id' => $row['id_msg'],
            'can_reply' => false,
            'can_mark_notify' => false,
            'can_delete' => false,
            'delete_possible' => ($row['id_first_msg'] != $row['id_msg'] || $row['id_last_msg'] == $row['id_msg']) && (empty($modSettings['edit_disable_time']) || $row['poster_time'] + $modSettings['edit_disable_time'] * 60 >= time()),
            'approved' => $row['approved'],
        );

   
    $smcFunc['db_free_result']($request);

Daha sonra Profile.template.php Default temada 282 satır yani aşadaki kod
    echo '
                    <dt>', $txt['lastLoggedIn'], ': </dt>
                    <dd>', $context['member']['last_login'], '</dd>
                </dl>';
Sonrasına ekleyin
        echo '
        <hr />
        <dl>
            <dt><a href="'.$scripturl.'?action=profile;area=showposts;sa=messages;u='.$context['id_member'].'">Daha fazla</a> Son Mesajı : </dt>
            <dd><strong><a href="', $scripturl, '?board=', $context['posts']['board']['id'], '.0">', $context['posts']['board']['name'], '</a> / <a href="', $scripturl, '?topic=', $context['posts']['topic'], '.', $context['posts']['start'], '#msg', $context['posts']['id'], '">', $context['posts']['subject'], '</a></strong></dd>
        </dl>';

Umarım faydalı olmuştur hata vb.. söyleyebilirsiniz.

Bu bölümdeki eklentileri göremezsiniz.

*

  1. 118

  2. 11

  3. 84
Emeğine sağlık hocam. Profilde son konuyu göstermek hiç aklıma gelmemişti ama kullanılabilecek bir eklenti.


Benzer Konular (5)


MENU ×