[Mtdmods-checkins] SF.net SVN: mtdmods: [15] GroupMembersPageMOD/upload
Brought to you by:
markthedaemon
|
From: <mar...@us...> - 2006-07-02 02:28:42
|
Revision: 15 Author: markthedaemon Date: 2006-07-01 19:28:28 -0700 (Sat, 01 Jul 2006) ViewCVS: http://svn.sourceforge.net/mtdmods/?rev=15&view=rev Log Message: ----------- Added Paths: ----------- GroupMembersPageMOD/contrib/install.mod GroupMembersPageMOD/upload/groups.php GroupMembersPageMOD/upload/templates/ GroupMembersPageMOD/upload/templates/subSilver/ GroupMembersPageMOD/upload/templates/subSilver/groups_list_body.tpl Added: GroupMembersPageMOD/contrib/install.mod =================================================================== --- GroupMembersPageMOD/contrib/install.mod (rev 0) +++ GroupMembersPageMOD/contrib/install.mod 2006-07-02 02:28:28 UTC (rev 15) @@ -0,0 +1,105 @@ +################################################################# +## MOD Title: Group Members Page +## MOD Author: I'm Only 16 < n/a > ( n/a ) n/a +## MOD Author: MarkTheDaemon < n/a> (n/a) n/a +## MOD Description: This modification will add a new page to your forum listing groups and their members in a memberlist kind of style. +## MOD Version: 0.1.0 +## +## Installation Level: Easy +## Installation Time: 3 Minutes +## Files To Edit: includes/page_header.php +## language/lang_english/lang_main.php +## templates/subSilver/overall_header.tpl +## Included Files: root/groups.php +## root/templates/subSilver/groups_list_body.tpl +## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2 +############################################################## +## For security purposes, please check: http://www.phpbb.com/mods/ +## for the latest version of this MOD. Although MODs are checked +## before being allowed in the MODs Database there is no guarantee +## that there are no security problems within the MOD. No support +## will be given for MODs not found within the MODs Database which +## can be found at http://www.phpbb.com/mods/ +############################################################## +## Author Notes: N/A +## +############################################################## +## MOD History: +## +## 2006-05-18 - Version 0.1.0 +## - Stable Release +## +################################################################# +## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD +################################################################# + +# +#-----[ COPY ]------------------------------------------ +# +copy root/groups.php to groups.php +copy root/templates/subSilver/groups_list_body.tpl to templates/subSilver/groups_list_body.tpl + +# +#-----[ OPEN ]------------------------------------------ +# +includes/page_header.php + +# +#-----[ FIND ]------------------------------------------ +# +'L_WHOSONLINE_MOD' => + +# +#-----[ AFTER, ADD ]------------------------------------------ +# + 'L_GROUP_MEMBERS' => $lang['GROUP_LISTING']['L_GROUP_LIST'], + + 'U_GROUP_MEMBERS' => append_sid("groups.$phpEx"), + +# +#-----[ OPEN ]------------------------------------------ +# +language/lang_english/lang_main.php + +# +#-----[ FIND ]------------------------------------------ +# +// +// That's all, Folks! +// ------------------------------------------------- + +# +#-----[ BEFORE, ADD ]------------------------------------------ +# +// Group member listing lang +$lang['GROUP_LISTING'] = array( + 'L_GROUP_LIST' => 'Group Members', + 'L_MOD_ABOUT' => 'About', + 'L_MOD_ABOUT_F' => 'Group member listing mod by <a href="http://mtdmods.sourceforge.net">MarkTheDaemon</a>', + 'L_GROUP_MOD' => 'Group Moderator', +); + +# +#-----[ OPEN ]------------------------------------------ +# +templates/subSilver/overall_header.tpl + +# +#-----[ FIND ]------------------------------------------ +# + <a href="{U_PRIVATEMSGS}" class="mainmenu"> + +# +#-----[ IN-LINE FIND ]------------------------------------------ +# + <a href="{U_PRIVATEMSGS} + +# +#-----[ IN-LINE BEFORE, ADD ]------------------------------------------ +# + <a href="{U_GROUP_MEMBERS}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_groups.gif" width="12" height="13" border="0" alt="{L_GROUP_MEMBERS}" hspace="3" />{L_GROUP_MEMBERS}</a> + +# +#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ +# +# EoM \ No newline at end of file Added: GroupMembersPageMOD/upload/groups.php =================================================================== --- GroupMembersPageMOD/upload/groups.php (rev 0) +++ GroupMembersPageMOD/upload/groups.php 2006-07-02 02:28:28 UTC (rev 15) @@ -0,0 +1,180 @@ +<?php +/*************************************************************************** + * groups.php + * ------------------- + * begin : Thursday, May 18 2006 + * copyright : (C) 2006, Dean Newman & Mark Barnes (MarkTheDaemon) + * email : n/a + * website : http://mtdmods.sourceforge.net + * + ***************************************************************************/ + +/*************************************************************************** + * + * 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. + * + ***************************************************************************/ + +define('IN_PHPBB', true); +$phpbb_root_path = './'; +include($phpbb_root_path . 'extension.inc'); +include($phpbb_root_path . 'common.'.$phpEx); + +// +// Start session management +// +$userdata = session_pagestart($user_ip, PAGE_GROUPCP); +init_userprefs($userdata); +// +// End session management +// + +// +// Standard phpBB header +// +$page_title = $lang['GROUP_LISTING']['L_GROUP_LIST']; +include($phpbb_root_path . 'includes/page_header.'.$phpEx); + +// Set the handle +$template->set_filenames(array( + 'body' => 'groups_list_body.tpl', +)); + +// Set the array +$group_data = array(); +$template->assign_vars($lang['GROUP_LISTING']); + +// Hidden groups appear for staff +$hide_sql = ( $userdata['user_level'] != USER ) ? '' : ' AND g.group_type <> ' . GROUP_HIDDEN; + +// Execute the select query +$sql = 'SELECT g.*, u.user_id, u.username, u.user_website FROM ' . USERS_TABLE . ' u, ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug + WHERE u.user_id = ug.user_id + AND ug.group_id = g.group_id + AND g.group_single_user = 0 + ' . $hide_sql . ' + ORDER BY g.group_name ASC'; +if ( ! $result = $db->sql_query($sql) ) +{ + // Error handling + print_r($db->sql_error()); + die(); +} + +// Simple Colored Usergroups Integration +if ( is_array ( $color_groups['groupdata'] ) ) +{ + $group_colors = array(); + while ( list ( $group_id , $group_data ) = @each ( $color_groups['groupdata'] ) ) + { + if ( ! $userdata['session_logged_in'] ) + { + $group_colors[$group_id] = $group_data['group_color'][ $board_config['default_style'] ]; + } + else + { + $group_colors[$group_id] = $group_data['group_color'][ $userdata['user_style'] ]; + } + if ( ! $group_color ) + { + $match_found = false; + while ( list($key, $color) = @each($group_data['group_color']) ) + { + if ( ! $match_found ) + { + if ( $color ) + { + $group_colors[$group_id] = $color; + $match_found = true; + } + } + } + } + } + + $scu_installed = true; +} + +// Put all the data into an array +while ( $row = $db->sql_fetchrow($result) ) +{ + $group_data[ $row['group_id'] ][] = $row; +} + +// Loop through the groups (While loops are faster than foreach) +while ( list ( $key, $group_array ) = @each ( $group_data ) ) +{ + if ( sizeof ( $group_array ) ) + { + // Assign the main template switch + $template->assign_block_vars('group', array( + 'GROUP_ID' => $key, + 'GROUP_NAME' => $group_array[0]['group_name'], + 'S_COLOR' => ( $scu_installed && $group_colors[ $group_array[0]['group_id'] ] ) ? ' style="color: ' . $group_colors[ $group_array[0]['group_id'] ] . '"' : '', + )); + + // Loop through the group members + for ( $i = 0 ; $i < sizeof ( $group_array ) ; $i++ ) + { + // Set a shorter variable for easier coding + $row = $group_array[$i]; + + // SCU Integration + $user_color = ( $scu_installed && $group_colors[ $row['group_id'] ] ) ? ' style="color: ' . $group_colors[ $row['group_id'] ] . '"' : ''; + + // Private message button + $temp_url = append_sid("privmsg.$phpEx?mode=post&" . POST_USERS_URL . '=' . $row['user_id']); + $pm_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" border="0" /></a>'; + + // Website button + $www_img = ( $row['user_website'] ) ? '<a href="' . $row['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['Visit_website'] . '" title="' . $lang['Visit_website'] . '" border="0" /></a>' : ''; + + // User is the group moderator + if ( $row['group_moderator'] == $row['user_id'] ) + { + // Send group moderators data to template + $template->assign_block_vars('group.leader', array( + 'GROUP_NAME' => $row['group_name'], + 'USERNAME' => $row['username'], + 'USER_WEBSITE' => $www_img, + 'USER_PM' => $pm_img, + + 'S_COLOR' => $user_color, + 'U_PROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $row['user_id']), + )); + } + // User is just a member of the group + else + { + // Send group members data to template + $template->assign_block_vars('group.member', array( + 'USERNAME' => $row['username'], + 'USER_WEBSITE' => $www_img, + 'USER_PM' => $pm_img, + + 'S_COLOR' => $user_color, + 'U_PROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $row['user_id']), + )); + } + } + $is_data = true; + } +} + +// Make sure groups exist. +if ( ! isset ( $is_data ) ) +{ + message_die(GENERAL_MESSAGE, $lang['No_groups_exist']); +} + +// +// Generate the page +// +$template->pparse('body'); + +include($phpbb_root_path . 'includes/page_tail.'.$phpEx); + +?> \ No newline at end of file Added: GroupMembersPageMOD/upload/templates/subSilver/groups_list_body.tpl =================================================================== --- GroupMembersPageMOD/upload/templates/subSilver/groups_list_body.tpl (rev 0) +++ GroupMembersPageMOD/upload/templates/subSilver/groups_list_body.tpl 2006-07-02 02:28:28 UTC (rev 15) @@ -0,0 +1,56 @@ +<table width="100%" cellspacing="2" cellpadding="2" border="0"> + <tr> + <td align="left" valign="bottom" colspan="2"> + <span class="nav"><a class="nav" href="{U_INDEX}">{L_INDEX}</a> » <a class="nav" href="{U_GROUP_LIST}">{L_GROUP_LIST}</a></span> + </td> + </tr> +</table> + +<table width="100%" cellspacing="2" cellpadding="0" border="0" align="center"> + <tr> + <td width="200px" valign="top"> + <table width="100%" cellspacing="1" cellpadding="3" border="0" align="center" class="bodyline"> + <tr> + <th colspan="2">{L_GROUP_LIST}</th> + </tr> + <!-- BEGIN group --> + <tr> + <td class="row1" onmouseover="this.className='row2';" onmouseout="this.className='row1'"> + <span class="gensmall"><b>»</b> <a href="#g{group.GROUP_ID}" class="gensmall"{group.S_COLOR}>{group.GROUP_NAME}</a></span> + </td> + </tr> + <!-- END group --> + </table> + </td> + <td valign="top"> + <!-- BEGIN group --> + <a href="" name="g{group.GROUP_ID}"></a> + <table width="100%" cellspacing="1" cellpadding="3" border="0" align="center" class="bodyline"> + <!-- BEGIN leader --> + <tr> + <th colspan="2">{group.leader.GROUP_NAME}</th> + </tr> + <tr> + <td class="row3" valign="middle"> + <span class="topictitle" style="float:left"><a href="{group.leader.U_PROFILE}" class="topictitle"{group.leader.S_COLOR}>{group.leader.USERNAME}</a></span><span class="gensmall" style="float:left"> ({L_GROUP_MOD})</span> + <span class="topictitle" style="float:right">{group.leader.USER_WEBSITE} {group.leader.USER_PM}</span> + </td> + </tr> + <!-- END leader --> + <!-- BEGIN member --> + <tr> + <td class="row1" valign="middle" onmouseover="this.className='row2';" onmouseout="this.className='row1'"> + <span class="topictitle" style="float:left"><a href="{group.member.U_PROFILE}" class="topictitle"{group.member.S_COLOR}>{group.member.USERNAME}</a></span> + <span class="topictitle" style="float:right">{group.member.USER_WEBSITE} {group.member.USER_PM}</span> + </td> + </tr> + <!-- END member --> + </table> + <br /> + <!-- END group --> + </td> + </tr> +</table> +<div align="center"> + <span class="gensmall">{L_MOD_ABOUT_F}</span> +</div> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |