[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
adiktd
Registered User
Posts: 80
Joined: Tue Apr 12, 2005 2:12 pm
Location: Hampton, GA
Contact:

Post by adiktd »

I'm trying to mak ethe new changes but

Code: Select all

if ($attachments)
{

      //
      // Obtain a list of topic ids which contain
      // posts made since user last visited
      //
mine is diff...
http://forums.adiktd.com/viewforum.txt

help please. :)
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 »

addict,

i don't see

Code: Select all

      //
      // Obtain a list of topic ids which contain
      // posts made since user last visited
      //
in the code you posted.

adiktd
Registered User
Posts: 80
Joined: Tue Apr 12, 2005 2:12 pm
Location: Hampton, GA
Contact:

Post by adiktd »

yea... I was wondering if I had changed too much for this to work but nevermind, I got it!! :D
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

chesster
Registered User
Posts: 37
Joined: Tue Apr 05, 2005 3:25 am

Post by chesster »

niekas wrote:
chesster wrote:Hi ....


In which capacity is this mod not a "real" sub-forum?

Can I make a sub-forum (by this mod) private? used by only a selected usergroup?

Thanks.


The reason harishankar named it "pseudo" is because you can't attach forum to another subforum and you can't attach categories to other categories. The forum parent-child tree is only one level deep.

Code: Select all

forum
 |___ subforum1 (first level child)
          |____subforum2 (second level child) -- not possible yet

All standard phpBB permissions apply to subforums. If it's private it will be hidden to unauthorized groups or users.




Excellent.

I think this simple mod -- if efficient and bug-free -- would be useful to many. One level deep should be sufficient in many cases.

When will this mod be validated?

Thanks.

Aldri
Registered User
Posts: 11
Joined: Sat Apr 23, 2005 10:24 pm

Post by Aldri »

actually it is bug free (but a bit hard to install i think)
making it EM-compatible would help a lot :)

User avatar
Cronz
Registered User
Posts: 69
Joined: Mon Jan 10, 2005 2:06 am

Post by Cronz »

when was this code last updated??

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

Post by niekas »

Cronz wrote: when was this code last updated??


2005-04-26 - Version 1.0.4
making it EM-compatible would help a lot


I've never used EM. What is required for mod to be EM-compatible?
Chesster wrote: When will this mod be validated?


Dunno - it's not submitted to database yet although it's pretty much in final stage - it already has all features to emulate simple subforums (maybe improve admin page and add drop down box to select parent forum before submitting to mod database). It is efficient - it uses database only on viewforum and only if forum has subforums. On index it uses data from main phpBB query so it shouldn't slow down big boards at all.

User avatar
Merri
Registered User
Posts: 255
Joined: Mon Nov 25, 2002 1:08 pm
Location: Riihimäki, Finland
Contact:

Post by Merri »

Is the first post outdated? Because I installed what was in there, but it seems different from others... ( http://konnun.vihrealohikaarme.com/ ) I used EasyMod, there were two things that needed a change (you can't use IN-LINE FIND to FIND stuff from the next line, check admin_forums.php regarding VALUE line - there is also a weird bug with index.php, I had to do a change manually because I just couldn't get it to work right.

There is no way you can make something EasyMOD compatible, because there is no standard written to make something EasyMOD compatible. Instead you should say "could you make it work with EasyMOD?"

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

Post by niekas »

Merri wrote: Is the first post outdated? Because I installed what was in there, but it seems different from others... ( http://konnun.vihrealohikaarme.com/ ) I used EasyMod, there were two things that needed a change (you can't use IN-LINE FIND to FIND stuff from the next line, check admin_forums.php regarding VALUE line - there is also a weird bug with index.php, I had to do a change manually because I just couldn't get it to work right.

There is no way you can make something EasyMOD compatible, because there is no standard written to make something EasyMOD compatible. Instead you should say "could you make it work with EasyMOD?"


Looks OK (i guess you've already tweaked it) - only it seems you have double <BR /> before subforums on index.php.

The first post is not outdated - its the latest version of this mod. It is pretty straight forward installation by hand. I haven't worked on EasyMod compatibility yet (i'll try to install it later tonight).

User avatar
bonelifer
Community Team Member
Community Team Member
Posts: 3500
Joined: Wed Oct 27, 2004 11:35 pm
Name: William
Contact:

Post by bonelifer »

I managed to get it work with Easymod. It involved puting the edits to /index.php in the CORRECT order. The other correction was to where the "attached" forums where placed when using the original code with Easymod. I fixed by that by turning the FIND- AFTER, ADD, to a FIND, IN-LINE FIND, IN-LINE AFTER, ADD. It should of put the code for index_body.tpl before the closing span tag.


This one is after getting it to work with Easymod Initially-
Image

This one is after I fixed > templates/subSilver/index_body.tpl <
Image

This is with a second "attached" forum-
Image

Code: Select all

##############################################################
## MOD Title: Attached forums or pseudo sub-forums MOD
## MOD Author: harishankar < v_harishankar@yahoo.co.in > (Harishankar) http://literaryforums.org (improved and optimized by niekas)
## MOD Description: This mod allows you to "attach" specific forums to another so that they are not displayed on the main index page but inside another forum. This emulates the sub-forums features but does not really create true sub-forum functionality.
##
## MOD Version: 1.0.2 (beta)
##
## Installation Level: (Easy)
## Installation Time: 10 Minutes
## Files To Edit:    admin/admin_forums.php
##                  templates/subSilver/admin/forum_edit_body.tpl
##                  index.php
##                  templates/subSilver/index_body.tpl
##                  viewforum.php
##                  templates/subSilver/viewforum_body.tpl
##                  language/lang_english/lang_main.php
##                  language/lang_english/lang_admin.php
##               includes/functions.php
##
## Included Files: (n/a)
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
##      Test this MOD in a testing/isolated enviroment. Although
##      no obvious bugs have been found yet, this MOD *should*
##      work in a live environment as well
##
##############################################################
## MOD History:
##   2005-04-26 - Version 1.0.4
##      -Check new posts on children forums when viewing parent forum
##   
##   2005-04-24 - Version 1.0.3
##      -display latest topic subject on index and subforums
##      -combine parent forum and subforums post and topic count on index
##      -display subforum last post if subforum has newer post than a parent forum
##
##   2005-03-25 - Version 1.0.2
##      -Improved index generation - removed database querries inside the loop
##      -Added indicator for new subforum posts on index
##      -No database querries on viewforum.php if forum has no subforums
##      -Added last post link on subforums on viewforum.php
##
##   2004-12-11 - Version 1.0.1
##      - Alpha release :)
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ SQL ]-------------------------------------------------
#
#       If your phpbb table prefix is different, then change it to
#      reflect the correct one.
#
     ALTER TABLE phpbb_forums ADD attached_forum_id MEDIUMINT(8) DEFAULT '-1' NOT NULL;

#
#-----[ OPEN ]------------------------------------------------
#
   admin/admin_forums.php

#
#-----[ FIND ]------------------------------------------------
#
   $forumstatus = $row['forum_status'];
   
#
#-----[ AFTER, ADD ]------------------------------------------
#
   // Added by Harishankar's Attached Forums MOD
   $forum_attached_id = $row['attached_forum_id'];
   // End add

#
#-----[ FIND ]------------------------------------------------
#
   
   'S_PRUNE_ENABLED' => $prune_enabled,

#
#-----[ AFTER, ADD ]------------------------------------------
#
   // Added by Harishankar's Attached Forums MOD
   'S_ATTACHED_FORUM_ID' => $forum_attached_id,
   // End add
     
#
#-----[ FIND ]------------------------------------------------
#
   'L_CATEGORY' => $lang['Category'],

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

   // Added by Harishankar's Attached Forums MOD
   'L_ATTACHED_FORUM' => $lang['Attached_Field_Title'] ,
   'L_ATTACHED_DESC' => $lang['Attached_Description'],
   // End add

#
#-----[ FIND ]------------------------------------------------
#
   $sql = "INSERT INTO " . FORUMS_TABLE .

#
#-----[ IN-LINE FIND ]----------------------------------------
#
   cat_id,

#
#-----[ IN-LINE AFTER, ADD ]-----------------------------------
#     
   attached_forum_id,

#
#-----[ FIND ]------------------------------------------------
#
				VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "',

   
#
#-----[ IN-LINE FIND ]-----------------------------------------
#
   intval($HTTP_POST_VARS[POST_CAT_URL]) .

#
#-----[ IN-LINE AFTER, ADD ]-----------------------------------
#
   ", " . intval($HTTP_POST_VARS['attached_forum_id']) .

#
#-----[ FIND ]------------------------------------------------
#
   $sql = "UPDATE " . FORUMS_TABLE . "
      SET forum_name = '" .

#
#-----[ IN-LINE FIND ]----------------------------------------
#
   cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) .
   
#
#-----[ IN-LINE AFTER, ADD ]----------------------------------
#
   ", attached_forum_id = " . intval($HTTP_POST_VARS['attached_forum_id']) .

#
#-----[ OPEN ]------------------------------------------------
#
   templates/subSilver/admin/forum_edit_body.tpl

#-----[ FIND ]------------------------------------------------
   
   <tr>
     <td class="row1">{L_CATEGORY}</td>
     <td class="row2"><select name="c">{S_CAT_LIST}</select></td>
   </tr>

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

   <tr>
     <td class="row1">{L_ATTACHED_FORUM}</td>
     <td class="row2"><input type="text" name="attached_forum_id" value="{S_ATTACHED_FORUM_ID}" class="post" /><br />{L_ATTACHED_DESC}</td>
   </tr>

#
#-----[ 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 ]------------------------------------------------
#
   {
      $forum_data[] = $row;
   }
#
#-----[ AFTER, ADD ]------------------------------------------
#
   
   $attach=$forum_data;
   
#
#-----[ FIND ]------------------------------------------------
#
   $forum_id = $forum_data[$j]['forum_id'];

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


   $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'])
                     {
                        //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

                           $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">'. $lang['Attached_forum'] . ':'.$list_of_attached.'</span>';
                  }
                  else if ($a > 1)
                  {
                     $list_of_attached = '<span class="genmed">'. $lang['Attached_forums'] . ':'.$list_of_attached.'</span>';
                  }
                  else
                  {
                     $list_of_attached = '';
                  }



#
#-----[ FIND ]------------------------------------------------
#
									if ( !empty($new_topic_data[$forum_id]) )
									{
										$forum_last_post_time = 0;

										while( list($check_topic_id, $check_post_time) = @each($new_topic_data[$forum_id]) )
										{
											if ( empty($tracking_topics[$check_topic_id]) )
											{
												$unread_topics = true;
												$forum_last_post_time = max($check_post_time, $forum_last_post_time);

											}
											else
											{
												if ( $tracking_topics[$check_topic_id] < $check_post_time )
												{
													$unread_topics = true;
													$forum_last_post_time = max($check_post_time, $forum_last_post_time);
												}
											}
										}

										if ( !empty($tracking_forums[$forum_id]) )
										{
											if ( $tracking_forums[$forum_id] > $forum_last_post_time )
											{
												$unread_topics = false;
											}
										}

										if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
										{
											if ( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] > $forum_last_post_time )
											{
												$unread_topics = false;
											}
										}

									}


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

$unread_topics=check_unread($forum_id);


#
#-----[ 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'];
                     }


#
#-----[ FIND ]------------------------------------------------
#
   'LAST_POST' => $last_post,

#
#-----[ AFTER, ADD ]------------------------------------------
#
   'ATTACHED_FORUMS_LIST' => $list_of_attached,

#   
#-----[ FIND ]------------------------------------------------
#
     } // for ... categories

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



#
#-----[ OPEN ]------------------------------------------------
#
   /includes/functions.php


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

function get_db_stat($mode)
{


#
#-----[ BEFORE, ADD ]------------------------------------------
#

function check_unread($forum_id)
{
global $new_topic_data, $tracking_topics, $tracking_forums, $HTTP_COOKIE_VARS, $board_config;
   if ( !empty($new_topic_data[$forum_id]) )
   {
      $forum_last_post_time = 0;

      while( list($check_topic_id, $check_post_time) = @each($new_topic_data[$forum_id]) )
      {
         if ( empty($tracking_topics[$check_topic_id]) )
         {
            $unread_topics = true;
            $forum_last_post_time = max($check_post_time, $forum_last_post_time);

         }
         else
         {
            if ( $tracking_topics[$check_topic_id] < $check_post_time )
            {
               $unread_topics = true;
               $forum_last_post_time = max($check_post_time, $forum_last_post_time);
            }
         }
      }

      if ( !empty($tracking_forums[$forum_id]) )
      {
         if ( $tracking_forums[$forum_id] > $forum_last_post_time )
         {
            $unread_topics = false;
         }
      }

      if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
      {
         if ( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] > $forum_last_post_time )
         {
            $unread_topics = false;
         }
      }

   }

return $unread_topics;

}

#
#-----[ OPEN ]------------------------------------------------
#
   /templates/subSilver/index_body.tpl

#
#-----[ FIND ]------------------------------------------------
#
	  </span><span class="gensmall">{catrow.forumrow.L_MODERATOR} {catrow.forumrow.MODERATORS}</span></td>

#
#-----[ IN-LINE FIND ]------------------------------------------
#
</span>

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
<br />{catrow.forumrow.ATTACHED_FORUMS_LIST}

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

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

   $sql = "SELECT *
      FROM " . FORUMS_TABLE . "
      WHERE forum_id = $forum_id";
#
#-----[ REPLACE WITH ]----------------------------------------
#

   $sql = "SELECT *
      FROM " . FORUMS_TABLE . "
      WHERE forum_id = $forum_id OR attached_forum_id =$forum_id
      ORDER BY attached_forum_id ASC";

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


if ( !($forum_row = $db->sql_fetchrow($result)) )
{
   message_die(GENERAL_MESSAGE, 'Forum_not_exist');
}

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

$attachments='';
if ($db->sql_numrows ($result) > 1)
{
   $attachments=TRUE;
}

#
#-----[ FIND ]------------------------------------------------
#
   //
   // Okay, lets dump out the page ...
   //

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

if ($attachments)
{

      //
      // Obtain a list of topic ids which contain
      // posts made since user last visited
      //
      if ( $userdata['session_logged_in'] )
      {
         $sql = "SELECT t.forum_id, t.topic_id, p.post_time
            FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
            WHERE p.post_id = t.topic_last_post_id
               AND p.post_time > " . $userdata['user_lastvisit'] . "
               AND t.topic_moved_id = 0";
         if ( !($result = $db->sql_query($sql)) )
         {
            message_die(GENERAL_ERROR, 'Could not query new topic information', '', __LINE__, __FILE__, $sql);
         }

         $new_topic_data = array();
         while( $topic_data = $db->sql_fetchrow($result) )
         {
            $new_topic_data[$topic_data['forum_id']][$topic_data['topic_id']] = $topic_data['post_time'];
         }
      }

      $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";

      $result2 = $db->sql_query ($sql2);
      if (!$result2 )
      {
         message_die ('Could not gather attached forum info', __LINE__, __FILE__, $sql2);
      }

      if ($db->sql_numrows ($result2) != 0)
      {
         while( $row = $db->sql_fetchrow($result2) )
         {
            $forum_data[] = $row;
         }
         $is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_data);

         $x=0;
         foreach ($forum_data as $row2 => $value)
         {
            if ($is_auth_ary[$value['forum_id']]['auth_view'])
            {
               $x++;
               if ($x==1)
               {
                  $template->assign_block_vars ('switch_attached_list',
                           array( 'L_ATTACHED_FORUM' => $lang['Attached_forums'],
                               'L_ATTACHED_TOPICS' => $lang['Topics'],
                               'L_ATTACHED_POSTS' => $lang['Posts'],
                               'L_LAST_POST'=>$lang['Last_Post']
                              )
                           );

               }
               $attach_forum_name = '<a href="' . append_sid('viewforum.php?f=' . $value['forum_id']) . '">' . $value['forum_name'] . '</a>' ;
               $attach_forum_desc = '<br />' . $value['forum_desc'];
               $attach_forum_topics = $value['forum_topics'];
               $attach_forum_posts = $value['forum_posts'];
               $last_post_id = $value['forum_last_post_id'];

                  if ( $value['forum_status'] == FORUM_LOCKED )
               {
                  $folder_image = $images['forum_locked'];
                  $folder_alt = $lang['Forum_locked'];
               }
               else
               {
                  $unread_topics = false;
                  if ( $userdata['session_logged_in'] )
                  {
                     $unread_topics=check_unread($value['forum_id']);
                  }

                  $folder_image = ( $unread_topics ) ? $images['forum_new'] : $images['forum'];
                  $folder_alt = ( $unread_topics ) ? $lang['New_posts'] : $lang['No_new_posts'];
               }

               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'];
               }

$template->assign_block_vars ('switch_attached_list.switch_attached_present',
                               array
                               (
                              'FORUM_FOLDER_IMG' => $folder_image,
                              'L_FORUM_FOLDER_ALT' => $folder_alt,
                               'FORUM_NAME' => "&nbsp; $attach_forum_name",
                               'FORUM_DESC' => $attach_forum_desc,
                               'TOPICS' => $attach_forum_topics,
                               'POSTS' => $attach_forum_posts,
                               'LAST_POST_ID' => $last_post,
                               ));
            }
      }

   }
      $db->sql_freeresult ($result2);
}

#
#-----[ OPEN ]------------------------------------------------
#
   /templates/subSilver/viewforum_body.tpl

#
#-----[ FIND ]------------------------------------------------
#
   <table border="0" cellpadding="4" cellspacing="1" width="100%" class="forumline">

#
#-----[ BEFORE, ADD ]-----------------------------------------
#
   
<!-- BEGIN switch_attached_list -->
   <br />
   <table width="100%" border="0" cellpadding="4" cellspacing="1" width="100%" class="forumline">
     <tr>
      <th colspan="2" class="thCornerL" height="15" nowrap="nowrap">&nbsp;{switch_attached_list.L_ATTACHED_FORUM}&nbsp;</th>
      <th width="50" class="thTop" nowrap="nowrap">&nbsp;{switch_attached_list.L_ATTACHED_TOPICS}&nbsp;</th>
      <th width="50" class="thTop" nowrap="nowrap">&nbsp;{switch_attached_list.L_ATTACHED_POSTS}&nbsp;</th>
      <th width="50" class="thTop" nowrap="nowrap">&nbsp;{switch_attached_list.L_LAST_POST}&nbsp;</th>
     </tr>
   <!-- BEGIN switch_attached_present -->
   <tr>
      <td class="row1" align="center" valign="middle" height="38"><img src="{switch_attached_list.switch_attached_present.FORUM_FOLDER_IMG}" width="46" height="25" alt="{switch_attached_list.switch_attached_present.L_FORUM_FOLDER_ALT}" title="{switch_attached_list.switch_attached_present.L_FORUM_FOLDER_ALT}" /></td>
      <td class="row1" width="75%"><span class="forumlink">{switch_attached_list.switch_attached_present.FORUM_NAME}</span><span class="genmed">{switch_attached_list.switch_attached_present.FORUM_DESC}</span></td>
      <td class="row2" align="center" valign="middle"><span class="gensmall">{switch_attached_list.switch_attached_present.TOPICS}</span></td>
      <td class="row2" align="center" valign="middle"><span class="gensmall">{switch_attached_list.switch_attached_present.POSTS}</span></td>
      <td class="row2" align="center" nowrap="nowrap" valign="middle"><span class="gensmall">{switch_attached_list.switch_attached_present.LAST_POST_ID}</span></td>
   </tr>
   <!-- END switch_attached_present -->
   </table>
   <br />
<!-- END switch_attached_list -->

#
#-----[ OPEN ]------------------------------------------------
#
     language/lang_english/lang_admin.php
   
#
#-----[ FIND ]------------------------------------------------
#
   //
   // That's all Folks!

#
#-----[ BEFORE, ADD ]-----------------------------------------
#
   // Added by Harishankar's Attached Forums MOD
   $lang['Attached_Field_Title'] = 'Attached to forum';
   $lang['Attached_Description'] = "This field has been added by Harishankar's attached forums mod. If you wish this forum to be a pseudo sub-forum or attached to another forum, then enter the id of the forum you wish to attach it to. For regular (normal) forums, leave this value as -1";
   // End Add
   
#
#-----[ OPEN ]------------------------------------------------
#
    language/lang_english/lang_main.php
   
#
#-----[ FIND ]------------------------------------------------
#
   //
   // That's all, Folks!

#
#-----[ BEFORE, ADD ]-----------------------------------------
#

   // Added by Harishankar's Attached Forums MOD

   $lang['Attached_forum'] = 'Attached Forum';
   $lang['Attached_forums'] = 'Attached Forums';
   
   // End Add

#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
# EoM
Last edited by bonelifer on Thu Apr 28, 2005 11:04 pm, edited 2 times in total.

User avatar
bonelifer
Community Team Member
Community Team Member
Posts: 3500
Joined: Wed Oct 27, 2004 11:35 pm
Name: William
Contact:

Post by bonelifer »

I've tried removing the extra space but couldn't. The extra space is caused when there are no MODERATORS for a forum which has an attach forum. The extra space is caused by the line break in this line:

Code: Select all

<span class="genmed">{catrow.forumrow.FORUM_DESC}<br />
Unfortunately I can't think of a way to fix it. I tried removing the one in the attachforums line but that puts it in the right place but with two or three extra spaces to the left. If you remove the LINE BREAK from that above code then if there are moderators the Moderators line will be on the same line as the forum description line.

User avatar
Merri
Registered User
Posts: 255
Joined: Mon Nov 25, 2002 1:08 pm
Location: Riihimäki, Finland
Contact:

Post by Merri »

Well, you could add a new switch via PHP to check if there are any moderators for the particular forum and then add this switch to the template.

chesster
Registered User
Posts: 37
Joined: Tue Apr 05, 2005 3:25 am

Post by chesster »

## 2005-04-26 - Version 1.0.4
## -Check new posts on children forums when viewing parent forum


I have a question about thi statement.

(1) Does this mean that when a user is viewing the parent forum, the "golden bell" of the sub-forum will show if the child forum has a new post?

(2) Does this mean that on the index page, the "golden bell" of the parent forum will show if the child forum has a new post, regardless of whether the parent has a new post or not?

Thanks.

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

Post by niekas »

bonelifer wrote: I've tried removing the extra space but couldn't. The extra space is caused when there are no MODERATORS for a forum which has an attach forum. The extra space is caused by the line break in this line:

Code: Select all

<span class="genmed">{catrow.forumrow.FORUM_DESC}<br />
Unfortunately I can't think of a way to fix it. I tried removing the one in the attachforums line but that puts it in the right place but with two or three extra spaces to the left. If you remove the LINE BREAK from that above code then if there are moderators the Moderators line will be on the same line as the forum description line.


I solved this by

Code: Select all

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


								$l_moderators = '&nbsp;';
								$moderator_list = '&nbsp;';

#
#-----[ REPLACE ]----------------------------------------
#
   // Modified by Attached Forums MOD

								$l_moderators = '';
								$moderator_list = '';
   // END Modified by Attached Forums MOD
and

in index.php

after

Code: Select all

							$list_of_attached = '';
						}
adding this:

Code: Select all

						if ( count($forum_moderators[$forum_id]) > 0 && $list_of_attached)
						{
							$list_of_attached = '<br>'.$list_of_attached;

						}

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

Post by niekas »

chesster wrote:
## 2005-04-26 - Version 1.0.4
## -Check new posts on children forums when viewing parent forum


I have a question about thi statement.

(1) Does this mean that when a user is viewing the parent forum, the "golden bell" of the sub-forum will show if the child forum has a new post?

(2) Does this mean that on the index page, the "golden bell" of the parent forum will show if the child forum has a new post, regardless of whether the parent has a new post or not?

Thanks.


1) Yes
2) No - on index children forums have their own little icon to indicate new posts.

Locked

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