[DISC] Improved pseudo sub-forums MOD 1.0.6

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.
Locked
Eefjuh
Registered User
Posts: 3
Joined: Thu Apr 21, 2005 5:21 pm

Post by Eefjuh »

Cyberpunk wrote: I agree with dextro, you could make it like an add-on and don't include that additional code in the main mod...
And again...this is a good mod anyway :wink:

Edited:
And...There is a little mistake in the above code

Code: Select all

$forum_data[$j]['post_username'] = $value['post_username']; 
It should be

Code: Select all

$forum_data[$j]['username'] = $value['username'];


I've inserted this mod to my index.php, then I saw that it made my forum look messy, I've erased it, and still the last topic shows on the index.

How can ik get this mod really out of my forum???
soulcreeper
Registered User
Posts: 28
Joined: Wed Apr 06, 2005 8:08 am
Location: Breda, NL
Contact:

Post by soulcreeper »

is there a chance that an image can be added to the left of the subforum name just like it happens on index.php?

and in the index.php page, is there an option to not only include the posts of the attached forum but also to place the name and date of the last poster in it?
I'm just good at being the best ®
Peter77s
Registered User
Posts: 260
Joined: Fri Sep 17, 2004 8:18 pm
Location: Michigan

Post by Peter77s »

$forum_data[$j]['post_username'] = $value['post_username'];

It should be
Code:
$forum_data[$j]['username'] = $value['username'];

I've inserted this mod to my index.php, then I saw that it made my forum look messy, I've erased it, and still the last topic shows on the index.


I got the same problem. instead of showing the subforum/s ALL my boards forums showed up. 8O
Peter77s
Registered User
Posts: 260
Joined: Fri Sep 17, 2004 8:18 pm
Location: Michigan

Post by Peter77s »

adiktd wrote: http://forums.adiktd.com/index.php

*EDIT*
ook i see... is there a way for the title of the last topic psted to show in that box too?


Hey adiktd, did you use this code?? I like the way you have it so that your last post in your subforums shows up. I tried using this code and it got messy!

Code: Select all

Code: 
                     if ($value['attached_forum_id']==$forum_id && $is_auth_ary[$sub_forum_id]['auth_view']) 
                     { 
 


add this: 

Code: 
                        if ($value['post_time']>$forum_data[$j]['post_time']) 
                        { 
                           $forum_data[$j]['user_id'] = $value['user_id']; 
                           $forum_data[$j]['post_username'] = $value['post_username']; 
                           $forum_data[$j]['forum_last_post_id'] = $value['forum_last_post_id']; 
                           $forum_data[$j]['post_time'] = $value['post_time']; 
$forum_data[$j]['username'] = $value['username']; 
}


SSorry about the double post, I was browsing the thread and forgot that I had already posted. unfortunately we are not allowed to delete our own posts!!!
Eefjuh
Registered User
Posts: 3
Joined: Thu Apr 21, 2005 5:21 pm

Post by Eefjuh »

I did use that one...
Peter77s
Registered User
Posts: 260
Joined: Fri Sep 17, 2004 8:18 pm
Location: Michigan

Post by Peter77s »

niekas wrote: for last post link on index.php (so it links to newest post in the forum and all subforums) - for dark warlord, adiktd, pug and others

after

Code: Select all

						   if ($value['attached_forum_id']==$forum_id && $is_auth_ary[$sub_forum_id]['auth_view'])
						   {
add this:

Code: Select all

								if ($value['post_time']>$forum_data[$j]['post_time'])
								{
									$forum_data[$j]['user_id'] = $value['user_id'];
									$forum_data[$j]['post_username'] = $value['post_username'];
									$forum_data[$j]['forum_last_post_id'] = $value['forum_last_post_id'];
									$forum_data[$j]['post_time'] = $value['post_time'];
$forum_data[$j]['username'] = $value['username'];
								}
cyberpunk wrote: Hi!
The last improvement that i want from this mod...
An indicator of new posts for attached forums in viewforum just like on index page for regular forums...
What the way to do it?


Its not as easy as in index.php page. It would require extra database querries - and i'm trying to avoid that.



nice! works perfectly with the yesterday/today MOD 8)
_PuG_
Registered User
Posts: 23
Joined: Fri Feb 21, 2003 12:17 pm

Post by _PuG_ »

The mod is working nice, good work. All that it needs now is for the option to show the last topic title posted in on the frontpage in the 'Last Post' Section :)

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

Post by niekas »

_PuG_ wrote: The mod is working nice, good work. All that it needs now is for the option to show the last topic title posted in on the frontpage in the 'Last Post' Section :)

Cheers!


I'll release it soon:

You can preview it here: www.freedomlist.com/forum/
adiktd
Registered User
Posts: 80
Joined: Tue Apr 12, 2005 2:12 pm
Location: Hampton, GA
Contact:

Post by adiktd »

*excited*
I'm no pro at any of this really but if I can help I will. :)

my board -> http://www.sofreshforums.com
my site -> http://www.adiktd.com
new biz -> http://www.girladspace.com

get a free blog -> http://www.dopetype.com
niekas
Registered User
Posts: 562
Joined: Sun Sep 23, 2001 7:34 am

Post by niekas »

adiktd,

I updated mod - it now displays last topic subject on index and subforums..
da_badtz_one
Registered User
Posts: 376
Joined: Thu Jan 29, 2004 8:25 pm

Post by da_badtz_one »

niekas wrote: adiktd,

I updated mod - it now displays last topic subject on index and subforums..


Is there a change log to update from 1.0.2 to 1.0.3?
niekas
Registered User
Posts: 562
Joined: Sun Sep 23, 2001 7:34 am

Post by niekas »

da_badtz_one wrote:
niekas wrote:adiktd,

I updated mod - it now displays last topic subject on index and subforums..


Is there a change log to update from 1.0.2 to 1.0.3?


these are changes from 1.0.2 to 1.0.3

Code: Select all


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

#
#-----[ 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";
#
#-----[ REPLACE WITH ]----------------------------------------
#

         $sql = "SELECT f.*, p.post_time, p.post_username,  u.username, u.user_id, t.topic_id, t.topic_title
            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 = f.forum_last_post_id)
            GROUP BY f.forum_id ORDER BY f.cat_id, f.forum_order";


#
#-----[ FIND ]------------------------------------------------
#
                     if ($value['attached_forum_id']==$forum_id && $is_auth_ary[$sub_forum_id]['auth_view'])
                     { 


#
#-----[ AFTER, ADD ]------------------------------------------
# 

                        //combining topic and post count for forum and subforums
                        $forum_data[$j]['forum_posts']=$forum_data[$j]['forum_posts']+$value['forum_posts'];
                        $forum_data[$j]['forum_topics']=$forum_data[$j]['forum_topics']+$value['forum_topics'];
                        //END combining topic and post count

                        //Last post link - check if any of subforums have newest posts and link to them instead
                           if ($value['post_time']>$forum_data[$j]['post_time'])
                           {
                              $forum_data[$j]['user_id'] = $value['user_id'];
                              $forum_data[$j]['post_username'] = $value['post_username'];
                              $forum_data[$j]['forum_last_post_id'] = $value['forum_last_post_id'];
                              $forum_data[$j]['post_time'] = $value['post_time'];
                              $forum_data[$j]['username'] = $value['username'];
                              $forum_data[$j]['topic_title'] = $value['topic_title'];
                           }
                        // END last post check

#
#-----[ FIND ]------------------------------------------------
#


                     if ( $forum_data[$j]['forum_last_post_id'] )
                     {
                        $last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);

                        $last_post = $last_post_time . '<br />';

                        $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> ';
                        
                        $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'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
                     }
                     else
                     {
                        $last_post = $lang['No_Posts'];
                     }

#
#-----[ REPLACE WITH ]----------------------------------------
#

                     if ( $forum_data[$j]['forum_last_post_id'] )
                     {
                        if (strlen($forum_data[$j]['topic_title'])>=35)
                        {
                           $forum_data[$j]['topic_title']=substr($forum_data[$j]['topic_title'],0,35). "...";
                        }

                        $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'] . '">'.$forum_data[$j]['topic_title'].' <img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';

                        $last_post .= '<br /> by ';
                        $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> ';
                        $last_post .= ' '.$last_post_time;                        
                     }
                     else
                     {
                        $last_post = $lang['No_Posts'];
                     }

#
#-----[ OPEN ]------------------------------------------------
#
   viewforum.php 
#
#-----[ FIND ]------------------------------------------------
#

		$sql2 = "SELECT f.*, p.post_time, p.post_username,p.poster_ip, u.user_level, 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 )
			WHERE attached_forum_id = " . $forum_id . "
			ORDER BY f.forum_order";

#
#-----[ REPLACE WITH ]----------------------------------------
#

		$sql2 = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id, t.topic_id, t.topic_title
			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 = f.forum_last_post_id)
			WHERE attached_forum_id = " . $forum_id . "
			GROUP by f.forum_id ORDER BY f.forum_order";


					$last_post_id = $value['forum_last_post_id'];

#
#-----[ FIND ]------------------------------------------------
#

					if ( $value['forum_last_post_id'] )
					{
						$last_post_time = create_date($board_config['default_dateformat'], $value['post_time'], $board_config['board_timezone']);

						$last_post = $last_post_time . '<br />';

						$last_post .= ( $value['user_id'] == ANONYMOUS ) ? ''.( ($value['post_username'] != '' ) ? $value['post_username'] . ' ' : $lang['Guest'] . ' ' ).'' : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $value['user_id']) . '" '. $style_color.'>' . $value['username'] . '</a> ';

						$last_post .= '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $value['forum_last_post_id']) . '#' . $value['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
					}
					else
					{
						$last_post = $lang['No_Posts'];
					}

#
#-----[ REPLACE WITH ]----------------------------------------
#
					if ( $value['forum_last_post_id'] )
					{

						if (strlen($value['topic_title'])>=35)
						{
							$value['topic_title']=substr($value['topic_title'],0,35). "...";
						}

						$last_post_time = create_date($board_config['default_dateformat'], $value['post_time'], $board_config['board_timezone']);
						$last_post = '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $value['forum_last_post_id']) . '#' . $value['forum_last_post_id'] . '">'.$value['topic_title'].' <img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';

						$last_post .= '<br /> by '; 
						$last_post .= ( $value['user_id'] == ANONYMOUS ) ? ( ($value['post_username'] != '' ) ? $value['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $value['user_id']) . '">' . $value['username'] . '</a> ';
						$last_post .= ' '.$last_post_time;								


					}
					else
					{
						$last_post = $lang['No_Posts'];
					}

Last edited by niekas on Mon Apr 25, 2005 1:26 pm, edited 1 time in total.
User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Airdrie, UK (127.0.0.1)
Name: Kenny Cameron
Contact:

Post by stickerboy »

neikas, slight problem with your update there.
if you have a look at my board and visit any one that has subforums, it doesn't show correctly.
last post in index is great btw though :)

clicky - attached forum
clicky - non-attached forum
I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red
niekas
Registered User
Posts: 562
Joined: Sun Sep 23, 2001 7:34 am

Post by niekas »

cherokee red wrote: neikas, slight problem with your update there.
if you have a look at my board and visit any one that has subforums, it doesn't show correctly.
last post in index is great btw though :)

clicky - attached forum
clicky - non-attached forum


It doesn't show at all :lol:

Can you save your viewforum.php as txt file and upload it to your server, so i can check it out.

I have no idea what is going on there..
User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Airdrie, UK (127.0.0.1)
Name: Kenny Cameron
Contact:

Post by stickerboy »

I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red
Locked

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