phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

Recent Topics (Extended)


 
Search this topic... | Search MOD Requests... | Search Box
Register or Login to Post    Index » MOD Requests  Previous TopicPrint TopicNext Topic
Author Message
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Thu Sep 16, 2010 10:03 am 
Post subject: Recent Topics (Extended)

Hi there,

I have installed the Mod Recent Topics (Extended):
http://www.phpbbhacks.com/download/1369

When calling recent.php I get:
Code:
could not obtain main information.

DEBUG MODE

SQL Error : 1054 Unknown column 't.topic_first_post_id' in 'on clause'

SELECT t.*, p.poster_id, p.post_username AS last_poster_name, p.post_id, p.post_time, f.forum_name, f.forum_id, u.username AS last_poster, u.user_id AS last_poster_id, u2.username AS first_poster, u2.user_id AS first_poster_id, p2.post_username AS first_poster_name FROM phpbb_topics t, phpbb_posts p LEFT OUTER JOIN phpbb_posts p2 ON p2.post_id = t.topic_first_post_id LEFT OUTER JOIN phpbb_forums f ON p.forum_id = f.forum_id LEFT OUTER JOIN phpbb_users u ON p.poster_id = u.user_id LEFT OUTER JOIN phpbb_users u2 ON u2.user_id = t.topic_poster WHERE t.forum_id NOT IN ('start') AND p.post_id = t.topic_last_post_id AND FROM_UNIXTIME(p.post_time,'%Y%m%d') - FROM_UNIXTIME(unix_timestamp(NOW()),'%Y%m%d') = 0 ORDER BY t.topic_last_post_id DESC LIMIT 0, 10

Line : 127
File : recent.php

and
Quote:
message_die() was called multiple times. This isn't supposed to happen. Was message_die() used in page_tail.php?

What went wrong?
The first one should be solved by changing the JOIN somehow?!

/Holger icon_redface.gif
Back to top
drathbun
Board Member



Joined: 24 Jul 2008

Posts: 653
Location: Texas


flag
PostPosted: Thu Sep 16, 2010 12:28 pm 
Post subject: Re: Recent Topics (Extended)

The SQL does not appear to be correct. Before I can suggest a fix, I need to know what the SQL (the MOD) is trying to accomplish.
_________________
phpBBDoctor Blog
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Thu Sep 16, 2010 12:33 pm 
Post subject: Re: Recent Topics (Extended)

Hi!

Line 127 ist the LAST one in this snippet:

Code:
$sql_start = "SELECT t.*, p.poster_id, p.post_username AS last_poster_name, p.post_id, p.post_time, f.forum_name, f.forum_id, u.username AS last_poster, u.user_id AS last_poster_id, u2.username AS first_poster, u2.user_id AS first_poster_id, p2.post_username AS first_poster_name
           FROM ". TOPICS_TABLE ." t, ". POSTS_TABLE ." p
      LEFT OUTER JOIN ". POSTS_TABLE ." p2 ON p2.post_id = t.topic_first_post_id
      LEFT OUTER JOIN ". FORUMS_TABLE ." f ON p.forum_id = f.forum_id
      LEFT OUTER JOIN ". USERS_TABLE ." u ON p.poster_id = u.user_id
      LEFT OUTER JOIN ". USERS_TABLE ." u2 ON u2.user_id = t.topic_poster
           WHERE $where_forums AND p.post_id = t.topic_last_post_id AND ";
$sql_end = "  ORDER BY t.topic_last_post_id DESC LIMIT $start, $topic_limit";

switch( $mode )
{
   case 'today':
      $sql = $sql_start ."FROM_UNIXTIME(p.post_time,'%Y%m%d') - FROM_UNIXTIME(unix_timestamp(NOW()),'%Y%m%d') = 0". $sql_end;
      $template->assign_vars(array('STATUS' => $lang['Recent_today']));
      $where_count = "$where_forums AND FROM_UNIXTIME(p.post_time,'%Y%m%d') - FROM_UNIXTIME(unix_timestamp(NOW()),'%Y%m%d') = 0";
      $l_mode = $lang['Recent_title_today'];
      break;

   case 'yesterday':
      $sql = $sql_start ."FROM_UNIXTIME(p.post_time,'%Y%m%d') - FROM_UNIXTIME(unix_timestamp(NOW()),'%Y%m%d') = -1". $sql_end;
      $template->assign_vars(array('STATUS' => $lang['Recent_yesterday']));
      $where_count = "$where_forums AND FROM_UNIXTIME(p.post_time,'%Y%m%d') - FROM_UNIXTIME(unix_timestamp(NOW()),'%Y%m%d') = -1";
      $l_mode = $lang['Recent_title_yesterday'];
      break;

   case 'last24':
      $sql   = $sql_start ."UNIX_TIMESTAMP(NOW()) - p.post_time < 86400". $sql_end;
      $template->assign_vars(array('STATUS' => $lang['Recent_last24']));
      $where_count = "$where_forums AND UNIX_TIMESTAMP(NOW()) - p.post_time < 86400";
      $l_mode = $lang['Recent_title_last24'];
      break;

   case 'lastweek':
      $sql  = $sql_start ."UNIX_TIMESTAMP(NOW()) - p.post_time < 691200". $sql_end;
      $template->assign_vars(array('STATUS' => $lang['Recent_lastweek']));
      $where_count = "$where_forums AND UNIX_TIMESTAMP(NOW()) - p.post_time < 691200";
      $l_mode = $lang['Recent_title_lastweek'];
      break;

   case 'lastXdays':
      $sql    = $sql_start ."UNIX_TIMESTAMP(NOW()) - p.post_time < 86400 * $amount_days". $sql_end;
      $template->assign_vars(array('STATUS' => sprintf($lang['Recent_lastXdays'], $amount_days)));
      $where_count = "$where_forums AND UNIX_TIMESTAMP(NOW()) - p.post_time < 86400 * $amount_days";
      $l_mode = sprintf($lang['Recent_title_lastXdays'], $amount_days);
      break;

   default:
      $message = $lang['Recent_wrong_mode'] .'<br /><br />'. sprintf($lang['Recent_click_return'], '<a href="'. append_sid("recent.$phpEx") .'">', '</a>') .'<br />'. sprintf($lang['Click_return_index'], '<a href="'. append_sid("index.$phpEx") .'">', '</a>');
      message_die(GENERAL_MESSAGE, $message);
      break;
}
if( !$result = $db->sql_query($sql) )
{
   message_die(GENERAL_ERROR, 'could not obtain main information.', '', __LINE__, __FILE__, $sql);
Back to top
StarWolf3000
Board Member



Joined: 10 Jun 2010

Posts: 83
Location: Stolpen, Saxony, Germany


flag
PostPosted: Fri Sep 17, 2010 8:21 am 
Post subject: Re: Recent Topics (Extended)

Try this (from phpbb.com):
Code:
#
#-----[ OPEN ]-------------------------------------

recent.php

#
#-----[ FIND ]----------------------------------------------------
#
FROM ". TOPICS_TABLE ." t, ". POSTS_TABLE ." p

#
#-----[ REPLACE WITH ]----------------------------------------------------
#
FROM (". TOPICS_TABLE ." t, ". POSTS_TABLE ." p)

#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
# EoM
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Fri Sep 17, 2010 9:00 am 
Post subject: Re: Recent Topics (Extended)

PERFECT! Thank you!
Back to top
Display posts from previous:   
Register or Login to Post    Index » MOD Requests  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0185 seconds using 15 queries. (SQL 0.0018 Parse 0.0005 Other 0.0161)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo