Uutiset:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu
Advertisement:

how to get 'info' if you have posted in the topic/post on recent posts page

Aloittaja Pipke, helmikuu 21, 2014, 08:53:02 AP

« edellinen - seuraava »

Pipke

on this page--> site url../index.php?action=recent

on file Sources/Recent.php and Recent.Template.php i think?
i want to display icon of the posts that i have posted in then.

it has to do with this:
if (!empty($modSettings['enableParticipation']) && !$user_info['is_guest'] && !empty($topic_ids))
{
$result = $smcFunc['db_query']('', '
SELECT id_topic
FROM {db_prefix}messages
WHERE id_topic IN ({array_int:topic_list})
AND id_member = {int:current_member}
GROUP BY id_topic
LIMIT ' . count($topic_ids),
array(
'current_member' => $user_info['id'],
'topic_list' => $topic_ids,
)
);
while ($row = $smcFunc['db_fetch_assoc']($result))
{
$context['topics'][$row['id_topic']]['is_posted_in'] = true;
$context['topics'][$row['id_topic']]['class'] = 'my_' . $context['topics'][$row['id_topic']]['class'];
}
$smcFunc['db_free_result']($result);
}


but dont know how to add it to the script.

function RecentPosts()

// Get all the most recent posts.
$request = $smcFunc['db_query']('', '
SELECT
m.id_msg, m.subject, m.smileys_enabled, m.poster_time, m.body, m.id_topic, t.id_board, b.id_cat,
b.name AS bname, c.name AS cname, t.num_replies, m.id_member, m2.id_member AS id_first_member,
IFNULL(mem2.real_name, m2.poster_name) AS first_poster_name, t.id_first_msg,
IFNULL(mem.real_name, m.poster_name) AS poster_name, t.id_last_msg
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)
INNER JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat)
INNER JOIN {db_prefix}messages AS m2 ON (m2.id_msg = t.id_first_msg)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
LEFT JOIN {db_prefix}members AS mem2 ON (mem2.id_member = m2.id_member)
WHERE m.id_msg IN ({array_int:message_list})
ORDER BY m.id_msg DESC
LIMIT ' . count($messages),
array(
'message_list' => $messages,
)


thx for anyhelp.
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

margarett

Those icons aren't really used in Recent...

That icon shows up when there is a topics listing (MessageIndex, Recent, Unread). In Recent, the listing is by post. So that query doesn't really affect it.

You should be able to perform something along those lines nevertheless, let me take a peek here.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Pipke

yes, that is '' i think' what i'm looking for, like when you(i) have posted or replied in a certain topic, it shows the icon.
thx for the help
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

margarett

It's really an easy trick.

Sources/Recent.php
Find:
'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()),
Add after:
'is_own_post' => $user_info['is_guest'] ? '' : $row['id_member'] == $user_info['id'],

Themes/default/Recent.template.php
Find:
<h5>', $post['board']['link'], ' / ', $post['link'], '</h5>
Replace with:
<h5>',!empty($post['is_own_post']) ? '<img src="' . $settings['images_url'] . '/topic/my_normal_post.gif" alt="" />' : '' ,'', $post['board']['link'], ' / ', $post['link'], '</h5>
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Pipke

wow, really fast, but one question, works this only for the first post what i have started/made(topic start), or also when i have replied on a topic from another member?
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

margarett

It will mark any post that you made, be it the first post of the topic or not, be it your topic or or
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Pipke

Lainaus käyttäjältä: Pipke - helmikuu 21, 2014, 11:16:13 AP
wow, really fast, but one question, works this only for the first post what i have started/made(topic start), or also when i have replied on a topic from another member?

yes it does i think, checked the array quick, working better on script later tonight, thx again for the great help.

topic marked as solved.
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

Advertisement: