RegMod sortierung!

In diesem Forum können Mod-Autoren ihre Mods vorstellen, die sich noch im Entwicklungsstatus befinden. Der Einbau in Foren im produktiven Betrieb wird nicht empfohlen.
Forumsregeln
phpBB 2.0 hat das Ende seiner Lebenszeit überschritten
phpBB 2.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 2.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf phpBB 3.0, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
Antworten
Benutzeravatar
bgx
Mitglied
Beiträge: 228
Registriert: 30.11.2005 22:32
Kontaktdaten:

RegMod sortierung!

Beitrag von bgx »

Wie kann ich bei eingebautem Regmod die Registrieungstopics ganz normal sortieren lassen?

Im Moment stehen die Regtopics immer ganz oben egal wie alt sie sind?
Benutzeravatar
bgx
Mitglied
Beiträge: 228
Registriert: 30.11.2005 22:32
Kontaktdaten:

Beitrag von bgx »

hab's selber hinbekommen deshalb

<-CLOSED->
naptune
Mitglied
Beiträge: 141
Registriert: 28.02.2005 08:21
Wohnort: Regensburg
Kontaktdaten:

Beitrag von naptune »

könntest du mir mitteilen wie du das gemacht hast?

thx
Benutzeravatar
bgx
Mitglied
Beiträge: 228
Registriert: 30.11.2005 22:32
Kontaktdaten:

Beitrag von bgx »

Ich häng dir hier einfach mal den relevanten Teil meine viewforum.php dran.

Hab einfach noch eine SQL abfrage vornedran gehängt! Denke du kannst es dir dann sicher so umbauen wie du's brauchst. :grin:

Code: Alles auswählen

//
// All announcement data, this keeps announcements
// on each viewforum page ...
//
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username, t.topic_description, t.topic_picture
	FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . USERS_TABLE . " u2
	WHERE t.forum_id = $forum_id 
		AND t.topic_poster = u.user_id
		AND p.post_id = t.topic_last_post_id
		AND p.poster_id = u2.user_id
		AND t.topic_type = " . POST_ANNOUNCE . " 
	ORDER BY t.topic_last_post_id DESC ";
if ( !($result = $db->sql_query($sql)) )
{
   message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
}

$topic_rowset = array();
$total_announcements = 0;
//<!-- BEGIN Unread Post Information to Database Mod	-->
$result_an = $db->sql_query($sql);
if($userdata['upi2db_access']) 
{
	if($upi2db_config['edit_topic_first']) 
	{
		while( $row = $db->sql_fetchrow($result) )
		{                 
			if((in_array($row['topic_id'], $unread_edit_topics)) && !in_array($row['topic_id'], $always_read_topics))  
			{
				$edited_topic_id_annouc[$row['topic_id']] = $row['topic_id'];
				$topic_rowset[] = $row;
				$total_announcements++;
			}
		}

		$result = $db->sql_query($sql);
		while( $row = $db->sql_fetchrow($result) )
		{
			$edited_t_id_a = $edited_topic_id_annouc[$row['topic_id']];
			if($edited_t_id_a != $row['topic_id'] && !in_array($row['topic_id'], $always_read_topics))
			{	
				$topic_rowset[] = $row;
				$total_announcements++;
			}
		}
	}
	else
	{
		while( $row = $db->sql_fetchrow($result) )
		{
			$topic_rowset[] = $row;
			$total_announcements++;
		}
	}
}
else
{
	while( $row = $db->sql_fetchrow($result) )
	{
		$topic_rowset[] = $row;
		$total_announcements++;
	}
}
//<!-- END Unread Post Information to Database Mod	-->


$db->sql_freeresult($result);

//
// All sticky data, to keep it on top
// only on first page
//

if ($start == 0)
{
if ( $userdata['user_rank'] != "1" )
{
  $ignore_tarbed = " AND (t.topic_tarb = '0' OR (t.topic_poster = '" . $userdata['user_id'] . "'))";
}
if ($forum_row['forum_sort'] == "SORT_ALPHA") 
{
	$topic_order = "t.topic_picture DESC, t.topic_title ASC";
}
else
{
	$topic_order = "t.topic_last_post_id DESC";
}
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time, p2.post_edit_time 
	FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2
	WHERE t.forum_id = $forum_id
		AND t.topic_poster = u.user_id
		AND p.post_id = t.topic_first_post_id
		AND p2.post_id = t.topic_last_post_id
		AND u2.user_id = p2.poster_id 
		AND t.topic_type = " . POST_STICKY . " 
		$limit_topics_time
		$ignore_tarbed
	ORDER BY $topic_order 
	LIMIT $start, ".$board_config['topics_per_page'];
if ( !($result = $db->sql_query($sql)) )
{
   message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
}

$total_topics = 0;

//<!-- BEGIN Unread Post Information to Database Mod	-->
if($userdata['upi2db_access']) 
{
	if($upi2db_config['edit_topic_first']) 
	{

		// Sticky Edited
		while( $row = $db->sql_fetchrow($result) )
		{                 
			if((in_array($row['topic_id'], $unread_edit_topics)) && !in_array($row['topic_id'], $always_read_topics) && $row['topic_type'] == POST_STICKY)  
			{
				$edited_topic_id_sticky[$row['topic_id']] = $row['topic_id'];
				$topic_rowset[] = $row;
				$total_topics++;
			}
		}

		// Sticky Normal
		$result = $db->sql_query($sql);
		while( $row = $db->sql_fetchrow($result) )
		{
			$edited_t_id_s = $edited_topic_id_sticky[$row['topic_id']];
			if($row['topic_type'] == POST_STICKY && $edited_t_id_s != $row['topic_id'] && !in_array($row['topic_id'], $always_read_topics))
			{
				$topic_rowset[] = $row;
				$total_topics++;
			}
		}
	}
	else
	{
		$result = $db->sql_query($sql);
		while( $row = $db->sql_fetchrow($result) )
		{
			$topic_rowset[] = $row;
			$total_topics++;
	        }
	}
	while( $row = $db->sql_fetchrow($result_glob_an) )
	{
		if(in_array($row['topic_id'], $always_read_topics))
		{	
			$topic_rowset[] = $row;
			$total_topics++;
		}
	}
	
	while( $row = $db->sql_fetchrow($result_an) )
	{
		if(in_array($row['topic_id'], $always_read_topics))
		{	
			$topic_rowset[] = $row;
			$total_topics++;
		}
	}
	
	$result = $db->sql_query($sql);
	while( $row = $db->sql_fetchrow($result) )
	{
		if(in_array($row['topic_id'], $always_read_topics))
		{	
			$topic_rowset[] = $row;
			$total_topics++;
		}
	}
}
else
{
	while( $row = $db->sql_fetchrow($result) )
	{
		$topic_rowset[] = $row;
		$total_topics++;
	}
}
//<!-- END Unread Post Information to Database Mod	-->


$db->sql_freeresult($result);
}


//
// Grab all the basic data (all topics except announcements & stickys)
// for this forum
//
if ( $userdata['user_rank'] != "1" )
{
  $ignore_tarbed = " AND (t.topic_tarb = '0' OR (t.topic_poster = '" . $userdata['user_id'] . "'))";
}
if ($forum_row['forum_sort'] == "SORT_ALPHA") 
{
	$topic_order = "t.topic_picture DESC, t.topic_title ASC";
}
else
{
	$topic_order = "t.topic_last_post_id DESC";
}
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time, p2.post_edit_time 
	FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2
	WHERE t.forum_id = $forum_id
		AND t.topic_poster = u.user_id
		AND p.post_id = t.topic_first_post_id
		AND p2.post_id = t.topic_last_post_id
		AND u2.user_id = p2.poster_id 
		AND t.topic_type <> " . POST_ANNOUNCE . " 
		AND t.topic_type <> " . POST_STICKY . "
		$limit_topics_time
		$ignore_tarbed
	ORDER BY $topic_order 
	LIMIT $start, ".$board_config['topics_per_page'];
if ( !($result = $db->sql_query($sql)) )
{
   message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
}

//<!-- BEGIN Unread Post Information to Database Mod	-->
if($userdata['upi2db_access']) 
{
	if($upi2db_config['edit_topic_first']) 
	{

		// Sticky Edited
		while( $row = $db->sql_fetchrow($result) )
		{                 
			if((in_array($row['topic_id'], $unread_edit_topics)) && !in_array($row['topic_id'], $always_read_topics) && $row['topic_type'] == POST_STICKY)  
			{
				$edited_topic_id_sticky[$row['topic_id']] = $row['topic_id'];
				$topic_rowset[] = $row;
				$total_topics++;
			}
		}

		// Sticky Normal
		$result = $db->sql_query($sql);
		while( $row = $db->sql_fetchrow($result) )
		{
			$edited_t_id_s = $edited_topic_id_sticky[$row['topic_id']];
			if($row['topic_type'] == POST_STICKY && $edited_t_id_s != $row['topic_id'] && !in_array($row['topic_id'], $always_read_topics))
			{
				$topic_rowset[] = $row;
				$total_topics++;
			}
		}

		// Normal Edited

		$result = $db->sql_query($sql);
		while( $row = $db->sql_fetchrow($result) )
		{                 
			if((in_array($row['topic_id'], $unread_edit_topics)) && !in_array($row['topic_id'], $always_read_topics) && $row['topic_type'] != POST_STICKY)  
			{
				$edited_topic_id[$row['topic_id']] = $row['topic_id'];
				$topic_rowset[] = $row;
				$total_topics++;
			}
		}

		// Normal NORMAL

		$result = $db->sql_query($sql);
		while( $row = $db->sql_fetchrow($result) )
		{
			$edited_t_id_n = $edited_topic_id[$row['topic_id']];
			$edited_t_id_s = $edited_topic_id_sticky[$row['topic_id']];
			if($edited_t_id_n != $row['topic_id'] && $edited_t_id_n != $row['topic_id'] && !in_array($row['topic_id'], $always_read_topics) && $row['topic_type'] != POST_STICKY)
			{	
				$topic_rowset[] = $row;
				$total_topics++;
			}
		}
		
	}
	else
	{
		$result = $db->sql_query($sql);
		while( $row = $db->sql_fetchrow($result) )
		{
			$topic_rowset[] = $row;
			$total_topics++;
	        }
	}

	
	while( $row = $db->sql_fetchrow($result_glob_an) )
	{
		if(in_array($row['topic_id'], $always_read_topics))
		{	
			$topic_rowset[] = $row;
			$total_topics++;
		}
	}
	
	while( $row = $db->sql_fetchrow($result_an) )
	{
		if(in_array($row['topic_id'], $always_read_topics))
		{	
			$topic_rowset[] = $row;
			$total_topics++;
		}
	}
	
	$result = $db->sql_query($sql);
	while( $row = $db->sql_fetchrow($result) )
	{
		if(in_array($row['topic_id'], $always_read_topics))
		{	
			$topic_rowset[] = $row;
			$total_topics++;
		}
	}
}
else
{
	while( $row = $db->sql_fetchrow($result) )
	{
		$topic_rowset[] = $row;
		$total_topics++;
	}
}
//<!-- END Unread Post Information to Database Mod	-->


$db->sql_freeresult($result);

//
// Total topics ...
//
$total_topics += $total_announcements;
$dividers = get_dividers($topic_rowset);
Antworten

Zurück zu „phpBB 2.0: Mods in Entwicklung“