since no one can make this (http://www.simplemachines.org/community/index.php?topic=204025.msg1297264#msg1297264) for me, can someone make a whole new page thats linked on the index that works as this websites (http://www.mycoffeelounge.net/forum-recent.php) recent posts does?
basically i want a separate page that views TOPICS, in order of posting, and then if a new post comes along ajax highlights it and moves it up to the top of the list. i want it to have the following info: board, topic, last poster. just like in the picture.
i dont want it to behave like the recent posts allready on the forum. i want it to be fixed, and not change in relation to the users last visit, or if they have read the post or not.
i dont want it to show topics multiple times because there was 6 posts in that topic.
can someone please make this for me?
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.jades-world.com%2Fforums%2FSmileys%2Fdefault%2Fbump1.gif&hash=8eab189745da3908660c0ce81a62ee3780ee1c70)
bump
Right, I could have a crack at this.
So you just want a page that lists alll the topics in your forum (I would suggest the top 50 or something!, all could be drastic!)....
Then the info is listed and depending on the latest post in that topic they are ranked, and it doesn't matter if you have viewed it or not, or if you have logged out..
Is that right?
If that is, then it shouldn't be that hard...
yes thats right!!
ordered from most recent, to least recent please!!
perfect!!
if you can do the ajax thing too, that would be awesome (with a new post the topic is BUMPED up to the top, and highlighted)
I may not be able to do this quickly or straight away as I am quite busy at the moment :)
:D if theres anything i can do lemme know (and ill try to help lol)
global $context, $settings, $scripturl, $txt, $db_prefix, $ID_MEMBER, $user_info, $modSettings;
if (empty($settings['number_recent_posts']))
$number_recent_posts = 15;
else
$number_recent_posts = $settings['number_recent_posts'];
if( isset($_GET['type']) )
$list_type = $_GET['type'];
else
$list_type = 'last';
if( isset($_GET['count']) )
$list_count = $_GET['count'];
else
{
$list_count = $number_recent_posts;
if ($list_type == 'hours')
$list_count = 24;
}
if ($list_type == 'hours')
{
$list_from = strtotime($list_count.' hours ago');
$where_clause = 'ml.posterTime >= ' . $list_from;
$limit_clause = ' ';
}
elseif ($list_type == 'unreplied')
{
$where_clause = 't.numReplies = 0';
if ($list_count == 0)
{
$limit_clause = ' ';
}
else
{
$limit_clause = 'LIMIT ' . $list_count;
}
}
else
{
$where_clause = 't.ID_LAST_MSG >= ' . ($modSettings['maxMsgID'] - 90 * min($list_count, 5));
$limit_clause = 'LIMIT ' . $list_count;
}
$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
$icon_sources = array();
foreach ($stable_icons as $icon)
$icon_sources[$icon] = 'images_url';
$request = db_query("
SELECT
ms.subject AS firstSubject, ms.posterTime AS firstPosterTime, ms.ID_TOPIC, t.ID_BOARD, b.name AS bname,
t.numReplies, t.numViews, ms.ID_MEMBER AS ID_FIRST_MEMBER, ml.ID_MEMBER AS ID_LAST_MEMBER,
ml.posterTime AS lastPosterTime, IFNULL(mems.realName, ms.posterName) AS firstPosterName,
IFNULL(meml.realName, ml.posterName) AS lastPosterName, ml.subject AS lastSubject,
ml.icon AS lastIcon, ms.icon AS firstIcon, t.ID_POLL, t.isSticky, t.locked, ml.modifiedTime AS lastModifiedTime,
LEFT(ml.body, 384) AS lastBody, LEFT(ms.body, 384) AS firstBody,
ml.smileysEnabled AS lastSmileys, ms.smileysEnabled AS firstSmileys, t.ID_FIRST_MSG, t.ID_LAST_MSG,"
. ($user_info['is_guest'] ? '1 AS isRead, 0 AS new_from' : '
IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, 0)) >= ml.ID_MSG_MODIFIED AS isRead,
IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, -1)) + 1 AS new_from') . "
FROM ({$db_prefix}messages AS ms, {$db_prefix}messages AS ml, {$db_prefix}topics AS t, {$db_prefix}boards AS b)
LEFT JOIN {$db_prefix}members AS mems ON (mems.ID_MEMBER = ms.ID_MEMBER)
LEFT JOIN {$db_prefix}members AS meml ON (meml.ID_MEMBER = ml.ID_MEMBER)
LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = t.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)
WHERE " . $where_clause . "
AND t.ID_TOPIC = ms.ID_TOPIC
AND b.ID_BOARD = t.ID_BOARD
AND $user_info[query_see_board]
AND ms.ID_MSG = t.ID_FIRST_MSG
AND ml.ID_MSG = t.ID_LAST_MSG
ORDER BY t.ID_LAST_MSG DESC " . $limit_clause, __FILE__, __LINE__);
$topics = array();
$topic_ids = array();
while ($row = mysql_fetch_assoc($request))
{
if ($row['ID_POLL'] > 0 && $modSettings['pollMode'] == '0')
continue;
$topic_ids[] = $row['ID_TOPIC'];
// Clip the strings first because censoring is slow :/. (for some reason?)
$row['firstBody'] = strip_tags(strtr(parse_bbc($row['firstBody'], $row['firstSmileys'], $row['ID_FIRST_MSG']), array('<br />' => '
')));
if (strlen($row['firstBody']) > 128)
$row['firstBody'] = substr($row['firstBody'], 0, 128) . '...';
$row['lastBody'] = strip_tags(strtr(parse_bbc($row['lastBody'], $row['lastSmileys'], $row['ID_LAST_MSG']), array('<br />' => '
')));
if (strlen($row['lastBody']) > 128)
$row['lastBody'] = substr($row['lastBody'], 0, 128) . '...';
$row['lastSubject'] = $row['firstSubject'];
$row['lastBody'] = $row['firstBody'];
// Decide how many pages the topic should have.
$topic_length = $row['numReplies'] + 1;
if ($topic_length > $modSettings['defaultMaxMessages'])
{
$tmppages = array();
$tmpa = 1;
for ($tmpb = 0; $tmpb < $topic_length; $tmpb += $modSettings['defaultMaxMessages'])
{
$tmppages[] = '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.' . $tmpb . ';topicseen">' . $tmpa . '</a>';
$tmpa++;
}
// Show links to all the pages?
if (count($tmppages) <= 5)
$pages = ', « ' . implode(' ', $tmppages);
// Or skip a few?
else
$pages = ', « ' . $tmppages[0] . ' ' . $tmppages[1] . ' ... ' . $tmppages[count($tmppages) - 2] . ' ' . $tmppages[count($tmppages) - 1];
if (!empty($modSettings['enableAllMessages']) && $topic_length < $modSettings['enableAllMessages'])
$pages .= ' <a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0;all">' . $txt[190] . '</a>';
$pages .= ' , »';
}
else
$pages = '';
// We need to check the topic icons exist... you can never be too sure!
if (empty($modSettings['messageIconChecks_disable']))
{
// First icon first... as you'd expect.
if (!isset($icon_sources[$row['firstIcon']]))
$icon_sources[$row['firstIcon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['firstIcon'] . '.gif') ? 'images_url' : 'default_images_url';
// Last icon... last... duh.
if (!isset($icon_sources[$row['lastIcon']]))
$icon_sources[$row['lastIcon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['lastIcon'] . '.gif') ? 'images_url' : 'default_images_url';
}
// And build the array.
$topics[$row['ID_TOPIC']] = array(
'id' => $row['ID_TOPIC'],
'first_post' => array(
'id' => $row['ID_FIRST_MSG'],
'member' => array(
'name' => $row['firstPosterName'],
'id' => $row['ID_FIRST_MEMBER'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_FIRST_MEMBER'],
'link' => !empty($row['ID_FIRST_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_FIRST_MEMBER'] . '" title="' . $txt[92] . ' ' . $row['firstPosterName'] . '">' . $row['firstPosterName'] . '</a>' : $row['firstPosterName']
),
'time' => timeformat($row['firstPosterTime']),
'timestamp' => forum_time(true, $row['firstPosterTime']),
'subject' => $row['firstSubject'],
'preview' => $row['firstBody'],
'icon' => $row['firstIcon'],
'icon_url' => $settings[$icon_sources[$row['firstIcon']]] . '/post/' . $row['firstIcon'] . '.gif',
'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0;topicseen',
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0;topicseen">' . $row['firstSubject'] . '</a>'
),
'last_post' => array(
'id' => $row['ID_LAST_MSG'],
'member' => array(
'name' => $row['lastPosterName'],
'id' => $row['ID_LAST_MEMBER'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_LAST_MEMBER'],
'link' => !empty($row['ID_LAST_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_LAST_MEMBER'] . '">' . $row['lastPosterName'] . '</a>' : $row['lastPosterName']
),
'time' => timeformat($row['lastPosterTime']),
'timestamp' => forum_time(true, $row['lastPosterTime']),
'subject' => $row['lastSubject'],
'preview' => $row['lastBody'],
'icon' => $row['lastIcon'],
'icon_url' => $settings[$icon_sources[$row['lastIcon']]] . '/post/' . $row['lastIcon'] . '.gif',
'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . ($row['numReplies'] == 0 ? '.0' : '.msg' . $row['ID_LAST_MSG']) . ';topicseen#msg' . $row['ID_LAST_MSG'],
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . ($row['numReplies'] == 0 ? '.0' : '.msg' . $row['ID_LAST_MSG']) . ';topicseen#msg' . $row['ID_LAST_MSG'] . '">' . $row['lastSubject'] . '</a>'
),
'new' => $row['isRead'],
'new_from' => $row['new_from'],
'new_href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['new_from'] . ';topicseen#new',
'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . ($row['numReplies'] == 0 ? '.0' : '.msg' . $row['new_from']) . ';topicseen' . ($row['numReplies'] == 0 ? '' : 'new'),
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . ($row['numReplies'] == 0 ? '.0' : '.msg' . $row['new_from']) . ';topicseen#msg' . $row['new_from'] . '">' . $row['firstSubject'] . '</a>',
'is_sticky' => !empty($modSettings['enableStickyTopics']) && !empty($row['isSticky']),
'is_locked' => !empty($row['locked']),
'is_poll' => $modSettings['pollMode'] == '1' && $row['ID_POLL'] > 0,
'is_hot' => $row['numReplies'] >= $modSettings['hotTopicPosts'],
'is_very_hot' => $row['numReplies'] >= $modSettings['hotTopicVeryPosts'],
'is_posted_in' => false,
'icon' => $row['firstIcon'],
'icon_url' => $settings[$icon_sources[$row['firstIcon']]] . '/post/' . $row['firstIcon'] . '.gif',
'subject' => $row['firstSubject'],
'pages' => $pages,
'replies' => $row['numReplies'],
'views' => $row['numViews'],
'board' => array(
'id' => $row['ID_BOARD'],
'name' => $row['bname'],
'href' => $scripturl . '?board=' . $row['ID_BOARD'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row['ID_BOARD'] . '.0">' . $row['bname'] . '</a>'
)
);
determineTopicClass($topics[$row['ID_TOPIC']]);
}
mysql_free_result($request);
if (!empty($modSettings['enableParticipation']) && !empty($topic_ids))
{
$result = db_query("
SELECT ID_TOPIC
FROM {$db_prefix}messages
WHERE ID_TOPIC IN (" . implode(', ', $topic_ids) . ")
AND ID_MEMBER = $ID_MEMBER", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($result))
{
if (empty($topics[$row['ID_TOPIC']]['is_posted_in']))
{
$topics[$row['ID_TOPIC']]['is_posted_in'] = true;
$topics[$row['ID_TOPIC']]['class'] = 'my_' . $topics[$row['ID_TOPIC']]['class'];
}
}
mysql_free_result($result);
}
if (!empty($topics))
{
echo '
<div class="tborder" ', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? 'style="width: 100%;"' : '', '>
<table border="0" width="100%" cellspacing="1" cellpadding="1" class="bordercolor">
<tr class="titlebg">
<td width="5%"> </td>
<td>', $txt[70], '
</td><td width="14%">', $txt[109], '
</td><td width="4%" align="center">', $txt[110], '
</td><td width="4%" align="center">', $txt[301], '
</td><td width="24%">', $txt[111], '
</td>
</tr>';
foreach ($topics as $topic)
{
// Do we want to seperate the sticky and lock status out?
if (!empty($settings['seperate_sticky_lock']) && strpos($topic['class'], 'sticky') !== false)
$topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_sticky'));
if (!empty($settings['seperate_sticky_lock']) && strpos($topic['class'], 'locked') !== false)
$topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_locked'));
echo '
<tr>
<td class="windowbg2" align="center" width="5%">
<img src="' . $topic['last_post']['icon_url'] . '" alt="" align="middle" />
</td><td class="windowbg' , $topic['is_sticky'] && !empty($settings['seperate_sticky_lock']) ? '3' : '' , '" width="48%" valign="middle">' , $topic['is_locked'] && !empty($settings['seperate_sticky_lock']) ? '
<img src="' . $settings['images_url'] . '/icons/quick_lock.gif" align="right" alt="" style="margin: 0;" />' : '' , $topic['is_sticky'] && !empty($settings['seperate_sticky_lock']) ? '
<img src="' . $settings['images_url'] . '/icons/show_sticky.gif" align="right" alt="" style="margin: 0;" />' : '';
if ($topic['new'] == 0)
{
echo '<b>', $topic['first_post']['link'], '</b>';
echo '<a href="', $topic['new_href'], '"> <img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" /></a>';
}
else
{
echo $topic['first_post']['link'];
}
echo '
<span class="smalltext">', $topic['pages'], ' ', $txt['smf88'], ' ', $topic['board']['link'], '</span></td>
<td class="windowbg" valign="middle" width="12%">
', $topic['first_post']['member']['link'], '</td>
<td class="windowbg2" valign="middle" width="4%" align="center">
', $topic['replies'], '</td>
<td class="windowbg" valign="middle" width="4%" align="center">
', $topic['views'], '</td>
<td class="windowbg2" valign="middle" width="20%">
<div align=right><span class="smalltext">
', $topic['last_post']['time'], '<br />
<a href="', $topic['last_post']['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt[111], '" title="', $txt[111], '" style="float: right;" /></a>
', $txt[525], ' ', $topic['last_post']['member']['link'], '
</span></div>
</td>
</tr>';
}
echo '</table></div>';
}
what do i do with that? LOL
Try installing the custom action mod, then create a new php action. :) I just did it and it seems to work AWESOME. :)
Now - how would I filter OUT a board or two?
:P
Quote from: digit on January 16, 2008, 09:21:41 PM
Try installing the custom action mod, then create a new php action. :) I just did it and it seems to work AWESOME. :)
Now - how would I filter OUT a board or two?
:P
i dunno how to use that mod...can you tell me what you did?
Quote from: Alundra on January 16, 2008, 09:55:52 PM
i dunno how to use that mod...can you tell me what you did?
1. Install this first...
http://custom.simplemachines.org/mods/index.php?mod=331
Once that is installed, go into Features and Options in your admin panel, and click on Custom Actions.
2. Create a New Action.
3. Name it MyRecent (no spaces)
4. Name the page title whatever you want.
Come back here and copy all that text - NOTE: to avoid funky characters, you will need to click on "Quote" of that post, then copy and paste the text, removing the quote and php bbc tags!!!
I hope that helps!
digit
seems to work well, thankyou :)
Glad I could help! Thank you for digging for it! ;)
do you know how to make it display more topics?
how long does it collect from?
global $scripturl;
echo '
<table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">
<tr><td colspan="3" class="titlebg">Recent topics</td></tr> ';
$what=ssi_recentTopics('8', NULL, 'array');
foreach ($what as $topic)
{
echo '
<tr>
<td class="windowbg" valign="middle">
', $topic['link'];
// Is this topic new? (assuming they are logged in!)
if (!$topic['new'] && $context['user']['is_logged'])
echo '
<a href="', $scripturl, '?topic=', $topic['topic'], '.from', $topic['new_from'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';
echo '
</td>
<td class="windowbg2" valign="middle" width="20%">
', $topic['poster']['link'], '
</td>
<td class="windowbg2" valign="middle" width="35%">';
if ($settings['images_url'] != $settings['theme_url'] . '/images' || file_exists($settings['theme_dir'] . '/images/icons/last_post.gif'))
echo '
<a href="', $topic['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt[111], '" title="', $txt[111], '" border="0" style="float: right;" /></a>';
echo '
<span class="smalltext">
', $topic['time'], '
</span>
</td>
</tr>';
}
echo '
</table>';
- add board ID number like to the function if you want to narrow down the boards recent topics are taken from. change it to ssi_recentTopics('8', array('3','56') , 'array') where the numbers 3 and 56 are examples of board ID's.
this code will look better on a custom page
^ it doesnt want to work for me :(
@Alundra, I can take a shot at this. To pull up the top 10 posters, topics, 10 newest members with Ajax so it refreshes every time a new post is made it bumps up etc. It will be displayed just under the Home, Help, Admin etc buttons. Let me know if you are interested
Quote from: babjusi on January 21, 2008, 07:15:06 PM
@Alundra, I can take a shot at this. To pull up the top 10 posters, topics, 10 newest members with Ajax so it refreshes every time a new post is made it bumps up etc. It will be displayed just under the Home, Help, Admin etc buttons. Let me know if you are interested
VERY interested, could you make it about 25 topics though?
I guess I can, but I wouldn''t advice it as it tends to strech and sometime it won''t load properly. With 10 topics it works like a charm
Quote from: babjusi on January 21, 2008, 08:24:26 PM
I guess I can, but I wouldn''t advice it as it tends to strech and sometime it won''t load properly. With 10 topics it works like a charm
okay, i guess we could try both? if its not too much trouble, that is :D
No trouble at all
Awesome :D
he wont do it cause i wont give him FTP access....anyone else wanna take it?
Quote from: Alundra on January 21, 2008, 09:34:10 PM
he wont do it cause i wont give him FTP access....anyone else wanna take it?
It ain''it alundra. As I told you with pm I don''t mind one bit that you wouldn''t give me the ftp info. I totally understand that. But this modification is my baby. Some people paid me to create it and install it for them. I offered to installi ti for you for free out of the goodness of my heart and I got the idea that my gesture wasn''t appreciated.
And I wouldn''t just post it out in the open for you or send it to you like that. Cause it wouldn''t be fair to them that others get it for free when they paid to get it installed at their forums. So, I had a change of hearts let''s say.
Anyhow, I do apologize for offering to do it for you for free. Hope no hard feelings :)
All the best
Babjusi
Quote from: babjusi on January 21, 2008, 09:44:16 PM
Quote from: Alundra on January 21, 2008, 09:34:10 PM
he wont do it cause i wont give him FTP access....anyone else wanna take it?
It ain''it alundra. As I told you with pm I don''t mind one bit that you wouldn''t give me the ftp info. I totally understand that. But this modification is my baby. Some people paid me to create it and install it for them. I offered to installi ti for you for free out of the goodness of my heart and I got the idea that my gesture wasn''t appreciated.
And I wouldn''t just post it out in the open for you or send it to you like that. Cause it wouldn''t be fair to them that others get it for free when they paid to get it installed at their forums. So, I had a change of hearts let''s say.
Anyhow, I do apologize for offering to do it for you for free. Hope no hard feelings :)
All the best
Babjusi
Offering someone something and then not giving it is wrong. You should have thought about it from the perspective you currently have instead of getting my hopes up.
Also, refusing to do it after I reject giving you FTP access is VERY suspicious to say the least and leads me to believe you have/had ill intent-Be that you wanted something from my forum (say my themes, so you could sell them), or you wanted my forum, or you wanted to sabotage my forum, I don't know.
I hope YOU will understand that that forum is MY BABY, and I WILL protect it and all my members too. I'm serious about my forum, I don't take FTP or admin access lightly.
And if you think I wouldn't see the code after you put it there you are mistaken.
Alundra, Alundra, Alundra. I will not deign to even respond to this disgusting post of yours full of rubbish . But I will tell you this. You are on a road to become Staff here and this kind of behavior, making such wild and unfounded accusations, it doesn''t fit to the behavior of a staff member. That was all I had to say.
All the best
Quote from: babjusi on January 21, 2008, 09:59:22 PM
Alundra, Alundra, Alundra. I will not deign to even respond to this disgusting post of yours full of sh*********t . But I will tell you this. You are on a road to become Staff here and this kind of behavior, making such wild and unfounded accusations, it doesn''t fit to the behavior of a staff member. That was all I had to say.
All the best
I am merely pointing out that your actions are suspicious. I'm sorry if they were not intended to be, but I have red flags. Thank you for the offer though :)
Oooo, this looks cool. I would use this no doubt!
I'll take on the task. Its pretty far from difficult and I'll need something to fill my time after I finish my current mod I'm working on.
Yaaaaaaaaaaaaaaaaaaaaaaaay!!!
:D Danke SlammedDime :D