[ALPHA] Attached forums or pseudo sub-forums mod 1.0.0

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
bcs10
Registered User
Posts: 1525
Joined: Mon Jul 14, 2003 4:45 am
Location: Chicago, IL

Post by bcs10 »

after using this and Categories Hierarchy I personally like the functionallity of Categories Hierarchy more
/DD

theanimewizard
Registered User
Posts: 646
Joined: Tue Jul 08, 2003 9:24 pm
Contact:

Post by theanimewizard »

bcs10 wrote: after using this and Categories Hierarchy I personally like the functionallity of Categories Hierarchy more


but that has a lot of codes to change. this one is really simple. =D

Virtual4Ever
Registered User
Posts: 6
Joined: Thu Jan 27, 2005 5:19 pm
Location: Petrosani, Romania
Contact:

Post by Virtual4Ever »

After a bit of work to install it the MOD works fine, just what I was looking for, thank you.

Naima
Registered User
Posts: 12
Joined: Sun Jan 30, 2005 12:22 am

Thanks

Post by Naima »

I sought a simple alternative to another MOD a long time, thanks a lot for this harishankar :D
ImageImageNaima

dextro
Registered User
Posts: 54
Joined: Mon Feb 16, 2004 9:41 am

Post by dextro »

just one thing? Is there anyway to make the sum of the posts be equal to the posts in the forum and it's attached forums? Because when looking at the Index I see some foruns that have 4 or 5 posts and then the foruns attached to it have 10 or 15 (hipotetical). It looks wierd to the user in particular if you use a locked forum to create a pseudo sub-category :?
Stat(ing) My Mind... - O que penso sem restrições...

User avatar
End of a Shadow
Registered User
Posts: 1557
Joined: Sun Apr 27, 2003 6:39 pm
Location: Washington
Name: J G
Contact:

Post by End of a Shadow »

Deleted
Last edited by End of a Shadow on Tue Apr 12, 2005 6:25 am, edited 1 time in total.

DKing
Registered User
Posts: 751
Joined: Sat Jul 03, 2004 8:38 pm

Post by DKing »

I had a problem with it... it wouldn't update right in the ACP... it assigned it to forum #1, so it was a sub for my announcements forum, when I wanted it to be a regular forum. *rolls eyes* :roll: SO I uninstalled it an am waiting to seee another update. Also, if I can get categories hierarchy to install correctly, I'll go with it, because, as said before, it has more functionality and takes a minute for the edits in easymod.
-DKing
Latest phpBB Version: 2.0.21
Search For a MOD: MOD Search

_PuG_
Registered User
Posts: 23
Joined: Fri Feb 21, 2003 12:17 pm

Post by _PuG_ »

Brilliant, just what I was looking for. I prefer it to the other main subforum mod simply because it requires alot less adjustments, and does not make so many changes :)

Only problem, on my forum index page, the headings look like this:

�Forum� �Topics� �Posts� �Last Post�

What would cause it?

Cheers!

_PuG_
Registered User
Posts: 23
Joined: Fri Feb 21, 2003 12:17 pm

Post by _PuG_ »

Also does anyone know how to get the Last Post area on the frontpage to display last posts from sub forums?


User avatar
End of a Shadow
Registered User
Posts: 1557
Joined: Sun Apr 27, 2003 6:39 pm
Location: Washington
Name: J G
Contact:

Post by End of a Shadow »

Code: Select all


   $attached_id = $forum_data[$j]['attached_forum_id'];

						if ( $is_auth_ary[$forum_id]['auth_view'] && $attached_id == -1 )
						{

						$url_row2='';
						$list_of_attached='';
						$a=0;
						foreach ($attach as $key => $value) {
							$sub_forum_id=	$value['forum_id'];
						   if ($value['attached_forum_id']==$forum_id && $is_auth_ary[$sub_forum_id]['auth_view'])
						   {
									$unread_topics = false;
									if ( $userdata['session_logged_in'] )
									{
										if (check_unread($value['forum_id']))
										{
											$url_row2 = '&nbsp;<img src="' . $images['icon_minipost_new'] . '" border="0" alt="' . $lang['New_posts'] . '" title="' . $lang['New_posts'] . '" />';
										}
										else
										{
											$url_row2 = '&nbsp;<img src="' . $images['icon_minipost'] . '" border="0" alt="' . $lang['No_new_posts'] . '" title="' . $lang['No_new_posts'] . '" />';

										}
									}
									else
									{
											$url_row2 = '&nbsp;<img src="' . $images['icon_minipost'] . '" border="0" alt="' . $lang['No_new_posts'] . '" title="' . $lang['No_new_posts'] . '" />';
									}

									$url_row2 .= '<a href="' . append_sid ('viewforum.php?f=' . $value['forum_id'] ) . '">' . $value['forum_name'] . '</a>' ;
									$list_of_attached = $list_of_attached . $url_row2 ;
									$a++;

						   }
						}
						if ($a == 1)
						{
							$list_of_attached = '<span class="genmed">&nbsp;'. $lang['Attached_forum'] . ':'.$list_of_attached.'</span>';
						}
						else if ($a > 1)
						{
							$list_of_attached = '<span class="genmed">&nbsp;'. $lang['Attached_forums'] . ':'.$list_of_attached.'</span>';
						}
						else
						{
							$list_of_attached = '';
						}
INLINE

Code: Select all

foreach ($attach as $key => $value)
I'm having quite a few problems with this argument using the "Last Post On Index Mod"
Warning: Invalid argument supplied for foreach() in ...\phpBB\index.php on line 405

Warning: Invalid argument supplied for foreach() in ...\phpBB\index.php on line 405


Here's the mod:

Code: Select all

##############################################################
## Mod Title:   Last post topic on index
## Original Mod Title: shows topic of last made post on index
## Mod Version: 1.0.0
## Author:		MandersOnline <mods@mandersonline.nl>
##			http://www.mandersonline.nl/mods
## Author Original:	e-sven <sven@e-sven.net> 
##			http://www.e-sven.net
##############################################################

#
#-----[ OPEN ]------------------------------------------------
#
index.php

#
#-----[ ACTION Find ]-----------------------------------------
#
			$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id
				FROM (( " . FORUMS_TABLE . " f
				LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id )
				LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id )
				ORDER BY f.cat_id, f.forum_order";
			break;
	}
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql);
	}

	$forum_data = array();
	while( $row = $db->sql_fetchrow($result) )
	{
		$forum_data[] = $row;
	}
	$db->sql_freeresult($result);

	if ( !($total_forums = count($forum_data)) )
	{
		message_die(GENERAL_MESSAGE, $lang['No_forums']);
	}

	//
	// Obtain a list of topic ids which contain

#
#-----[ REPLACE WITH ]----------------------------------------
#
 		$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id, t.topic_title, t.topic_last_post_id " .
			" FROM ((( " . FORUMS_TABLE . " f " .
			" LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id )" .
			" LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id ) " .
			" LEFT JOIN " . TOPICS_TABLE . " t ON t.topic_last_post_id = p.post_id ) " .
			" ORDER BY f.cat_id, f.forum_order";
		break;
	}
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql);
	}

	$forum_data = array();
	$topic_last_ary = array();
	$i=0;
	while( $row = $db->sql_fetchrow($result) )
	{
		if (!in_array($row['topic_last_post_id'], $topic_last_ary) || $row['topic_last_post_id']==0) {
			$topic_last_ary[i]=$row['topic_last_post_id'];
			$i++;
			$forum_data[] = $row;
		}
	}
	unset($topic_last_ary);
	if ( !($total_forums = count($forum_data)) )
	{
		message_die(GENERAL_MESSAGE, $lang['No_forums']);
	}
	
	//
	// Filter topic_title not allowed to read
	// 
	if ( !($userdata['user_level'] == ADMIN && $userdata['session_logged_in']) ) {
		$auth_read_all = array();
		$auth_read_all=auth(AUTH_READ, AUTH_LIST_ALL, $userdata, $forum_data);
		$auth_data = '';
		for($i=0; $i<count($forum_data); $i++)
		{
			if (!$auth_read_all[$forum_data[$i]['forum_id']]['auth_read']) {
				$forum_data[$i]['topic_title']='';
			}
		}
	}

	//
	// Define censored word matches
	//
	$orig_word = array();
	$replacement_word = array();
	obtain_word_list($orig_word, $replacement_word);

	//
	// Obtain a list of topic ids which contain


#
#-----[ ACTION Find ]-----------------------------------------
#
	if ( $forum_data[$j]['forum_last_post_id'] )
	{
	...
	}


#
#-----[ ACTION Replace With ]---------------------------------
#
	if ( $forum_data[$j]['forum_last_post_id'] )
	{
		$topic_title = $forum_data[$j]['topic_title'];
		$topic_title2 = $forum_data[$j]['topic_title'];
		
		//
		// Censor topic title
		//
		if ( count($orig_word) )
		{
			$topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
			$topic_title2 = preg_replace($orig_word, $replacement_word, $topic_title2);
		}
										
		if (strlen($topic_title)>27) {
			$topic_title = substr($topic_title,0,24) . '...';
		}

		$last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);
		$last_post = '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '" title="' . $topic_title2 . '">' . $topic_title . '</a><br>';
		$last_post .= $last_post_time . '&nbsp;<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '"></a><br>' . $lang['by'] . '&nbsp;';
		$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> ';
	}

#
#-----[ SAVE/CLOSE ALL FILES ]----------------------------------
#
Before I switched to your version, I used the original mod provided by harishankar and didn't have a problem. Anyway to make your version compadible with Last Post On Index Mod?

_PuG_
Registered User
Posts: 23
Joined: Fri Feb 21, 2003 12:17 pm

Post by _PuG_ »

Hi, best if you post in the new mod topic :)

http://www.phpbb.com/phpBB/viewtopic.ph ... sc&start=0

Cheers!

User avatar
TraXy
Registered User
Posts: 43
Joined: Sat Feb 12, 2005 11:46 pm
Location: Nottingham
Contact:

Post by TraXy »

<deleted>
Last edited by TraXy on Wed Aug 17, 2005 11:15 pm, edited 2 times in total.

niekas
Registered User
Posts: 562
Joined: Sun Sep 23, 2001 7:34 am

Post by niekas »

selfdelete

Alighieri
Registered User
Posts: 135
Joined: Sun Mar 13, 2005 5:24 pm

Post by Alighieri »

Hrm, I have multiple subforums within subforums, simple done by directly editing the SQL DB. How would I make it so each subsubsubforum updates all of it's parents? And displays the correcty hierarchy, having a subforum on viewforum.php display the subforums under it, as well?

Post Reply

Return to “[2.0.x] MODs in Development”