Home arrow Forum recent topics module
  Welcome, Guest. Please login or register.
Did you miss your activation email?
December 03, 2008, 12:56:10 AM
Home New Posts Search Calendar


Login with username, password and session length
+  Joomla Forum
|-+  Joomla Hacks
| |-+  Joomla-SMF Forum Support
| | |-+  Joomla-SMF 1.0.x (Moderators: -Wolverine, kai920)
| | | |-+  recent topics module
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: 1 [2] Go Down Print
Author Topic: recent topics module  (Read 7216 times)
Editor (cowboy)
Administrator
Joomla Guru
*****

Karma: +86/-23
Offline Offline

Posts: 1144



View Profile WWW
Re: recent topics module
« Reply #15 on: November 02, 2005, 11:09:32 AM »

cowboy: has the new recent topics module been changed signficantly for joomla-smf 1.0.2? would the old version still work on 1.0.2?
No. the only thing that changed was the inclusion of SSI. I think the previous version should still work. I'm just not sure of the effect of that inluded SSI.php.
Logged
sioban
Joomla Newbie
*

Karma: +0/-0
Offline Offline

Posts: 4


View Profile
Re: recent topics module
« Reply #16 on: November 22, 2005, 03:47:53 AM »

I've juste upgraded to joomla 1.0.4 and I got a very similar error.

Do you have any clue Huh
Logged
Gandalf
Joomla Master
***

Karma: +4/-0
Offline Offline

Posts: 131



View Profile WWW
Re: recent topics module
« Reply #17 on: November 22, 2005, 09:15:39 AM »

Me too, right after i upgraded to 1.0.4 i got this error Sad
Logged
Jabari
Joomla Newbie
*

Karma: +2/-0
Offline Offline

Posts: 2


View Profile
Re: recent topics module
« Reply #18 on: November 22, 2005, 04:09:40 PM »

Me too, right after i upgraded to 1.0.4 i got this error Sad

I got the same error as well after the 1.0.4 Joomla update. I narrowed the problem down to a call to the SMF function "db_query()" on about line 44 of the file "mod_smf_recent_topics.php" in the "modules" subdirectory of my Joomla installation. The "db_query()" function seems to be an enhanced version of the MySQL "mysql_query()" function. So I rewrote that part of the module code to use "mysql_query()" instead of "db_query()". I am not a PHP expert so I don't know what the side effects of doing this is so do this hack at your own risk. Here is what I changed:

Original Code Block:
Code:
$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_prefix}members AS mem,
{$smf_prefix}topics AS t,
{$smf_prefix}messages AS m,
{$smf_prefix}messages AS m2,
{$smf_prefix}boards AS b" . (!$user_info['is_guest'] ? "
LEFT JOIN {$smf_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
LEFT JOIN {$smf_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
AND $user_info[query_see_board]
ORDER BY m.posterTime DESC
LIMIT $limit", __FILE__, __LINE__);

Modified to:
Code:
$request = mysql_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_prefix}members AS mem,
{$smf_prefix}topics AS t,
{$smf_prefix}messages AS m,
{$smf_prefix}messages AS m2,
{$smf_prefix}boards AS b" . (!$user_info['is_guest'] ? "
LEFT JOIN {$smf_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
LEFT JOIN {$smf_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
AND $user_info[query_see_board]
ORDER BY m.posterTime DESC
LIMIT $limit");

So I just changed line 44 from
Code:
$request = db_query("
to
Code:
$request = mysql_query("

and also line 74 from
Code:
LIMIT $limit", __FILE__, __LINE__);
to
Code:
LIMIT $limit");

After I made the above changes the module appears to be working again. I haven't figured out what this change cripples in SMF but so far everything seems to still be working. I figure this hack will hold me over until an official fix is released.
Logged
Gerhard Heeke
Joomla Newbie
*

Karma: +0/-0
Offline Offline

Posts: 1


View Profile
Re: recent topics module
« Reply #19 on: November 22, 2005, 04:30:09 PM »

Thank you for the patch. I had the same issue and the patch was very helpful!
Logged
Gandalf
Joomla Master
***

Karma: +4/-0
Offline Offline

Posts: 131



View Profile WWW
Re: recent topics module
« Reply #20 on: November 22, 2005, 07:29:56 PM »

the db_query is an SMF function that is used to 1st execute a mysql_query and second is to write in the error log of smf any error or warning that happened during the process (That's why theres __FILE__ and __LINE__ which are used for the error log to write the error and where it happened,

now what i couldn't understand is why SMF's db_suery is failing to detect selected database, i even tried to "mysql_select_db" before the query but didn't work
Logged
Editor (cowboy)
Administrator
Joomla Guru
*****

Karma: +86/-23
Offline Offline

Posts: 1144



View Profile WWW
Re: recent topics module
« Reply #21 on: November 22, 2005, 08:49:16 PM »

I'm planning to upgrade this weekend. Then I can probably take a look at this.
Logged
Jason Reed
Joomla Newbie
*

Karma: +0/-0
Offline Offline

Posts: 6


View Profile
Re: recent topics module
« Reply #22 on: November 23, 2005, 11:47:57 AM »

Ok you guys probably won't believe me on this one but I've also linked this error in the recent topics module with the patching of the index.php page in the Joomla-SMF bridge.

When I first updated to Joomla 1.0.4 I didn't have any problems on the site. I logged in and could do anything I wanted even access the SMF forum and get data from the forum in the recent topics module without an error.

I then remembered today that I should patch my index.php and that is when I got the database error that everyone else has written about here.

I un-patched my index.php and things went back to normal.

I'm going to keep my index.php un-patched until cowboy updates as he mentioned in his last post.
Logged

afonic
Joomla Pro
**

Karma: +8/-1
Offline Offline

Posts: 84



View Profile WWW
Re: recent topics module
« Reply #23 on: November 23, 2005, 02:31:04 PM »

Weird but I use 1.0.4 and have my index.php patched but have no problem so far.

I guess it happens only with some configurations.
Logged

JoomlaCorner.com
Joomla Newbie
*

Karma: +0/-0
Offline Offline

Posts: 2


View Profile
Re: recent topics module
« Reply #24 on: November 24, 2005, 08:45:37 AM »


Try to insert this code at line 24

Code:
require($mosConfig_absolute_path."/administrator/components/com_smf/config.smf.php");
require_once($smf_path."/SSI.php");
require_once ($smf_path."/Settings.php");


-------

JoomlaCorner.com
Logged
sioban
Joomla Newbie
*

Karma: +0/-0
Offline Offline

Posts: 4


View Profile
Re: recent topics module
« Reply #25 on: November 24, 2005, 08:55:00 AM »

Try to insert this code at line 24

Code:
require($mosConfig_absolute_path."/administrator/components/com_smf/config.smf.php");
require_once($smf_path."/SSI.php");
require_once ($smf_path."/Settings.php");

Didn't change anything...
Logged
-Wolverine
Moderator
Joomla Guru
*****

Karma: +376/-34
Offline Offline

Posts: 3393


Lead Developer


View Profile WWW
Re: recent topics module
« Reply #26 on: November 26, 2005, 11:16:41 AM »

I upped a new version today that resolves the db not selected issue(I am also attaching here).  I am curious, way back in July I posted a new verison that fixed this craptastic SQL.  For any of you with sites that have private boards you will notice that guests get a topic listing of those private boards.  I don't know about everyone else, but for me and my site that is just unacceptable. 

With the method that Jabari posted I have some issues, because there is a convention that is used for many Joomla modules to access the database. 

database->setQuery("query")
result = $database->query()

This is how I modified the code.  The use of smf methods probably isn't a good idea since this is a Joomla module querying a Joomla db that just happens to have SMF installed in it.  Just my two cents.  I'd be happy to help anyone using the version with my modifications. 

Logged

Need help?  Check Here First!
Get the JSMF User Guide
SEARCH this forum.
Harry
Joomla Newbie
*

Karma: +0/-0
Offline Offline

Posts: 25



View Profile WWW
Re: recent topics module
« Reply #27 on: November 26, 2005, 12:32:35 PM »

Thanks,

This is working perfect!!
nice job.
Logged
kai920
Moderator
Joomla Expert
*****

Karma: +14/-2
Offline Offline

Posts: 275



View Profile
Re: recent topics module
« Reply #28 on: November 27, 2005, 11:30:44 AM »

working on my site now after 20 refreshes. no more dreaded error screen - great job wolverine!!!  Cool Cool Cool
Logged

Pages: 1 [2] Go Up Print 
« previous next »
Jump to:  



Login with username, password and session length

Powered by MySQL Powered by PHP Joomla Forum | Powered by SMF 1.1 RC1.
© 2001-2005, Lewis Media. All Rights Reserved.
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!

Joomla Hacks is a Joomla Components, Joomla Modules, Joomla Templates, & Joomla Mambots resource portal. None of the text or images in this public website may be copied without the expressed written consent of the authors. Copyright 2005 by JoomlaHacks.com. Powered by Joomla. All rights reserved.
Terms of Use
Joomla Hacks



Joomla Hacks
German Lang French Lang Italian Lang Spanish Lang Japanese Lang Chinese Lang
Search Contact About Advertise Blogs Topsites Submit News Register Login