[BETA] Hidden Mod Visible 1.0.3

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.
Post Reply
webiser
Registered User
Posts: 33
Joined: Wed Feb 05, 2003 9:04 am
Location: France
Contact:

[BETA] Hidden Mod Visible 1.0.3

Post by webiser » Wed Sep 22, 2004 2:29 pm

Version 1.0.3 :

Code: Select all

##############################################################
## MOD Titre : Hidden Mod Visible
## MOD Auteur : Dan_Cak < sbriant@createkater.com >
##
## MOD Description : show hidden moderator group
##
## MOD Version : 1.0.3
##
## Level of installation : easy
## Time installation :  5 minutes
## files to edit :   5
## index.php, index_body.tpl, viewforum.php, viewforum_body.tpl et page_main.php
##
##############################################################
## Pour des raisons de sécurité, vous êtes prier de sauvegarder 
## tous les fichiers avant les modifications
##############################################################
## History of MOD :
##
##   2004-09-21 - Version 1.0.0
##      - Starting MOD
##   2004-09-21 - Version 1.0.1
##      -  Two lines
##   2004-09-23 - Version 1.0.3
##      -  Two lines and seperated view to admin and simple user
##
##############################################################
############################################################## 

#
# -------[ OPEN ]----------------------------------------------
#

 index.php

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

	$sql = "SELECT aa.forum_id, g.group_id, g.group_name 
		FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g 
		WHERE aa.auth_mod = " . TRUE . " 
			AND g.group_single_user = 0 
			AND g.group_type <> " . GROUP_HIDDEN . "
			AND ug.group_id = aa.group_id 
			AND g.group_id = aa.group_id 
		GROUP BY g.group_id, g.group_name, aa.forum_id 
		ORDER BY aa.forum_id, g.group_id";

#
# -------[ DELETE LINE ]---------------------------------------------
#

			AND g.group_type <> " . GROUP_HIDDEN . "

#
# -------[ FIND ]---------------------------------------------
#
	while( $row = $db->sql_fetchrow($result) )
	{
		$forum_moderators[$row['forum_id']][] = '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $row['group_id']) . '">' . 

$row['group_name'] . '</a>';
	}
	$db->sql_freeresult($result);

#
# -------[ AFTER, ADD ]---------------------------------------------
#
	$sql_hidden = "SELECT aa.forum_id, g.group_id, g.group_name 
		FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g 
		WHERE aa.auth_mod = " . TRUE . " 
			AND g.group_single_user = 0 
			AND ug.group_id = aa.group_id 
			AND g.group_id = aa.group_id 
			AND g.group_type = " . GROUP_HIDDEN . "
		GROUP BY g.group_id, g.group_name, aa.forum_id 
		ORDER BY aa.forum_id, g.group_id";
	if ( !($result = $db->sql_query($sql_hidden)) )
	{
		message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql_hidden);
	}
	while( $row = $db->sql_fetchrow($result) )
	{
		if (($userdata['user_level'] == ADMIN) || ($userdata['user_level'] == MOD)){
		$forum_moderators_hidden[$row['forum_id']][] = '<span style="color:#006699;">' . $row['group_name'] . '</span>';
		}
		else
		{
		$forum_moderators_hidden[$row['forum_id']][] = '';
		}
	$db->sql_freeresult($result);

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

		'L_MODERATOR' => $lang['Moderators'], 

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

		'L_MODERATOR_HIDDEN' => $lang['Moderators_hidden'],

#
# -------[ FIND ]---------------------------------------------
#
 !! parce que de nombreux mod modifient ce lignes elles ont été raccourcis, l'important est de trouver le dernier "}" apres le else

							if ( count($forum_moderators[$forum_id]) > 0 )
							{
								$l_moderators = 
								$moderator_list = 
							}
							else
							{
								$l_moderators = 
								$moderator_list = 
							}

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


							if ( count($forum_moderators_hidden[$forum_id]) > 0 )
							{
								$l_moderators_hidden = ( count($forum_moderators_hidden[$forum_id]) == 1 ) ? 

$lang['Moderator_hidden'] : $lang['Moderators_hidden'];
								$moderator_list_hidden = implode(', ', $forum_moderators_hidden[$forum_id]);
							}
							else
							{
								$l_moderators_hidden = '&nbsp;';
								$moderator_list_hidden = '&nbsp;';
							}

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

'MODERATORS' => $moderator_list,

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

'MODERATORS_HIDDEN' => $moderator_list_hidden,

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

'L_MODERATOR' => $l_moderators, 

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

'L_MODERATOR_HIDDEN' => $l_moderators_hidden,

#
# -------[ OPEN ]----------------------------------------------
#

language/lang_english/lang_main.php

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

$lang['Moderator'] = 'Moderator';
$lang['Moderators'] = 'Moderators';

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

$lang['Moderator_hidden'] = 'Ghost Moderator';
$lang['Moderators_hidden'] = 'Ghost Moderators';

#
# -------[ OPEN ]----------------------------------------------
#

template/subsilver/index_body.tpl

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

{catrow.forumrow.L_MODERATOR} {catrow.forumrow.MODERATORS}

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

<br />{catrow.forumrow.L_MODERATOR_HIDDEN} {catrow.forumrow.MODERATORS_HIDDEN}

#
# -------[ OPEN ]----------------------------------------------
#

viewforum.php

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

$l_moderators = ( count($moderators) == 1 ) ? $lang['Moderator'] : $lang['Moderators'];
$forum_moderators = ( count($moderators) ) ? implode(', ', $moderators) : $lang['None'];
unset($moderators);

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

// hidden group mod

$sql_hidden = "SELECT u.user_id, u.username, u.user_level
	FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g, " . USERS_TABLE . " u
	WHERE aa.forum_id = $forum_id 
		AND aa.auth_mod = " . TRUE . " 
		AND g.group_single_user = 1
		AND ug.group_id = aa.group_id 
		AND g.group_id = aa.group_id 
		AND u.user_id = ug.user_id 
	GROUP BY u.user_id, u.username  
	ORDER BY u.user_id";
if ( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql);
}

$moderators_hidden = array();
while( $row = $db->sql_fetchrow($result) )
{
	// Start add - Username Color Mod
	switch ( $row['user_level'] )
	{
		case ADMIN:
			$mod_username_color = '<b>' . $row['username'] . '</b>';
			$style_color = ' style="color:#' . $theme['fontcolor3'] . '"';
			break;

		case MOD:
			$mod_username_color = '<b>' . $row['username'] . '</b>';
			$style_color = ' style="color:#' . $theme['fontcolor2'] . '"';
			break;
		default:
			$mod_username_color = $row['username'];
			$style_color = '';
			break;
	}
	$moderators_hidden[] = color_group_colorize_name($row['user_id']);
	// End add - Username Color Mod
}

$sql_hidden = "SELECT g.group_id, g.group_name 
	FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g 
	WHERE aa.forum_id = $forum_id
		AND aa.auth_mod = " . TRUE . " 
		AND g.group_single_user = 0
		AND ug.group_id = aa.group_id 
		AND g.group_id = aa.group_id 
		AND g.group_type = ". GROUP_HIDDEN ."
	GROUP BY g.group_id, g.group_name  
	ORDER BY g.group_id";
if ( !($result = $db->sql_query($sql_hidden)) )
{
	message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql_hidden);
}

while( $row = $db->sql_fetchrow($result) )
{
		if (($userdata['user_level'] == ADMIN) || ($userdata['user_level'] == MOD)){
		$moderators_hidden[] = '<span style="color:#CCC;">' . $row['group_name'] . '</span>';
		}
		else
		{
		$moderators_hidden[] = 'You need to be an administrator to know this information';
		}
}

		$l_moderators_hidden = ( count($moderators_hidden) == 1 ) ? $lang['Moderator_hidden'] : $lang['Moderators_hidden'];
		$forum_moderators_hidden = ( count($moderators_hidden) ) ? implode(' ', $moderators_hidden) : $lang['None'];
unset($moderators_hidden);

//end hidden group mod

# 
#-----[ OPEN ]------------------------------------------
#

template/subsilver/viewforum.tpl

# 
#-----[ FIND ]------------------------------------------
#
{L_MODERATOR} : {MODERATORS}

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

<br />{L_MODERATOR_HIDDEN} : {MODERATORS_HIDDEN}

# 
#-----[ SAVE AND UPLOAD ]------------------------------------------
#
# EoM
Screenshot :

Admin or Moderator View
Image
Image

Other View
Image
Image

Post Reply

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