Seite 1 von 1

Beiträge eines Forums nicht als neue Beiträge anzeigen?

Verfasst: 12.11.2003 22:11
von baerenwurm
Kann man irgendwie verhindern, dass Beiträge eines bestimmten Forums unter "Beiträge seit dem letzten Besuch anzeigen" gelistet werden?

Verfasst: 12.11.2003 23:46
von PhilippK
Öffne die search.php, suche dort

Code: Alles auswählen

				if ( $userdata['session_logged_in'] )
				{
					$sql = "SELECT post_id 
						FROM " . POSTS_TABLE . " 
						WHERE post_time >= " . $userdata['user_lastvisit'];
				}
und ersetze es durch

Code: Alles auswählen

				if ( $userdata['session_logged_in'] )
				{
					$sql = "SELECT post_id 
						FROM " . POSTS_TABLE . " 
						WHERE post_time >= " . $userdata['user_lastvisit'] . " AND forum_id NOT IN (a, b)";
				}
Dort wo jetztsteht trägst du die IDs der betroffenen Foren (durch Komma getrennt) ein.

Gruß, Philipp

Verfasst: 13.11.2003 00:33
von baerenwurm
Vielen Dank, klappt einwandfrei :grin:

Verfasst: 13.11.2003 23:17
von baerenwurm
Geht das auch irgendwie beim "Latest Post" MOD?

Code: Alles auswählen

<?php



/**********************************************************************************

########################################################

## Mod Title:   Latest Post

## Mod Version: 0.1

## Author:      Matt Slovig < matthias@slovig.de >

## Credits:     Philip Mayer for the original phpBB 1.4x-Script I used

########################################################

**********************************************************************************/



define('IN_PHPBB', true); 

$phpbb_root_path = "./";

include($phpbb_root_path . 'extension.inc');

include($phpbb_root_path . 'common.'.$phpEx);



include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx);

include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_latest.' . $phpEx);



//

// Start session management

//

$userdata = session_pagestart($user_ip, PAGE_INDEX, $board_config['session_length']);

init_userprefs($userdata);

//

// End session management

//



include($phpbb_root_path . 'includes/page_header.'.$phpEx);



if (!isset($selorder)) $selorder = "las24";

if (!isset($nodays)) $nodays = 3;



$template->assign_vars(array(

	"L_TOPIC" => $lang['Topic'],

	"L_MATCHES" => $lang['matches'],



	"FORM_ACTION" => $PHP_SELF,

	"L_LAS24_MSG"   => $lang['last_24h'],

	"L_TODAY_MSG"   => $lang['today'],

	"L_YESTR_MSG"   => $lang['yesterday'],

	"L_LWEEK_MSG"   => $lang['last_week'],

	"L_LADAY_MSG"   => $lang['last_xdays'],



	"L_SHOW"        => $lang['show_posts'],

	"L_SHOWING"     => $lang['showing_posts'],

	"L_DAYS"        => $lang['day_posts'],

	"L_LAST"        => $lang['last_posts'],



	"NODAYS"      => $nodays,

	"PAGE_NAME" => $lang['latest_posts'],



	)

);



$template->set_filenames(array(

	"body" => "latest.tpl")

);



// SQLs:



$part1 = "

SELECT from_unixtime(p.post_time, '%d.%m.%y %H:%i:%s') as topic_time,

       f.forum_name as forum_name,

       f.forum_id as forum_id,

       u.username as username,

       p.poster_id as poster_id,

       p.post_id as post_id,

       t.topic_id as topic_id,

       t.topic_title as topic_title

FROM   ".TOPICS_TABLE." t,

       ".POSTS_TABLE." p

       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

WHERE  p.post_id = t.topic_last_post_id and f.auth_view!=2 and ";



$part2 = " ORDER BY p.post_time desc";



$showdays = 86400 * $nodays;



$lastweeksql  = $part1."UNIX_TIMESTAMP(NOW()) - p.post_time < 691200".$part2;

$yesterdaysql = $part1."FROM_UNIXTIME(p.post_time,'%Y%m%d') - FROM_UNIXTIME(unix_timestamp(NOW()),'%Y%m%d') = -1".$part2;

$todaysql     = $part1."FROM_UNIXTIME(p.post_time,'%Y%m%d') - FROM_UNIXTIME(unix_timestamp(NOW()),'%Y%m%d') = 0".$part2;



$last24hsql   = $part1."UNIX_TIMESTAMP(NOW()) - p.post_time < 86400".$part2;

$lastXdsql    = $part1."UNIX_TIMESTAMP(NOW()) - p.post_time < $showdays".$part2;



switch ($selorder) {



 case "las24" : $sql = $last24hsql; $template->assign_vars(array("MSG" => $lang['last_24h'])); break;

 case "today" : $sql = $todaysql; $template->assign_vars(array("MSG" => $lang['today'])); break;

 case "yestr" : $sql = $yesterdaysql; $template->assign_vars(array("MSG" => $lang['yesterday'])); break;

 case "lweek" : $sql = $lastweeksql; $template->assign_vars(array("MSG" => $lang['last_week'])); break;

 case "laday" : $sql = $lastXdsql; $template->assign_vars(array("MSG" => $lang['last_xdays1'].$nodays.$lang['last_xdays2'])); break;



}



$style = 0;



$result = $db->sql_query($sql)

					or message_die(GENERAL_ERROR, "Couldn't retrieve data", "", __LINE__, __FILE__, $sql);

while( $row = $db->sql_fetchrow($result) ) {

	$style++;

	(!($style% 2) ) ? $class = 'row2' : $class= 'row1';

		$template->assign_block_vars("posts", array(

		"TOPIC_TITLE" => $row["topic_title"],

		"TOPIC_TIME" => $row["topic_time"],

		"TOPIC_URL" => "viewtopic.".$phpEx."?p=".$row["post_id"]."#".$row["post_id"],

		"FORUM_NAME" => $row["forum_name"],

		"FORUM_URL" => "viewforum.".$phpEx."?f=".$row["forum_id"],

		"USERNAME" => $row["username"],

		"USER_URL" => "profile.".$phpEx."?mode=viewprofile&u=".$row["poster_id"],

		"POST_ID" => $row["post_id"],

		"FORUM_ID" => $row["forum_id"],

		"CLASS" => $class,

			)

		);

}



  // all data ready, displaying...



$template->pparse("body");



include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>

Verfasst: 13.11.2003 23:42
von PhilippK
Suche

Code: Alles auswählen

WHERE  p.post_id = t.topic_last_post_id and f.auth_view!=2 and "; 
und ersetze es durch

Code: Alles auswählen

WHERE t.forum_id NOT in (a, b) AND p.post_id = t.topic_last_post_id and f.auth_view!=2 and ";
Nicht getestet und daher ohne Gewähr.

Gruß, Philipp

Verfasst: 13.11.2003 23:51
von baerenwurm
Bringt leider folgenden Fehler, trotzdem danke:

Code: Alles auswählen

Couldn't retrieve data

DEBUG MODE

SQL Error : 1054 Unknown column 'a' in 'where clause'

SELECT from_unixtime(p.post_time, '%d.%m.%y %H:%i:%s') as topic_time, f.forum_name as forum_name, f.forum_id as forum_id, u.username as username, p.poster_id as poster_id, p.post_id as post_id, t.topic_id as topic_id, t.topic_title as topic_title FROM phpbb_topics t, phpbb_posts p 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 WHERE t.forum_id NOT in (a, b) AND p.post_id = t.topic_last_post_id and f.auth_view!=2 and UNIX_TIMESTAMP(NOW()) - p.post_time < 86400 ORDER BY p.post_time desc

Line : 201
File : /var/www/web134/html/forum/latest.php

Verfasst: 14.11.2003 00:09
von PhilippK
Natürlich solltest duauch wieder entsprechend ersetzen :-D

Gruß, Philipp

Verfasst: 14.11.2003 00:25
von baerenwurm
oh :oops:

Verfasst: 14.11.2003 00:30
von baerenwurm
Funktioniert wie immer perfekt :D