[問題]新增顯示會員群組

phpBB 2 MOD Support
無論是官方或非官方認證之外掛,安裝與使用問題討論。
(發表文章請按照公告格式發表,違者砍文)

版主: 版主管理群

主題已鎖定
appleboy
竹貓忠實會員
竹貓忠實會員
文章: 304
註冊時間: 2002-09-15 21:47
來自: 高雄
聯繫:

[問題]新增顯示會員群組

文章 appleboy »

問題外掛:新增顯示會員群組
參考連結:
http://phpbb-tw.net/phpbb/viewtopic.php?t=18473
http://mods.db9.dk/viewtopic.php?t=11
使用版本:(phpBB 2.0.3)
網站位置:http://appleboy46.no-ip.com
狀況描述:
我裝了now confirmed on ver 2.0.6 (*EM)這個外掛
會在人名下面顯示自己所加入的會員群組
可是那個會員群組的連結有問題...如下
http://appleboy46.no-ip.com/phpBB2/groupcp.?g=2772
在groupcp的後面多了一個點...不知我哪裡改錯了
還有他的會員群組會有圖案.....
我裝了之後並沒有....請大家幫我看看...哪段程式碼有問題
################################################################
## MOD Title: Show Usergroups
## MOD Author: Niels Chr. R鷣 Denmark < ncr@db9.dk > http://mods.db9.dk
## Description: This mod will add information about the posters current membership
## of any usergroups, they belong to - the list is shown beside
## the users posts/users profile, hidden groups are shown in itallic (only if
## the viewing user also are a member) - now also support show images for usergroups
##
## Mod Version: 1.3.2.
## Compability 2.0.6
##
## Installation Level: easy
## Installation Time: 5 Minutes
## Files To Edit: 5
## viewtopic.php
## includes/template.php
## includes/usercp_viewprofile.php
## templates/subSilver/profile_view_body.tpl
## templates/subSilver/viewtopic_body.tpl
##
## Included Files: 6
## includes/functions_usergroup.php
## templates/subSilver/show_usergroup.tpl
## templates/subSilver/show_usergroup_as_dropdown.tpl
## templates/subSilver/images/groups_snow.gif";
## templates/subSilver/images/groups_star2.gif";
## templates/subSilver/images/groups_diamond3.gif";
##
##############################################################
## 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:
##
## This MOD is compatible and can be installed by EasyMOD
## of Nuttzy (but is not officially EasyMOD Compliant)!
## http://www.phpbb.com/phpBB/viewtopic.php?t=124436
##
## In any case, if you install this MOD manually or using an
## alpha release of EM, please run this file NOW, before
## editing phpBB files by EM or manually!!!
## Otherwise, you may have an error message during your next
## connection.
##
##############################################################
## MOD History:
##
## 2003-09-04 - version 1.3.2.
## - fixed a problem with viewtopic.php (change the included file)
## - added new features to template.php
##
## 2003-08-29 - version 1.3.1.
## - updated the included file functions_usergroup.php
##
## 2003-08-27 - version 1.3.0.
## - Complete re-write, now uses own template file to define the show layout
## - Name changed from "member of" to "Show usergroup" as it is more correct
##
## 2003-08-27 - version 1.2.7.
## - fixing a bug, witch couse by version 1.2.4, made hidden group visible
##
## 2003-08-23 - version 1.2.6.
## - now rewritten how-to, to be EM ready
##
## ????-??-?? - version 1.2.5.
## - improved code, now uses 1 SQL, and improved the options in template code
##
## ????-??-?? - version 1.2.4.
## - code changed to allow more flex style control
##
## ????-??-?? - version 1.2.3.
## - confirmed for 2.0.5 by "kooky"
##
## ????-??-?? - version 1.2.2.
## - support images as well, code the group id into the template image file (e.g. subSilver.cfg)
##
## ????-??-?? - version 1.2.1.
## - added commas between usergroups
##
## ????-??-?? - version 1.2.0.
## - fixed a bug, causing user group to be none, also confirmed for phpBB2 version 2.0.2
##
## ????-??-?? - version 0.9.2.
## - History started, security update, now hidden groups are hidden if users are not allowed to view
##
## ????-??-?? - version 0.9.1.
## - updated by to version 2.0.1. by J廨獽e Gamez < Jerome@campinvaders.net> http://www.campinvaders.net
##
## ????-??-?? - Version 0.9.0
## - Initial release phpBB2 RC-1
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php

#
#-----[ FIND ]------------------------------------------
#
//
// Okay

#
#-----[ BEFORE, ADD ]------------------------------------------
#
include($phpbb_root_path . 'includes/functions_usergroup.'.$phpEx);

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

$template->pparse('body');

#
#-----[ BEFORE, ADD ]------------------------------------------
#
if (display_usergroups($userdata['user_id'],$poster_id,'postrow'))
{
$template->append_block_vars('postrow',array(
'L_USER_GROUP' =>$lang['Usergroups'],
'L_GO' => $lang['Go']));
} else
{
$template->append_block_vars('postrow',array(
'L_NO_USER_GROUP' =>$lang['Usergroups'],
'L_NO_USERGROUPS'=> $lang['None']));
}

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

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

?>

#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//
// Functions added for USERGROUP MOD
//

function append_var_from_handle_to_block($blockname,$varname, $handle)
{
if (!$this->loadfile($handle))
{
die("Template->assign_var_from_handle(): Couldn't load template file for handle $handle");
}
// Compile it, with the "no echo statements" option on.
$_str = "";
$code = $this->compile($this->uncompiled_code[$handle], true, '_str');
// evaluate the variable assignment.
eval($code);
// assign the value of the generated variable to the given varname.
$this->append_block_vars($blockname, array($varname => $_str));
return true;
}

function append_block_vars($blockname, $vararray)
{
if (strstr($blockname, '.'))
{
// Nested block.
$blocks = explode('.', $blockname);
$blockcount = sizeof($blocks) - 1;
$str = '$this->_tpldata';
for ($i = 0; $i <= $blockcount; $i++)
{
$str .= '[\'' . $blocks[$i] . '.\']';
eval('$lastiteration = sizeof(' . $str . ') - 1;');
$str .= '[' . $lastiteration . ']';
}
// Now we add the block that we're actually assigning to.
// We're adding a new iteration to this block with the given
// variable assignments.
$str .= '= array_merge('.$str.',$vararray);';
// Now we evaluate this assignment we've built up.
eval($str);
}
else
{
// Top-level block.
// Add a to existing block with the variable assignments
// we were given.
$current_iteration = sizeof($this->_tpldata[$blockname . '.'])-1;
$this->_tpldata[$blockname . '.'][$current_iteration] = array_merge($this->_tpldata[$blockname . '.'][$current_iteration],$vararray);
}

return true;
}

/**
* Flush a root level block, so it becomes empty.
*/
function flush_block_vars($blockname)
{
// Top-level block.
// flush a existing block we were given.
$current_iteration = sizeof($this->_tpldata[$blockname . '.'])-1;
unset($this->_tpldata[$blockname . '.']);
return true;
}


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

#
#-----[ FIND ]------------------------------------------
#
$template->pparse('body');

#
#-----[ BEFORE, ADD ]-----------------------------------------
#
include($phpbb_root_path . 'includes/functions_usergroup.'.$phpEx);
if (display_usergroups($userdata['user_id'],$profiledata[user_id],'show_usergroup_as_dropdown'))
{
$template->assign_vars(array(
'L_USER_GROUP' =>$lang['Usergroups']));
} else
{
$template->assign_vars(array(
'L_NO_USER_GROUP' =>$lang['Usergroups'],
'L_NO_USERGROUPS'=> $lang['None']));
}

#
#-----[ OPEN ]------------------------------------------
#
templates/Subsilver/viewtopic_body.tpl

#
#-----[ FIND ]------------------------------------------
#
{postrow.POSTER_FROM}

#
#-----[ IN-LINE FIND ]------------------------------------------
#
{postrow.POSTER_FROM}

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
<br/>{postrow.L_USER_GROUP}{postrow.L_NO_USER_GROUP}: {postrow.SHOW_USERGROUPS}{postrow.L_NO_USERGROUPS}

#
#-----[ OPEN ]------------------------------------------
#
# (make sure to edit this file for every theme your admin uses).
templates/subSilver/profile_view_body.tpl

#
#-----[ FIND ]------------------------------------------
#
{JOINED}</span></b></td>
</tr>

#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
<td valign="middle" align="right"><span class="gen">{L_USER_GROUP}{L_NO_USER_GROUP}:</span></td>
<td class="row1" valign="middle" width="100%"><b><span class="gen">{SHOW_USERGROUPS}{L_NO_USERGROUPS}</span></b></td>
</tr>


#
#-----[ OPEN ]------------------------------------------
#
# (make sure to edit this file for every theme your admin uses).
templates/subSilver/subSilver.cfg

#
#-----[ FIND ]------------------------------------------
#
?>

#
#-----[ BEFORE, ADD ]------------------------------------------
#
// add as meny as these, as you have usergroups, the ID is the same as the usergroup ID, these examples covers grop id 1->6
$images['groups'][1] = "$current_template_images/groups_snow.gif";
$images['groups'][2] = "$current_template_images/groups_star2.gif";
$images['groups'][3] = "$current_template_images/groups_diamond3.gif";
$images['groups'][4] = "$current_template_images/groups_snow.gif";
$images['groups'][5] = "$current_template_images/groups_star2.gif";
$images['groups'][6] = "$current_template_images/groups_diamond3.gif";

#
#-----[ COPY ]------------------------------------------
#
copy root/includes/functions_usergroup.php to includes/functions_usergroup.php
copy root/templates/subSilver/show_usergroup.tpl to templates/subSilver/show_usergroup.tpl
copy root/templates/subSilver/show_usergroup_as_dropdown.tpl to templates/subSilver/show_usergroup_as_dropdown.tpl
copy root/templates/subSilver/images/groups_snow.gif to templates/subSilver/images/groups_snow.gif
copy root/templates/subSilver/images/groups_star2.gif to templates/subSilver/images/groups_star2.gif
copy root/templates/subSilver/images/groups_diamond3.gif to templates/subSilver/images/groups_diamond3.gif

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
圖檔
歡迎來到 CodeIgniter 繁體中文討論區
My Blog:小惡魔 - 電腦技術 - 生活日記 - 美食介紹 - AppleBOY
翔翎
星球公民
星球公民
文章: 56
註冊時間: 2002-08-18 21:32

文章 翔翎 »

我也是\r

不過應該說點後面少了php

而不是多了點

當然連結是"找不到網頁"

不知如何解決
為惠偉
星球普通子民
星球普通子民
文章: 14
註冊時間: 2003-03-05 08:10

文章 為惠偉 »

我想是應該是functions_usergroup.php的問題

代碼: 選擇全部

<?php
/***************************************************************************
 *							   functions_usergroup.php
 *                            -------------------
 *   begin                : Tuesday, Aug 26, 2003
 *   copyright            : (C) 2003 Niels Chr. R鷣\r
 *   email                : ncr@db9.dk
 *
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

if ( !defined('IN_PHPBB') )
{
	die('Hacking attempt');
	exit;
}

//Add to show member of mod
function display_usergroups($viewer,$user,$blockname='',$template_file='')
\n{
	global $db,$template,$lang;
	$sql = "SELECT  g.group_name, g.group_id, g.group_type, SUM(ug.user_id = '$viewer') as viewer , SUM(ug.user_id = '$user') as poster FROM " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug 
	 WHERE  g.group_id = ug.group_id AND NOT g.group_single_user AND NOT ug.user_pending
		AND ug.user_id IN ('$viewer','$user')
		 GROUP BY ug.group_id having poster AND (g.group_type!=".GROUP_HIDDEN." OR viewer) ORDER BY g.group_name ";
	if(!$result = $db->sql_query($sql)) 
   		message_die(GENERAL_ERROR, "Error getting group information", "", __LINE__, __FILE__, $sql); 
	unset($group_list);
	$group_list = $db->sql_fetchrowset($result);
	if (!empty($group_list))
	{
		$template->set_filenames(array(
			'group_body' => ($template_file) ? $template_file.'.tpl' : 'show_usergroup.tpl'));
		$template->flush_block_vars('group');

		while (list($group_number, $group) = each($group_list))
		{
			$group_img = ($images['groups'][$group['group_id']]) ? '<img src="'.$images['groups'][$group['group_id']].'" border="0" alt="'.$group['group_name'].'">' : '';
			$group_url = append_sid("groupcp.$phpEx?g=".$group['group_id']); 
			$template->assign_block_vars('group', array(
				'GROUP_ID' => $group['group_id'],
				'GROUP_NAME' => $group['group_name'],
				'GROUP_IMG' => $group_img,
				'U_GROUP' => $group_url
			));
			if ($group['group_type']!=GROUP_HIDDEN)
			{
				$template->assign_block_vars('group.is_not_hidden', array());
			} else
			{
				$template->assign_block_vars('group.is_hidden', array());
			}
		}
		$template->append_var_from_handle_to_block($blockname,'SHOW_USERGROUPS', 'group_body');
//		$template->pparse('group_body');
		return true;
	}
	return false;
}
我目前暫時解決的方法是\r

代碼: 選擇全部

$group_url = append_sid("groupcp.$phpEx?g=".$group['group_id']);
改成

代碼: 選擇全部

$group_url = append_sid("groupcp.php$phpEx?g=".$group['group_id']);
希望作者盡快修正
或者有那位高手先行修正
slei
竹貓好朋友
竹貓好朋友
文章: 239
註冊時間: 2002-06-20 10:56
來自: 多倫多/香港
聯繫:

文章 slei »

代碼: 選擇全部

$group_url = append_sid("groupcp.$phpEx?g=".$group['group_id']);
改成

代碼: 選擇全部

$group_url = append_sid("groupcp.php?g=".$group['group_id']);
那位作者還沒有正式回覆...請耐心等待 :-)
我來自圖檔圖檔
圖檔
圖檔
appleboy
竹貓忠實會員
竹貓忠實會員
文章: 304
註冊時間: 2002-09-15 21:47
來自: 高雄
聯繫:

文章 appleboy »

slei 寫:

代碼: 選擇全部

$group_url = append_sid("groupcp.$phpEx?g=".$group['group_id']);
改成

代碼: 選擇全部

$group_url = append_sid("groupcp.php?g=".$group['group_id']);
那位作者還沒有正式回覆...請耐心等待 :-)
恩....問題以解決...你們有趣問原作者阿......
這是他的最新版本...我看他們的討論...
似乎也些bug....謝謝大家幫我解決....
看來我也要努力學習php...
圖檔
歡迎來到 CodeIgniter 繁體中文討論區
My Blog:小惡魔 - 電腦技術 - 生活日記 - 美食介紹 - AppleBOY
翔翎
星球公民
星球公民
文章: 56
註冊時間: 2002-08-18 21:32

文章 翔翎 »

檢視個人資料的地方\r

有列出"族群:"

但後面並未顯示出族群的名稱\r

還有如果要用圖片來代替\r

該如何改ㄋ

麻煩各位大大啦
asd098
星球普通子民
星球普通子民
文章: 4
註冊時間: 2003-09-27 19:01

文章 asd098 »

翔翎 寫:檢視個人資料的地方\r

有列出"族群:"

但後面並未顯示出族群的名稱\r

還有如果要用圖片來代替\r

該如何改ㄋ

麻煩各位大大啦
me too~ :cry:
asd098
星球普通子民
星球普通子民
文章: 4
註冊時間: 2003-09-27 19:01

文章 asd098 »

anybody here? :?:
主題已鎖定

回到「外掛問題討論」