Home arrow Forum
SMF Recent Posts
  Welcome, Guest. Please login or register.
December 01, 2008, 08:28:03 PM
Home New Posts Search Calendar


Login with username, password and session length
Forum  |  General Discussion  |  General Discussion  |  Topic: SMF Recent Posts « previous next »
Pages: [1] Go Down Print
Author Topic: SMF Recent Posts  (Read 21384 times)
Reggie
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 8


View Profile
SMF Recent Posts
« on: April 07, 2005, 02:48:00 AM »

Thanks for making this module. I made some changes however to have it display in a more standard way (bullets), as well as revised the SQL so as to display the total replies as well.

Displaying the total replies basically changes the logic of the query since you have to display only a post once, even if there are multiple replies.  the title displayed is that of the original.

I'm attaching my enhancement. Overwrite mod_smf_recent_posts.php under /modules with this one.

I hope you all like the mod.

Thanks.

(To admin: if revision to the file is not allowed, please remove attachment.)

* mod_smf_recent_posts.php (5.07 KB - downloaded 109 times.)
« Last Edit: April 07, 2005, 02:50:14 AM by Reggie » Logged
cowboy
Administrator
Hero Member
*****

Karma: +30/-0
Offline Offline

Posts: 663



View Profile WWW
Re: SMF Recent Posts
« Reply #1 on: April 07, 2005, 04:09:51 AM »

Reggie,

You may also post it in the repository. Just click "Post your hack" link. Then I will just approve it.

Thanks.
Logged
Reggie
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 8


View Profile
Re: SMF Recent Posts
« Reply #2 on: April 07, 2005, 04:59:23 PM »

Attached is a screenshot.  Grin

* screenshot.png (2.08 KB - downloaded 167 times.)
Logged
cowboy
Administrator
Hero Member
*****

Karma: +30/-0
Offline Offline

Posts: 663



View Profile WWW
Re: SMF Recent Posts
« Reply #3 on: April 09, 2005, 03:56:48 AM »

Reggie,

I just looked at your modifications. I didn't realize that what you did is actually a recent topics module. I renamed the files and posted it as a new module.

Nice work!
Logged
aravot
Jr. Member
**

Karma: +0/-0
Offline Offline

Posts: 89


test/test


View Profile WWW
Re: SMF Recent Posts
« Reply #4 on: April 09, 2005, 01:13:34 PM »

Reggie, I like your ‘SMF Recent Post’ module one request though, right now the topic and post are linked to the post, can you change so that when clicked on topic the topic is displayed and when clicked on post the post is displayed.

Thank you

Logged
Fernando
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 14


View Profile
Re: SMF Recent Posts got this error to the mod reggie
« Reply #5 on: April 10, 2005, 07:34:30 AM »

Yesterdey I got this error that locked my site:
Fatal error: Call to undefined function: db_query() in /home/httpd/vhosts/saudeemrede.net/httpdocs/modules/mod_smfRecentPosts.php on line 44.

Any hints?
Logged
Fernando
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 14


View Profile
Ooops.
« Reply #6 on: April 10, 2005, 08:13:34 AM »

I changed my index.php, and forgot to put the code for smf integration. now it works perfectely with the reggie hack.

Sorry for that.


Regards
Ferhacks
Logged
Reggie
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 8


View Profile
Re: SMF Recent Posts
« Reply #7 on: April 10, 2005, 08:24:34 PM »

aravot,

Sure. Here's how you do it:

On lines 112-115:
Code:
    echo '<a href="', $post['href'], '">';
    if ($board == 1 && $board != '') {
echo '<i>',$post['board']['name'], '</i>: ';
}

Change it to:
Code:
    if ($board == 1 && $board != '') {
echo '<i>',$post['board']['link'], '</i>: ';
}
    echo '<a href="', $post['href'], '">';

Cheers.


Reggie, I like your ‘SMF Recent Post’ module one request though, right now the topic and post are linked to the post, can you change so that when clicked on topic the topic is displayed and when clicked on post the post is displayed.

Thank you

Logged
aravot
Jr. Member
**

Karma: +0/-0
Offline Offline

Posts: 89


test/test


View Profile WWW
Re: SMF Recent Posts
« Reply #8 on: April 11, 2005, 02:00:19 AM »

Thank you, worked like a charm
Logged
Reggie
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 8


View Profile
Re: SMF Recent Posts
« Reply #9 on: April 19, 2005, 10:51:53 AM »

Member sinnys asked me privately a mod to show the Real Name of the user instead of the username. Here's the mod:

Find:
Code:
$request = db_query("
SELECT
m.posterTime,
m2.subject,
t.ID_TOPIC,
t.ID_MEMBER_UPDATED,
t.ID_LAST_MSG,
m.ID_BOARD,
b.name AS bName,
t.numReplies,
m.posterName, " . ($user_info['is_guest'] ? '1 AS isRead, 0 AS logTime' : '
IFNULL(lt.logTime, IFNULL(lmr.logTime, 0)) >= GREATEST(m.posterTime, m.modifiedTime) AS isRead,
IFNULL(lt.logTime, IFNULL(lmr.logTime, 0)) AS logTime') . "
FROM smf_topics AS t, smf_messages AS m, smf_messages AS m2, smf_boards AS b" . (!$user_info['is_guest'] ? "
LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_FIRST_MSG 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 t.ID_BOARD = m.ID_BOARD
      AND t.ID_BOARD = b.ID_BOARD" . (empty($exclude_boards) ? '' : "
      AND t.ID_BOARD NOT IN (" . implode(', ', $exclude_boards) . ")") . "
AND t.ID_LAST_MSG = m.ID_MSG
AND t.ID_FIRST_MSG = m2.ID_MSG
ORDER BY m.posterTime DESC
LIMIT $limit", __FILE__, __LINE__);

replace with:
Code:
$request = db_query("
SELECT
m.posterTime,
m2.subject,
t.ID_TOPIC,
t.ID_MEMBER_UPDATED,
t.ID_LAST_MSG,
m.ID_BOARD,
b.name AS bName,
t.numReplies,
u.realName,
m.posterName, " . ($user_info['is_guest'] ? '1 AS isRead, 0 AS logTime' : '
IFNULL(lt.logTime, IFNULL(lmr.logTime, 0)) >= GREATEST(m.posterTime, m.modifiedTime) AS isRead,
IFNULL(lt.logTime, IFNULL(lmr.logTime, 0)) AS logTime') . "
FROM smf_topics AS t, smf_messages AS m, smf_messages AS m2, smf_members AS u, smf_boards AS b" . (!$user_info['is_guest'] ? "
LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_FIRST_MSG 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 t.ID_BOARD = m.ID_BOARD
      AND t.ID_BOARD = b.ID_BOARD" . (empty($exclude_boards) ? '' : "
      AND t.ID_BOARD NOT IN (" . implode(', ', $exclude_boards) . ")") . "
AND t.ID_LAST_MSG = m.ID_MSG
AND t.ID_FIRST_MSG = m2.ID_MSG
AND m.posterName = u.memberName
ORDER BY m.posterTime DESC
LIMIT $limit", __FILE__, __LINE__);


Then find:
Code:
'link' => empty($row['ID_MEMBER_UPDATED']) ? $row['posterName'] : '<a href="' . sefRelToAbs($scripturl . 'action=profile;u=' . $row['ID_MEMBER_UPDATED']) . '">' . $row['posterName'] . '</a>'

replace with:
Code:
'link' => empty($row['ID_MEMBER_UPDATED']) ? $row['posterName'] : '<a href="' . sefRelToAbs($scripturl . 'action=profile;u=' . $row['ID_MEMBER_UPDATED']) . '">' . $row['realName'] . '</a>'


Reggie
Logged
Elbson
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 1


View Profile
Re: SMF Recent Posts
« Reply #10 on: April 21, 2005, 12:46:50 AM »

I installed SMF Recent Posts, but it does not show recent posts for the guest. Is necessary to make login to see. The module is in public mode. What  the problem?
Logged
Reggie
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 8


View Profile
Re: SMF Recent Posts
« Reply #11 on: April 21, 2005, 12:56:48 AM »

Hmm. It must be the permission settings of your forums. I just tried it on mine and I can see the recent topics from guests.
Logged
shizku
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 1


View Profile
Re: SMF Recent Posts got this error to the mod reggie
« Reply #12 on: June 05, 2005, 07:25:54 AM »

Yesterdey I got this error that locked my site:
Fatal error: Call to undefined function: db_query() in /home/httpd/vhosts/saudeemrede.net/httpdocs/modules/mod_smfRecentPosts.php on line 44.

Any hints?

ahh, i also had this problem. can anyone guide me?
Logged
-Wolverine
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 10


View Profile
Re: SMF Recent Posts
« Reply #13 on: July 26, 2005, 09:24:19 AM »

This is a great module Reggie and cowboy, thanks!  I am having one issue though... threads are being shown from the forums in which users/guests don't have permission, i.e. administrative forums.  Have you thought about incorporating this functionality into the module?
Logged
cowboy
Administrator
Hero Member
*****

Karma: +30/-0
Offline Offline

Posts: 663



View Profile WWW
Re: SMF Recent Posts
« Reply #14 on: July 27, 2005, 12:04:59 PM »

Yes... but been busy lately. It will be sure implemented on the next version.
Logged
Pages: [1] Go Up Print 
Forum  |  General Discussion  |  General Discussion  |  Topic: SMF Recent Posts « previous next »
Jump to:  



Login with username, password and session length

Powered by MySQL Powered by PHP Forum | Powered by SMF 1.0.5 & Mambo-SMF.
© 2001-2005, Lewis Media. All Rights Reserved.
Valid XHTML 1.0! Valid CSS!
None of the text or images in this public website may be copied without the expressed written consent of the authors.
Copyright 2005 by MamboHacks.com. Powered by Mambo. All rights reserved.
TERMS OF USE