[2.0.19] Forum Icon with ACP Control

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.

Rating:

Excellent!
36
60%
Very Good
14
23%
Good
6
10%
Fair
2
3%
Poor
2
3%
 
Total votes: 60

User avatar
SoLoGHoST
Registered User
Posts: 58
Joined: Wed Oct 19, 2005 4:03 am
Contact:

Okay Got it working...AWESOMELY!

Post by SoLoGHoST »

Okay, just thought I'd let you know that I got this to work and added a cooler interface in the Admin (namely: admin/forum_edit_body.tpl) Forum Management files. My MOD update for this also supports Locked Forums (it will just simply use the first/oldPosts image if the forum is locked)

This is without a doubt one of the BEST MODS NOW!! I would like to post it up on here, if that would be fine with you?

Thanks, and let me know, k?
SoLoGHoST

ycl6
Translator
Posts: 5696
Joined: Sat Feb 15, 2003 10:35 am
Location: Taiwan
Contact:

Re: Okay Got it working...AWESOMELY!

Post by ycl6 »

SoLoGHoST wrote: This is without a doubt one of the BEST MODS NOW!! I would like to post it up on here, if that would be fine with you?

Thanks, and let me know, k?
SoLoGHoST

Hi SoLoGHoST,

Can you post a screenshot?

You may post it here, or submit for validation for this add-on or let me include the changes in my package (as an add-on). I'll provide support for the changes you've made.

~Mac

User avatar
SoLoGHoST
Registered User
Posts: 58
Joined: Wed Oct 19, 2005 4:03 am
Contact:

Screenshots of the MOD in the Admin Panels

Post by SoLoGHoST »

Ok, here are 3 screenshots of what was changed in the Admin sections...

In Configuration Settings, added another textbox for New Post Pics:

Image

In the template/subSilver/admin/forum_edit_body.tpl:
Image

In the Forum Management Options:

Image

I can post up all of the code changes/additions that were made if you'd like me to

P.S. - Also made each image a link to that Forum and so forth. Only the New Posts Image is displayed on the index (It doesn't get displayed when you are viewing posts in that forum or topics in that forum, the original/no posts image get's displayed in viewtopic and viewforum. All of the real coding is placed in the index.php file. The only thing I could think about that could make this mod any better is the option to go back to the original folder images, for instance $folder_image = (unread_topics) ? $images[folder_new] : $images[folder]; which could easily be done in the configuration (perhaps a radio button) and check to use original images, or changed images. The coolest thing about this code is that you can have a Read/Unread icon that is different for each forum. And ofcourse, If you don't want any icons to represent the forum, put in a blank icon. The only reason the last image above has a gray background is because I am using a different style on my forums, and it's background is gray and well, don't like what it looks like as .gif

Thanks,
SoLoGHoST

User avatar
SoLoGHoST
Registered User
Posts: 58
Joined: Wed Oct 19, 2005 4:03 am
Contact:

Forum Icon Listbox MOD updated for New/Locked Posts...

Post by SoLoGHoST »

Okay, here is the total package. This assumes that you have NOT installed the Forum Icon MOD on this topics first page.
You can add it to your package, however, would like to have credit for this somehow, perhaps my username (SoLoGHoST) and a link to my site's messageboard at: http://www.acroaddicts.com/phpBB would be sufficient? And, ofcourse, u can always change whatever design/code you don't agree with.

Code: Select all

# 
#-----[ SQL ]------------------------------------------ 
#
# Remember to change the table prefix used on your database
ALTER TABLE `phpbb_forums` ADD `forum_icon` VARCHAR( 255 ) default NULL;
ALTER TABLE `phpbb_forums` ADD `forum_icon_new` VARCHAR( 255 ) default NULL;
INSERT INTO `phpbb_config` VALUES ('forum_icon_path', '');
INSERT INTO `phpbb_config` VALUES ('forum_icon_new_path', '');
language/lang_english/lang_admin.php

Code: Select all

# 
#-----[ FIND ]------------------------------------------ 
#
$lang['Forum_status'] = 'Forum status';

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
$lang['Forum_icon'] = 'Forum Icon (No New Posts)'; // Forum Icon MOD 
$lang['Forum_icon_new'] = 'Forum Icon (New Posts)'; 
$lang['Forum_icon_path'] = 'Forum Icon Storage Path (no new posts)'; 
$lang['Forum_icon_new_path'] = 'Forum Icon Storage Path (new posts)'; 
$lang['Forum_icon_path_explain'] = 'Path under your phpBB root dir, e.g. images/forum/icons/default'; 
$lang['Forum_icon_new_path_explain'] = 'Path under your phpBB root dir, e.g. images/forum/icons/new'; // Forum Icon MOD 
admin/admin_board.php

Code: Select all

# 
#-----[ FIND ]------------------------------------------ 
#
	"L_AVATAR_GALLERY_PATH_EXPLAIN" => $lang['Avatar_gallery_path_explain'],

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	"L_FORUM_ICON_PATH" => $lang['Forum_icon_path'], // Forum Icon MOD 
	"L_FORUM_ICON_PATH_EXPLAIN" => $lang['Forum_icon_path_explain'], 
	"L_FORUM_ICON_NEW_PATH" => $lang['Forum_icon_new_path'], 
	"L_FORUM_ICON_NEW_PATH_EXPLAIN" => $lang['Forum_icon_new_path_explain'], //Forum Icon MOD 

# 
#-----[ FIND ]------------------------------------------ 
#
	"AVATAR_GALLERY_PATH" => $new['avatar_gallery_path'],

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	"FORUM_ICON_PATH" => $new['forum_icon_path'], // Forum Icon MOD 
	"FORUM_ICON_NEW_PATH" => $new['forum_icon_new_path'], // Forum Icon MOD 
admin/admin_forums.php

Code: Select all

# 
#-----[ FIND ]------------------------------------------ 
# 
			if ($mode == 'editforum')
			{
				// $newmode determines if we are going to INSERT or UPDATE after posting?

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
#
         // Forum Icon MOD 
         $dir = @opendir($phpbb_root_path . $board_config['forum_icon_path']); 
         $count = 0; 
         while( $file = @readdir($dir) ) 
         { 
            if( !@is_dir(phpbb_realpath($phpbb_root_path . $board_config['forum_icon_path'] . '/' . $file)) ) 
            { 
               if( preg_match('/(\.gif$|\.png$|\.jpg|\.jpeg)$/is', $file) ) 
               { 
                  $forum_icons[$count] = $file; 
                  $count++; 
               } 
            } 
         } 

         @closedir($dir); 
         $dirNew = @opendir($phpbb_root_path . $board_config['forum_icon_new_path']); 
         $countnew = 0; 
         while( $file = @readdir($dirNew) ) 
         { 
            if( !@is_dir(phpbb_realpath($phpbb_root_path . $board_config['forum_icon_new_path'] . '/' . $file)) ) 
            { 
               if( preg_match('/(\.gif$|\.png$|\.jpg|\.jpeg)$/is', $file) ) 
               { 
                  $forum_icons_new[$countnew] = $file; 
                  $countnew++; 
               } 
            } 
         } 

         @closedir($dirNew); 
             
         if ($mode == 'addforum') 
         { 
            $forum_icons_list = "";  
            $forum_icons_list .= '<option value="' . $forum_icons[0] . '" selected="selected">' . $forum_icons[0] . '</option>'; 
             
            for( $i = 1; $i < count($forum_icons); $i++ ) 
            { 
               $forum_icons_list .= '<option value="' . $forum_icons[$i] . '">' . $forum_icons[$i] . '</option>'; 
               $default_ficon = $forum_icons[0]; 
            } 
            $forum_icons_list_new = "";
            $forum_icons_list_new .= '<option value="' . $forum_icons_new[0] . '" selected="selected">' . $forum_icons_new[0] . '</option>'; 

            for( $n = 1; $n < count($forum_icons_new); $n++ ) 
            { 
               $forum_icons_list_new .= '<option value="' . $forum_icons_new[$n] . '">' . $forum_icons_new[$n] . '</option>'; 
               $default_ficon_new = $forum_icons_new[0]; 
            } 
         } 

# 
#-----[ FIND ]------------------------------------------ 
# 
				$forumstatus = $row['forum_status'];

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
            $forumicon = $row['forum_icon']; // Forum Icon MOD 

            // Forum Icon MOD - New fix for 1.0.8 
            $forum_icons_list = ""; 
            for( $i = 0; $i < count($forum_icons); $i++ ) 
            { 
               if ($forum_icons[$i] == $row['forum_icon']) 
               { 
                  $forum_icons_list .= '<option value="' . $forum_icons[$i] . '" selected="selected">' . $forum_icons[$i] . '</option>'; 
               } 
               else 
               { 
                  $forum_icons_list .= '<option value="' . $forum_icons[$i] . '">' . $forum_icons[$i] . '</option>'; 
               } 
               $default_ficon = $forum_icons[0]; 
            } 
            $forumiconnew = $row['forum_icon_new']; 

            $forum_icons_list_new = ""; 
            for( $n = 0; $n < count($forum_icons_new); $n++ ) 
            { 
               if ($forum_icons_new[$n] == $row['forum_icon_new']) 
               { 
                  $forum_icons_list_new .= '<option value="' . $forum_icons_new[$n] . '" selected="selected">' . $forum_icons_new[$n] . '</option>'; 
               } 
               else 
               { 
                  $forum_icons_list_new .= '<option value="' . $forum_icons_new[$n] . '">' . $forum_icons_new[$n] . '</option>'; 
               } 
               $default_ficon_new = $forum_icons_new[0]; 
            } 

# 
#-----[ FIND ]------------------------------------------ 
# 
				$forumstatus = FORUM_UNLOCKED;

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

				$forumicon = ''; // Forum Icon MOD 
				$forumiconnew = ''; // Forum Icon MOD 

# 
#-----[ FIND ]------------------------------------------ 
# 
				'L_FORUM_STATUS' => $lang['Forum_status'],

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
				'L_FORUM_ICON' => $lang['Forum_icon'], // Forum Icon MOD 
				'L_FORUM_ICON_NEW' => $lang['Forum_icon_new'], // Forum Icon MOD 
# 
#-----[ FIND ]------------------------------------------ 
#
				'DESCRIPTION' => $forumdesc)

# 
#-----[ REPLACE WITH ]------------------------------------------ 
#
				'DESCRIPTION' => $forumdesc,
				'ICON_LIST' => $forum_icons_list,
				'ICON_BASEDIR' => $phpbb_root_path . $board_config['forum_icon_path'],
				'ICON_IMG' => ( $forumicon ) ? $phpbb_root_path . $board_config['forum_icon_path'] . '/' . $forumicon : $phpbb_root_path . $board_config['forum_icon_path'] . '/' . $default_ficon,
				'ICON_LIST_NEW' => $forum_icons_list_new, 
				'ICON_BASEDIR_NEW' => $phpbb_root_path . $board_config['forum_icon_new_path'],
				'ICON_IMG_NEW' => ( $forumiconnew ) ? $phpbb_root_path . $board_config['forum_icon_new_path'] . '/' . $forumiconnew : $phpbb_root_path . $board_config['forum_icon_new_path'] . '/' . $default_ficon_new
            ) 

# 
#-----[ FIND ]------------------------------------------ 
#
			// There is no problem having duplicate forum names so we won't check for it.
			$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, prune_enable" . $field_sql . ")

# 
#-----[ IN-LINE FIND ]------------------------------------------ 
#
forum_status

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
#
, forum_icon, forum_icon_new

# 
#-----[ FIND ]------------------------------------------ 
#
				VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";

# 
#-----[ IN-LINE FIND ]------------------------------------------ 
#
, " . intval($HTTP_POST_VARS['forumstatus']) . "

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
#
, '" . str_replace("\'", "''", $HTTP_POST_VARS['forumicon']) . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumiconnew']) . "'

# 
#-----[ FIND ]------------------------------------------ 
#
			$sql = "UPDATE " . FORUMS_TABLE . "
				SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . "
				WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
# 
#-----[ IN-LINE FIND ]------------------------------------------ 
#
, forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . "

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
#
, forum_icon = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumicon']) . "', forum_icon_new = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumiconnew']) . "'

# 
#-----[ FIND ]------------------------------------------ 
# 
					'FORUM_DESC' => $forum_rows[$j]['forum_desc'],

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
					'FORUM_ICON_IMG' => ( $forum_rows[$j]['forum_icon'] ) ? '<img src="' . $phpbb_root_path . $board_config['forum_icon_path'] .'/' . $forum_rows[$j]['forum_icon'] . '" alt="'.$forum_data[$j]['forum_name'].'" title="'.$forum_data[$j]['forum_name'].'" />' : '',
					'FORUM_ICON_NEW_IMG' => ( $forum_rows[$j]['forum_icon_new'] ) ? '<img src="' . $phpbb_root_path . $board_config['forum_icon_new_path'] .'/' . $forum_rows[$j]['forum_icon_new'] . '" alt="'.$forum_data[$j]['forum_name'].'" title="'.$forum_data[$j]['forum_name'].'" />' : '',
index.php

Code: Select all

# 
#-----[ FIND ]------------------------------------------ 
# 
							if ( $forum_data[$j]['forum_status'] == FORUM_LOCKED )
							{
								$folder_image = $images['forum_locked'];

# 
#-----[ REPLACE WITH ]------------------------------------------ 
#
							if ( $forum_data[$j]['forum_status'] == FORUM_LOCKED )
							{
								if($forum_data[$j]['forum_icon'])
								{
								$folder_image = '<img border="0" src="' . $phpbb_root_path . $board_config['forum_icon_path'] . '/' . $forum_data[$j]['forum_icon'] . '" alt="'.$forum_data[$j]['forum_name'].'" title="'.$forum_data[$j]['forum_name'].'" />'; 
								}
								else
								{
								$folder_image = '<img border="0" src="' . $images['forum_locked'] . '" alt="'.$folder_alt.'" title="'.$folder_alt.'" />';
								};

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

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
	if($forum_data[$j]['forum_icon'])
	{
		if($forum_data[$j]['forum_icon_new'])
		{
		$folder_image = ( $unread_topics ) ? '<img border="0" src="' . $phpbb_root_path . $board_config['forum_icon_new_path'] . '/' . $forum_data[$j]['forum_icon_new'] . '" alt="'.$forum_data[$j]['forum_name'].'" title="'.$forum_data[$j]['forum_name'].'" />' : '<img border="0" src="' . $phpbb_root_path . $board_config['forum_icon_path'] . '/' . $forum_data[$j]['forum_icon'] . '" alt="'.$forum_data[$j]['forum_name'].'" title="'.$forum_data[$j]['forum_name'].'" />';
		}
		else
		{
		$folder_image = ( $unread_topics ) ? '<img border="0" src="' . $phpbb_root_path . $board_config['forum_icon_path'] . '/' . $forum_data[$j]['forum_icon'] . '" alt="'.$forum_data[$j]['forum_name'].'" title="'.$forum_data[$j]['forum_name'].'" />' : '<img border="0" src="' . $phpbb_root_path . $board_config['forum_icon_path'] . '/' . $forum_data[$j]['forum_icon'] . '" alt="'.$forum_data[$j]['forum_name'].'" title="'.$forum_data[$j]['forum_name'].'" />';
		}
	}
	else
	{
	$folder_image = ( $unread_topics ) ? '<img border="0" src="' . $images['forum_new'] . '" alt="'.$folder_alt.'" title="'.$folder_alt.'" />' : '<img src="' . $images['forum'] . '" alt="'.$folder_alt.'" title="'.$folder_alt.'" />';
	};
								$folder_alt = ( $unread_topics ) ? $lang['New_posts'] : $lang['No_new_posts']; 
							}

# 
#-----[ FIND ]------------------------------------------ 
# 
							$posts = $forum_data[$j]['forum_posts'];
							$topics = $forum_data[$j]['forum_topics'];

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
	$icon = $forum_data[$j]['forum_icon'];   // Forum Icon Mod 
	$iconnew = $forum_data[$j]['forum_icon_new'];   // Forum Icon Mod 

# 
#-----[ FIND ]------------------------------------------ 
# 
								'FORUM_FOLDER_IMG' => $folder_image, 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
	'FORUM_ICON_IMG' => ($icon) ? '<img border="0" src="' . $phpbb_root_path . $board_config['forum_icon_path'] . '/' . $icon . '" alt="'.$forum_data[$j]['forum_name'].'" title="'.$forum_data[$j]['forum_name'].'" />' : '',

	'FORUM_ICON_NEW_IMG' => ($iconnew) ? '<img border="0" src="' . $phpbb_root_path . $board_config['forum_icon_new_path'] . '/' . $iconnew . '" alt="'.$forum_data[$j]['forum_name'].'" title="'.$forum_data[$j]['forum_name'].'" />' : '',
viewforum.php

Code: Select all

# 
#-----[ FIND ]------------------------------------------ 
# 
	'FORUM_NAME' => $forum_row['forum_name'],

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
	'FORUM_ICON_IMG' => ($forum_row['forum_icon']) ? '<img border="0" src="' . $phpbb_root_path . $board_config['forum_icon_path'] . '/' . $forum_row['forum_icon'] . '" alt="'.$forum_row['forum_name'].'" title="'.$forum_row['forum_name'].'" />&nbsp;' : '',
	'FORUM_ICON_NEW_IMG' => ($forum_row['forum_icon_new']) ? '<img border="0" src="' . $phpbb_root_path . $board_config['forum_icon_new_path'] . '/' . $forum_row['forum_icon_new'] . '" alt="'.$forum_row['forum_name'].'" title="'.$forum_row['forum_name'].'" />&nbsp;' : '',
viewtopic.php

Code: Select all

//
// End auth check
//

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
// Forum Icon Mod 
$sql = "SELECT forum_icon, forum_icon_new 
   FROM " . FORUMS_TABLE . " 
   WHERE forum_id = $forum_id"; 
if ( !($result = $db->sql_query($sql)) ) 
{ 
   message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql); 
} 
$forum_row = $db->sql_fetchrow($result); 
$forum_icon = $forum_row['forum_icon']; 
$forum_icon_new = $forum_row['forum_icon_new']; 

# 
#-----[ FIND ]------------------------------------------ 
# 
	'FORUM_NAME' => $forum_name,

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
    'FORUM_ICON_IMG' => ($forum_icon) ? '<img border="0" src="' . $phpbb_root_path . $board_config['forum_icon_path'] . '/' . $forum_icon . '" alt="'.$forum_name.'" title="'.$forum_name.'" />&nbsp;' : '',
    'FORUM_ICON_NEW_IMG' => ($forum_icon_new) ? '<img border="0" src="' . $phpbb_root_path . $board_config['forum_icon_new_path'] . '/' . $forum_icon_new . '" alt="'.$forum_name.'" title="'.$forum_name.'" />&nbsp;' : '',
templates/subSilver/admin/board_config_body.tpl

Code: Select all

# 
#-----[ FIND ]------------------------------------------ 
# 
	<tr>
		<td class="row1">{L_SYSTEM_TIMEZONE}</td>
		<td class="row2">{TIMEZONE_SELECT}</td>
	</tr>

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
   <tr> 
      <td class="row1">{L_FORUM_ICON_PATH} <br /><span class="gensmall">{L_FORUM_ICON_PATH_EXPLAIN}</span></td> 
      <td class="row2"><input class="post" type="text" size="20" maxlength="255" name="forum_icon_path" value="{FORUM_ICON_PATH}" /></td> 
   </tr> 
   <tr> 
      <td class="row1">{L_FORUM_ICON_NEW_PATH} <br /><span class="gensmall">{L_FORUM_ICON_NEW_PATH_EXPLAIN}</span></td> 
      <td class="row2"><input class="post" type="text" size="20" maxlength="255" name="forum_icon_new_path" value="{FORUM_ICON_NEW_PATH}" /></td> 
   </tr> 
templates/subSilver/admin/forum_edit_body.tpl

Code: Select all

# 
#-----[ FIND ]------------------------------------------ 
# 
<p>{L_FORUM_EXPLAIN}</p>

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
<script language="javascript" type="text/javascript"> 
<!-- 
function update_forum_icon(newimage) 
{ 
   document.forum_icon.src = "{ICON_BASEDIR}/" + newimage; 
} 
function update_forum_icon_new(newimage) 
{ 
   document.forum_icon_new.src = "{ICON_BASEDIR_NEW}/" + newimage; 
} 
//--> 
</script>

# 
#-----[ FIND ]------------------------------------------ 
# 
<form action="{S_FORUM_ACTION}" method="post">
  <table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline" align="center">

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
<tr>
	  <th class="thHead" colspan="2">Forum Icons</th>
</tr>
	<tr> 
	  <td class="row1"><font size="2">1.&nbsp;{L_FORUM_ICON}<br />2.&nbsp;Forum Icon (Locked)</font><br /><select name="forumicon" onchange="update_forum_icon(this.options[selectedIndex].value);">{ICON_LIST}</select> &nbsp; <img name="forum_icon" src="{ICON_IMG}" border="0" alt="" /></td><td class="row2"><font size="2">1.&nbsp;{L_FORUM_ICON_NEW}</font><br /><select name="forumiconnew" onchange="update_forum_icon_new(this.options[selectedIndex].value);">{ICON_LIST_NEW}</select> &nbsp; <img name="forum_icon_new" src="{ICON_IMG_NEW}" border="0" alt="" /> &nbsp;</td>
	</tr>
templates/subSilver/admin/forum_admin_body.tpl

Code: Select all

# 
#-----[ FIND ]------------------------------------------ 
# 
		<td class="row2"><span class="gen"><a href="{catrow.forumrow.U_VIEWFORUM}" target="_new">{catrow.forumrow.FORUM_NAME}</a></span><br /><span class="gensmall">{catrow.forumrow.FORUM_DESC}</span></td>

# 
#-----[ IN-LINE FIND ]------------------------------------------ 
#
		<td class="row2"><span class="gen">

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
#
{catrow.forumrow.FORUM_ICON_IMG}&nbsp;{catrow.forumrow.FORUM_ICON_NEW_IMG}&nbsp;&nbsp;
templates/subSilver/index_body.tpl
These are going to be your main Forum Images, so we won't be changing colspan="2" to colspan="3" anywhere in here:

Code: Select all

# 
#-----[ FIND ]------------------------------------------ 
#
	<td class="row1" align="center" valign="middle" height="50"><img src="{catrow.forumrow.FORUM_FOLDER_IMG}" width="46" height="25" alt="{catrow.forumrow.L_FORUM_FOLDER_ALT}" title="{catrow.forumrow.L_FORUM_FOLDER_ALT}" /></td>

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
	<td class="row1" align="center" valign="middle" height="50"><a href="{catrow.forumrow.U_VIEWFORUM}" class="forumlink" onFocus="if(this.blur)this.blur()">{catrow.forumrow.FORUM_FOLDER_IMG}</a></td>
templates/subSilver/viewforum_body.tpl

Code: Select all

# 
#-----[ FIND ]------------------------------------------ 
# 
	  <td align="left" valign="bottom" colspan="2"><a class="maintitle" href="{U_VIEW_FORUM}">{FORUM_NAME}</a>

# 
#-----[ IN-LINE FIND ]------------------------------------------ 
#
<a class="maintitle" href="{U_VIEW_FORUM}">{FORUM_NAME}</a>

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
<a class="maintitle" href="{U_VIEW_FORUM}">{FORUM_ICON_IMG}</a><br />{FORUM_NAME}<br />
templates/subSilver/viewtopic_body.tpl

Code: Select all

# 
#-----[ FIND ]------------------------------------------ 
# 
<td align="left" valign="bottom" colspan="2"><a class="maintitle" href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a><br />

# 
#-----[ IN-LINE FIND ]------------------------------------------ 
#
<a class="maintitle" href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a><br />

# 
#-----[ REPLACE WITH ]------------------------------------------ 
#
<a href="{U_VIEW_FORUM}" class="nav">{FORUM_ICON_IMG}</a><br />{TOPIC_TITLE}
-----[ SAVE/CLOSE ALL FILES ]-----
EoM

Thanks ycl6 Hope u like it.
SoLoGHoST

The only thing that would make it better is to add an radio button to the Configuration settings for personal images, and original images. So if original images is selected, it would then display the normal images and paths that phpBB uses by default. And if personal images was selected, then they should be able to edit the images in forum_edit_body.tpl in the Admin Section and see the icons in the Forum Management Section. Otherwise this MOD KICKS ASS.

All Images are also links to that forum, if you don't like it, change the tpl files accordingly.

User avatar
vrflyer
Registered User
Posts: 503
Joined: Mon Feb 17, 2003 8:27 pm

Post by vrflyer »

^^^ An addon to this MOD - looks nice! 8)
Always Under Construction !

User avatar
SoLoGHoST
Registered User
Posts: 58
Joined: Wed Oct 19, 2005 4:03 am
Contact:

Post by SoLoGHoST »

Okay, I know I'm a sloppy coder so feel free to change the coding ycl6. I just wanted it to work and so I coded for workmanship.

Thanks,
SoLoGHoST

ycl6
Translator
Posts: 5696
Joined: Sat Feb 15, 2003 10:35 am
Location: Taiwan
Contact:

Post by ycl6 »

SoLoGHoST wrote: Okay, I know I'm a sloppy coder so feel free to change the coding ycl6. I just wanted it to work and so I coded for workmanship.

Thanks,
SoLoGHoST

Thanks SoLoGHoST

When I have more time I'll try to do something with it :wink:

~Mac

newcster68
Registered User
Posts: 59
Joined: Mon Jan 31, 2005 5:48 am

Post by newcster68 »

Ok before I lose my frakin mind.

I did all the edits correctly.. I think.. some lines that I had to look for were a bit different than when asking to find those lines.

example:

Code: Select all

# 
#-----[ FIND ]------------------------------------------ 
#
			// There is no problem having duplicate forum names so we won't check for it.
			$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, prune_enable" . $field_sql . ")
mine looks like this:

Code: Select all

$columns = 'forum_id,   forum_name,   cat_id,   forum_desc,   forum_order,  forum_status, forum_icon, prune_enable,  forum_parent,  show_on_index'. $field_sql;
			$values = "$forum_id, '$forum_name', $cat_id, '$forum_desc', $forum_order, $forum_status, $forum_icon, $prune_enable, $forum_parent, $show_on_index". $value_sql;

			$sql = 'INSERT INTO '. FORUMS_TABLE ." ($columns) VALUES ($values)";

			if (!$db->sql_query($sql))
			{
				message_die(GENERAL_ERROR, "Couldn't insert row in forums table", '', __LINE__, __FILE__, $sql);
			}

			if ($prune_enable)
			{
				if (!$prune_days || !$prune_freq)
				{
					message_die(GENERAL_MESSAGE, $lang['Set_prune_data']);
				}

				$columns = 'forum_id,  prune_days,  prune_freq';
				$values = "$forum_id, $prune_days, $prune_freq";

				$sql = 'INSERT INTO '. PRUNE_TABLE ." ($columns) VALUES ($values)";

				if (!$db->sql_query($sql))
				{
					message_die(GENERAL_ERROR, "Couldn't insert row in prune table", '', __LINE__, __FILE__, $sql);
				}
			}

			renumber_order('forum', $cat_id);

			$message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
			message_die(GENERAL_MESSAGE, $message);

			break;
// Create a forum in the DB
		case 'createforum':

			$cat_id = intval($HTTP_POST_VARS[POST_CAT_URL]);
			$forum_name = str_replace("\'", "''", trim($HTTP_POST_VARS['forumname']));
			$forum_desc = str_replace("\'", "''", trim($HTTP_POST_VARS['forumdesc']));
			$forum_status = intval($HTTP_POST_VARS['forumstatus']);
            $forum_icon = str_replace("\'", "''",($HTTP_POST_VARS['forumicon']));
			$prune_enable = (isset($HTTP_POST_VARS['prune_enable'])) ? 1 : 0;
			$prune_days = intval($HTTP_POST_VARS['prune_days']);
			$prune_freq = intval($HTTP_POST_VARS['prune_freq']);
			$forum_parent = ($HTTP_POST_VARS['forum_parent'] != -1) ? intval($HTTP_POST_VARS['forum_parent']) : 0;
			$show_on_index = intval($HTTP_POST_VARS['show_on_index']);

			if (!$forum_name)
			{
				message_die(GENERAL_ERROR, "Can't create a forum without a name");
			}

			if ($forum_parent)
			{
				if (!$parent = get_forum_data($forum_parent))
				{
					message_die(GENERAL_ERROR, "Parent forum with <b>id=$forum_parent</b> not found");
				}

				$cat_id = $parent['cat_id'];
				$forum_parent = ($parent['forum_parent']) ? $parent['forum_parent'] : $parent['forum_id'];
				$forum_order = $parent['forum_order'] + 5;
			}
			else
			{
				$max_order = get_max_cat_order($cat_id);
				$forum_order = $max_order + 5;
			}

			$sql = 'SELECT MAX(forum_id) AS max_id
				FROM '. FORUMS_TABLE;

			if (!$row = $db->sql_fetchrow($db->sql_query($sql)))
			{
				message_die(GENERAL_ERROR, "Couldn't get order number from forums table", "", __LINE__, __FILE__, $sql);
			}

			$max_id = (isset($row['max_id'])) ? $row['max_id'] : 1;
			$forum_id = $max_id + 1;

			// Default permissions of public forum
			$field_sql = $value_sql = '';

			foreach ($forum_auth_ary as $field => $value)
			{
				$field_sql .= ", $field";
				$value_sql .= ", $value";
			}
//-- mod : topic display order ---------------------------------------------------------------------
//-- add
			$field_sql .= ', forum_display_sort';
			$value_sql .= ', ' . intval($HTTP_POST_VARS['forum_display_sort']);
			$field_sql .= ', forum_display_order';
			$value_sql .= ', ' . intval($HTTP_POST_VARS['forum_display_order']);
//-- fin mod : topic display order -----------------------------------------------------------------

			$columns = 'forum_id,   forum_name,   cat_id,   forum_desc,   forum_order,  forum_status, forum_icon, prune_enable,  forum_parent,  show_on_index'. $field_sql;
			$values = "$forum_id, '$forum_name', $cat_id, '$forum_desc', $forum_order, $forum_status, $forum_icon, $prune_enable, $forum_parent, $show_on_index". $value_sql;

			$sql = 'INSERT INTO '. FORUMS_TABLE ." ($columns) VALUES ($values)";

			if (!$db->sql_query($sql))
			{
				message_die(GENERAL_ERROR, "Couldn't insert row in forums table", '', __LINE__, __FILE__, $sql);
			}

			if ($prune_enable)
			{
				if (!$prune_days || !$prune_freq)
				{
					message_die(GENERAL_MESSAGE, $lang['Set_prune_data']);
				}

				$columns = 'forum_id,  prune_days,  prune_freq';
				$values = "$forum_id, $prune_days, $prune_freq";

				$sql = 'INSERT INTO '. PRUNE_TABLE ." ($columns) VALUES ($values)";

				if (!$db->sql_query($sql))
				{
					message_die(GENERAL_ERROR, "Couldn't insert row in prune table", '', __LINE__, __FILE__, $sql);
				}
			}

			renumber_order('forum', $cat_id);

			$message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
			message_die(GENERAL_MESSAGE, $message);

			break;

		// Modify a forum in the DB
		case 'modforum':

			$cat_id = intval($HTTP_POST_VARS[POST_CAT_URL]);
			$forum_id = intval($HTTP_POST_VARS[POST_FORUM_URL]);
			$forum_name = str_replace("\'", "''", trim($HTTP_POST_VARS['forumname']));
			$forum_desc = str_replace("\'", "''", trim($HTTP_POST_VARS['forumdesc']));
			$forum_status = intval($HTTP_POST_VARS['forumstatus']);
            $forum_icon = str_replace("\'", "''",($HTTP_POST_VARS['forumicon']));
			$prune_enable = (isset($HTTP_POST_VARS['prune_enable'])) ? 1 : 0;
			$prune_days = intval($HTTP_POST_VARS['prune_days']);
			$prune_freq = intval($HTTP_POST_VARS['prune_freq']);
			$forum_parent = ($HTTP_POST_VARS['forum_parent'] != -1) ? intval($HTTP_POST_VARS['forum_parent']) : 0;
			$show_on_index = intval($HTTP_POST_VARS['show_on_index']);
			$forum_display_order = intval($HTTP_POST_VARS['forum_display_order']);
			$forum_display_sort = intval($HTTP_POST_VARS['forum_display_sort']);

			$forum_data = get_forum_data($forum_id);
			$old_cat_id = $forum_data['cat_id'];
			$forum_order = $forum_data['forum_order'];
I have just about given up on this mod as I am running 2.0.17 and everthing works fine in the admin section but I will be damned if I cant get the darn images to appear on the index.. show the colum and a red x but that is it .. any help PLEASE..

I really wish the authors of these mods would update their mods instead of having us trying to figure out and spend 10 hours getting the darn thing to work.

Image

User avatar
gracelessone
Registered User
Posts: 16
Joined: Thu Mar 18, 2004 7:03 am
Location: NJ
Contact:

Post by gracelessone »

It might help if you showed exactly which file you were working in and what you did to the lines you found instead of posting your entire file.

User avatar
SoLoGHoST
Registered User
Posts: 58
Joined: Wed Oct 19, 2005 4:03 am
Contact:

don't use $forum_icon, use $forumicon instead

Post by SoLoGHoST »

okay, he/she is working in admin/admin_forums.php and seems to me that you have installed a mod prior to this one that altered the original code that was supposed to read:

Code: Select all

$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, prune_enable" . $field_sql . ")
and now you have:

Code: Select all

         $values = "$forum_id, '$forum_name', $cat_id, '$forum_desc', $forum_order, $forum_status, $forum_icon, $prune_enable, $forum_parent, $show_on_index". $value_sql; 

         $sql = 'INSERT INTO '. FORUMS_TABLE ." ($columns) VALUES ($values)";
basically $forum_icon is defined after you've defined the values in the code, so try using $forumicon without the _ . so just change it to:

Code: Select all

         $values = "$forum_id, '$forum_name', $cat_id, '$forum_desc', $forum_order, $forum_status, $forumicon, $prune_enable, $forum_parent, $show_on_index". $value_sql; 

         $sql = 'INSERT INTO '. FORUMS_TABLE ." ($columns) VALUES ($values)";
and you also have it declared again further down in your code, change that to $forumicon also.

Or maybe declare the $forum_icon before the $values variable is declared. perhaps in the line above the $values = "$forum_id, '$forum_name', etc. etc. code. Just trying to help you, and sorry for the 9 day reply, been busy...

SoLoGHoST

newcster68
Registered User
Posts: 59
Joined: Mon Jan 31, 2005 5:48 am

Post by newcster68 »

I have started a fresh board now since the mod that was interderring with it is a single mod and not incorporated into the board so I strted a fresh board and i got it to work.


Here is a question hopefully you can help me with now. I am using aphrodite template and I just added simple subforums to my board. What files do I need to edit and can u be so kind to show me where to place the code to get the icons to show in the subforum section just like the index.


Example: (in the Forum Administration area) I created a subforum under a forum.

I would like to add the icon also in the sub section
Image

The drop down list is already in the sub section..
Image

but is not showing in the viewforum section in the subforum table
Image
'
any way to add this to the mod?

User avatar
SoLoGHoST
Registered User
Posts: 58
Joined: Wed Oct 19, 2005 4:03 am
Contact:

index.php

Post by SoLoGHoST »

Okay, not familiar with the Subforums Mod you installed, however, I would start out by changing the .tpl (template file) that you installed with the Subforums Mod, in the same way you edited templates/<template name>/index_body.tpl with the Forum Icon Mod.

Well, Good Luck

MrC
Registered User
Posts: 857
Joined: Mon Jun 30, 2003 4:11 pm
Location: The Netherlands
Name: Ivo
Contact:

Post by MrC »

Hi just installed this mod, all ok.
But i have a little cosmetical problem

Image

Check the icon in front of the forum, it uses an extra <td> so i have a white line between the image and the text. How do i get rid of them to get this?

I want it to look like this
Image

The image in the same <td> but with all text lined out vetically

Thanks in advance!

ycl6
Translator
Posts: 5696
Joined: Sat Feb 15, 2003 10:35 am
Location: Taiwan
Contact:

Post by ycl6 »

I'll probably solve this by introducing a new td CSS class. I'll think about that.

~Mac

MrC
Registered User
Posts: 857
Joined: Mon Jun 30, 2003 4:11 pm
Location: The Netherlands
Name: Ivo
Contact:

Post by MrC »

Hi Mac

I tried it by adding a row5 in the .css but i couldn't get it to work.
So i you can try, please

Thanks in advance

Post Reply

Return to “[2.0.x] MOD Database Releases”