So I patched up my SMF 1.1 because my host updated 8) But now this module doesn't work anymore. Its the Recent Topic Module for mambo, now I know this isn't the mambo section of the site but you guys here could probably help me more and the problem is with SMF not mambo. ;)
The error I get is
Unknown column 't.ID_TOPIC' in 'on clause'
File: /home/mike/public_html/modules/mod_smf_recent_topics.php
Line: 69

(http://putfile.com/pic.php?pic=11/31313212593.jpg&s=x11)
I tried compairing it with the new recent.php that came with the patch but that didn't help. :(
Below is the php
Thanks in advanced!
<?php
/**
* @version $Id: mod_smf_recent_topics.php,v 1.2 2005/04/07 2:35 kochp, rsuplido $
* @package Mambo
* @copyright (C) 2000 - 2005 Miro International Pty Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* Mambo is Free Software
*/
/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
$board = ($params->get( 'board' )=="" ? 1 : $params->get( 'board' ));
$limit = ($params->get( 'limit' )=="" ? 5 : $params->get( 'limit' ));
$datetime = ($params->get( 'datetime' )=="" ? 1 : $params->get( 'datetime' ));
$numchar = $params->get( 'numchar' );
$namedisplay = ($params->get('namedisplay')=="" ? 1 : $params->get( 'namedisplay' ));
$moduleclass_sfx = $params->get( 'moduleclass_sfx' );
if ($limit == '') {
die ('Please go to Mambo-SMF Recent Topics module and click save to initialize parameters.');
}
global $context, $txt, $scripturl, $settings, $db_prefix, $ID_MEMBER, $user_info, $modSettings;
global $smfItemid, $mosConfig_sef;
$database->setQuery("SELECT id FROM #__menu WHERE link = 'index.php?option=com_smf'");
if ($this->_result = $database->query()) {
$row = mysql_fetch_object($this->_result);
$smfItemid = $row->id;
}
$myurl = "index.php?option=com_smf&Itemid=" . $smfItemid."&";
$scripturl = $myurl;
$exclude_boards = array();
$output_method = 'echo';
// Find all the posts. Newer ones will have higher IDs.
$request = db_query("
SELECT
mem.realName,
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_members AS mem, 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_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 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 mem.memberName = m.posterName
ORDER BY m.posterTime DESC
LIMIT $limit", __FILE__, __LINE__);
$posts = array();
while ($row = mysql_fetch_assoc($request)) {
// Censor the subject.
censorText($row['subject']);
$posthref = sefRelToAbs($scripturl . 'topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_LAST_MSG'] . ';topicseen#msg' . $row['ID_LAST_MSG']);
$posthref = (substr($posthref,strlen($posthref)-1)=="/" ? substr($posthref,0,strlen($posthref)-1) : $posthref );
// Build the array.
$posts[] = array(
'board' => array(
'id' => $row['ID_BOARD'],
'name' => $row['bName'],
'href' => $scripturl . '?board=' . $row['ID_BOARD'] . '.0',
'link' => '<a href="' . sefRelToAbs($scripturl . 'board=' . $row['ID_BOARD'] . '.0').'">' . $row['bName'] . '</a>'
),
'topic' => $row['ID_TOPIC'],
'poster' => array(
'name' => $row['posterName'],
'href' => empty($row['ID_MEMBER_UPDATED']) ? '' : $scripturl . 'action=profile;u=' . $row['ID_MEMBER_UPDATED'],
'link' => empty($row['ID_MEMBER_UPDATED']) ? ($namedisplay == 1 ? $row['realName'] : $row['posterName']) : '<a href="' . sefRelToAbs($scripturl . 'action=profile;u=' . $row['ID_MEMBER_UPDATED']) . '">' . ($namedisplay == 1 ? $row['realName'] : $row['posterName']) . '</a>'
),
'subject' => $row['subject'],
'short_subject' => strlen(un_htmlspecialchars($row['subject'])) > 25 ? htmlspecialchars(substr(un_htmlspecialchars($row['subject']), 0, 22) . '...') : $row['subject'],
'time' => timeformat($row['posterTime']),
'timestamp' => $row['posterTime'],
'href' => $posthref,
'link' => '<a href="' . $scripturl . 'topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_LAST_MSG'] . '#msg' . $row['ID_LAST_MSG'] . '">' . $row['subject'] . '</a>',
'new' => !empty($row['isRead']),
'newtime' => $row['logTime'],
'replies' => $row['numReplies']
);
}
mysql_free_result($request);
// Just return it.
if ($output_method != 'echo' || empty($posts))
return $posts;
echo '
<ul class="latesnews',$moduleclass_sfx,'">
';
foreach ($posts as $post) {
$newlink = sefRelToAbs($scripturl . 'topic=' . $post['topic'] . '.from' . $post['newtime']);
$newlink = (substr($newlink,strlen($newlink)-1) == "/" ? substr($newlink,0,strlen($newlink)-1) : $newlink);
echo '<li class="latestnews',$moduleclass_sfx,'">';
echo '<a class="latestnews',$moduleclass_sfx,'" href="', $post['href'], '">';
if ($board == 1 && $board != '') {
echo '<i>',$post['board']['name'], '</i> : ';
}
echo ($numchar != '' ? substr($post['subject'],0,$numchar).(strlen($post['subject']) > $numchar ? '...' : '') : $post['subject']) , '</a> (',
$post['replies'], ') ', $txt[525], ' ', ($mosConfig_sef == '1' ? str_replace(";","/",$post['poster']['link']) : $post['poster']['link']) , '
', $post['new'] ? '' : '<a href="' . $newlink . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt[302] . '" border="0" /></a>';
if ($datetime == 1 && $datetime != '') {
echo ' - ',$post['time'];
}
echo "</li>\n";
}
echo '</ul>';
?>
anyone have any ideas?
this update is causing problems with mambo now too :-[
You must tell the mambo people that if they are going to integrate with other scripts then they must keep up to date and provide compatibilty for multiple versions of the script they are trying to integrate with. The problem you are having is not SMF, it is a mambo script.
What is wrong with a simple:
<?php ssi_recentTopics(); ?>
In a page of your own creation?
See it work just fine here:
http://www.simplemachines.org/community/ssi_examples.php
This mambo mod was created by a user and is not the official SMF recent topics mod. Just like the mods made for SMF many don't work anymore. The official mod works but its too simple and doesn't offer then functionality and customization that this one does. :(
Anyway, if this was a mambo error why does it bring SMF up in a frame and show it giving an error?
Try this
<?php
/**
* @version $Id: mod_smf_recent_topics.php,v 1.2 2005/04/07 2:35 kochp, rsuplido $
* @package Mambo
* @copyright (C) 2000 - 2005 Miro International Pty Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* Mambo is Free Software
*/
/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
$board = ($params->get( 'board' )=="" ? 1 : $params->get( 'board' ));
$limit = ($params->get( 'limit' )=="" ? 5 : $params->get( 'limit' ));
$datetime = ($params->get( 'datetime' )=="" ? 1 : $params->get( 'datetime' ));
$numchar = $params->get( 'numchar' );
$namedisplay = ($params->get('namedisplay')=="" ? 1 : $params->get( 'namedisplay' ));
$moduleclass_sfx = $params->get( 'moduleclass_sfx' );
if ($limit == '') {
die ('Please go to Mambo-SMF Recent Topics module and click save to initialize parameters.');
}
global $context, $txt, $scripturl, $settings, $db_prefix, $ID_MEMBER, $user_info, $modSettings;
global $smfItemid, $mosConfig_sef;
$database->setQuery("SELECT id FROM #__menu WHERE link = 'index.php?option=com_smf'");
if ($this->_result = $database->query()) {
$row = mysql_fetch_object($this->_result);
$smfItemid = $row->id;
}
$myurl = "index.php?option=com_smf&Itemid=" . $smfItemid."&";
$scripturl = $myurl;
$exclude_boards = array();
$output_method = 'echo';
// Find all the posts. Newer ones will have higher IDs.
$request = db_query("
SELECT
mem.realName,
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_members AS mem, 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_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 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 mem.memberName = m.posterName
ORDER BY m.posterTime DESC
LIMIT $limit", __FILE__, __LINE__);
$posts = array();
while ($row = mysql_fetch_assoc($request)) {
// Censor the subject.
censorText($row['subject']);
$posthref = sefRelToAbs($scripturl . 'topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_LAST_MSG'] . ';topicseen#msg' . $row['ID_LAST_MSG']);
$posthref = (substr($posthref,strlen($posthref)-1)=="/" ? substr($posthref,0,strlen($posthref)-1) : $posthref );
// Build the array.
$posts[] = array(
'board' => array(
'id' => $row['ID_BOARD'],
'name' => $row['bName'],
'href' => $scripturl . '?board=' . $row['ID_BOARD'] . '.0',
'link' => '<a href="' . sefRelToAbs($scripturl . 'board=' . $row['ID_BOARD'] . '.0').'">' . $row['bName'] . '</a>'
),
'topic' => $row['ID_TOPIC'],
'poster' => array(
'name' => $row['posterName'],
'href' => empty($row['ID_MEMBER_UPDATED']) ? '' : $scripturl . 'action=profile;u=' . $row['ID_MEMBER_UPDATED'],
'link' => empty($row['ID_MEMBER_UPDATED']) ? ($namedisplay == 1 ? $row['realName'] : $row['posterName']) : '<a href="' . sefRelToAbs($scripturl . 'action=profile;u=' . $row['ID_MEMBER_UPDATED']) . '">' . ($namedisplay == 1 ? $row['realName'] : $row['posterName']) . '</a>'
),
'subject' => $row['subject'],
'short_subject' => strlen(un_htmlspecialchars($row['subject'])) > 25 ? htmlspecialchars(substr(un_htmlspecialchars($row['subject']), 0, 22) . '...') : $row['subject'],
'time' => timeformat($row['posterTime']),
'timestamp' => $row['posterTime'],
'href' => $posthref,
'link' => '<a href="' . $scripturl . 'topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_LAST_MSG'] . '#msg' . $row['ID_LAST_MSG'] . '">' . $row['subject'] . '</a>',
'new' => !empty($row['isRead']),
'newtime' => $row['logTime'],
'replies' => $row['numReplies']
);
}
mysql_free_result($request);
// Just return it.
if ($output_method != 'echo' || empty($posts))
return $posts;
echo '
<ul class="latesnews',$moduleclass_sfx,'">
';
foreach ($posts as $post) {
$newlink = sefRelToAbs($scripturl . 'topic=' . $post['topic'] . '.from' . $post['newtime']);
$newlink = (substr($newlink,strlen($newlink)-1) == "/" ? substr($newlink,0,strlen($newlink)-1) : $newlink);
echo '<li class="latestnews',$moduleclass_sfx,'">';
echo '<a class="latestnews',$moduleclass_sfx,'" href="', $post['href'], '">';
if ($board == 1 && $board != '') {
echo '<i>',$post['board']['name'], '</i> : ';
}
echo ($numchar != '' ? substr($post['subject'],0,$numchar).(strlen($post['subject']) > $numchar ? '...' : '') : $post['subject']) , '</a> (',
$post['replies'], ') ', $txt[525], ' ', ($mosConfig_sef == '1' ? str_replace(";","/",$post['poster']['link']) : $post['poster']['link']) , '
', $post['new'] ? '' : '<a href="' . $newlink . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt[302] . '" border="0" /></a>';
if ($datetime == 1 && $datetime != '') {
echo ' - ',$post['time'];
}
echo "</li>\n";
}
echo '</ul>';
?>
Thanks for the try Jay! :) But i still get an error with the code u posted. :(
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '{FROM smf_members AS mem, smf_topics AS t, smf_messages AS m, smf_messages AS m2' at line 103
File: /home/mike/public_html/modules/mod_smf_recent_topics.php
Line: 224
could u maybe give me an idea of what needs to be changed to be compatable?
It always seems to have a problem with this line of code.
LIMIT $limit", __FILE__, __LINE__);
I wonder why ???
I guess you can try asking for help over at the mambo/joomla boards since this is related to it.
or you could tell mysql to use traditional mode.
just change the sql mode in my.ini to this
sql-mode=""
Where do I find my.ini, in PHPmyAdmin?
if you're using windows, and depending on how you installed mysql, my.ini is either in mysql folder or c:/windows.
Are you on a dedicated server? The only way that you can edit this if you are on a dedicated box.
oh, no i share the server with alot of other sites.
Damn i wish I could just go back to the old version. :(
Finally, I fixed it!
replace this (on or around line 59)
FROM smf_members AS mem, smf_topics AS t, smf_messages AS m, smf_messages AS m2, smf_boards AS b" . (!$user_info['is_guest'] ? "
With this
FROM ({$db_prefix}members AS mem, {$db_prefix}topics AS t, {$db_prefix}messages AS m, {$db_prefix}messages AS m2, {$db_prefix}boards AS b)" . (!$user_info['is_guest'] ? "
Thanks everyone for ur help trying to fix it!