Author |
Message |
Doulos
Life Cycles Becoming CPU Cycles
Joined: Jun 06, 2005
Posts: 732
|
Posted:
Sat Apr 22, 2017 12:05 pm |
|
Is there an easy way to see what groups a user is in? I am interested in finding a solution to looking through each groups members to find out if an admin has already added them to the group. |
|
|
|
|
kguske
Site Admin
Joined: Jun 04, 2004
Posts: 6433
|
Posted:
Sun Apr 23, 2017 6:58 am |
|
Doulos, adding a group memberships to the user profile sounds like a good idea for an enhancement, at least for admins.
The Groups, View Users page (/admin.php?op=NSNGroupsUsersView) shows all members of all groups sorted by user, and allows filtering by group.
That provides more than what you need, but is probably the best approach for now. |
_________________ I search, therefore I exist...
nukeSEO - nukeFEED - nukePIE - nukeSPAM - nukeWYSIWYG |
|
|
|
Doulos
|
Posted:
Sun Apr 23, 2017 10:57 am |
|
OK, thanks. That is what I have been doing. I just wanted to not have to find the user name in the list of group members. I found a phpbb3 hack that is supposed to do what I want but I haven't tried it yet to see if it is compatible. |
|
|
|
|
kguske
|
Posted:
Sun Apr 23, 2017 2:03 pm |
|
The user can see his group membership on the Your_Account page, so it shouldn't be hard to make that visible to admins in the user administration function. |
|
|
|
|
Doulos
|
Posted:
Sun Apr 23, 2017 3:17 pm |
|
OK, thanks. I will look at that. |
|
|
|
|
neralex
Site Admin
Joined: Aug 22, 2007
Posts: 1774
|
Posted:
Sun Apr 23, 2017 4:28 pm |
|
Quick and dirty without styles and without translation but I guess you are able to add it.
Please test it with a new group and some users because maybe it needs more tweaks, filterings etc.
open /modules/Groups/includes/nsngr_module_func.php and find:
php Code:echo '<a href="' . $admin_file . '.php?op=NSNGroupsUsersView">' . _GR_GROUPSUSERSVIEW . '</a> (' . $usrnum . ')<br />';
|
add after:
php Code:echo '<a href="' . $admin_file . '.php?op=NSNGroupsUsersGroups">User\'s Groups</a><br />';
|
open /modules/Groups/admin/case.php and find:
php Code:case 'NSNGroupsView':
|
add after:
php Code:case 'NSNGroupsUsersGroups':
|
open /modules/Groups/admin/index.php and find:
php Code: case 'NSNGroupsView':
include_once ('modules/Groups/admin/NSNGroupsView.php');
break;
|
add after:
php Code: case 'NSNGroupsUsersGroups':
include_once ('modules/Groups/admin/NSNGroupsUsersGroups.php');
break;
|
go to /modules/Groups/admin/ and create a php-file with the name: NSNGroupsUsersGroups.php
open this file and use this:
php Code:<?php
if (!defined('ADMIN_FILE') || !defined('RN_GROUPS')) {
die ('Access Denied');
}
if(!isset($op)) $op = '';
if(!isset($yauserid)) $yauserid = '';
if(is_mod_admin($module_name)) {
$result = $db->sql_query('SELECT * FROM `'.$user_prefix.'_users` WHERE `user_level` > \'0\' AND `user_id` > \'1\'');
include_once('header.php');
NSNGroupsAdmin();
OpenTable();
echo '<form action="' , $admin_file , '.php" method="post">'
,'<input type="hidden" name="op" value="' , $op , '" />';
if($db->sql_numrows($result) > 0) {
echo '<select name="yauserid" id="yauserid">';
while ($yauser = $db->sql_fetchrow($result)) {
echo '<option value="' , $yauser['user_id'] , '"' , ($yauser['user_id'] == $yauserid ? ' selected="selected"' : '') , '>' , $yauser['username'] , '</option>';
} # end of while
echo '</select>'
,' <input value="Submit" type="submit" /><br />';
} else {
echo '<div class="text-center">Nothing found!</div>';
}
echo '</form><br /><br />';
# Group Memberships
if (is_numeric($yauserid) && $yauserid > 1) {
csrf_check();
$result11 = $db->sql_query('SELECT g.`gid`, g.`gname`, g.`muid`, u.`uid` FROM `' . $prefix . '_nsngr_users` u LEFT JOIN `' . $prefix . '_nsngr_groups` g ON g.`gid` = u.`gid` WHERE u.`uid` = \'' . $yauserid . '\' ORDER BY g.`gid`');
if (($db->sql_numrows($result11) > 0)) {
$nameqry = $db->sql_query('SELECT `username` FROM `'.$user_prefix.'_users` WHERE `user_id` = \'' . $yauserid . '\'');
list($username) = $db->sql_fetchrow($nameqry);
echo '<strong>' . $username . '\'s ' . _MEMBERGROUPS . ':</strong><ul>';
while (list($gid, $gname, $muid, $uid) = $db->sql_fetchrow($result11)) {
list($gname) = $db->sql_fetchrow($db->sql_query('SELECT `gname` FROM `' . $prefix . '_nsngr_groups` WHERE `gid` = \'' . $gid . '\''));
echo '<li><a href="' , $admin_file , '.php?op=NSNGroupsUsersAdd&gid=' , $gid , '">' , $gname , ' (' , $gid , ')</a>';
list($edate) = $db->sql_fetchrow($db->sql_query('SELECT `edate` FROM `' . $prefix . '_nsngr_users` WHERE `uid` = \'' . $yauserid . '\' AND `gid` = \'' . $gid . '\''));
if ($edate != 0) {
echo ' - <span class="italic">' . _EXPIRES . ' ' . date('d F Y', $edate) . '</span>';
} else {
echo ' - <span class="italic">' . _NOTSET . '</span>';
}
if ($muid == $uid) {
echo ' (' , _GR_BBMODERATOR , ')';
}
echo '</li>';
} #end of while
echo '</ul>';
} else {
echo '<div class="text-center">Nothing found!</div>';
}
}
CloseTable();
include_once('footer.php');
}
|
Save all affected files. |
Last edited by neralex on Tue Apr 25, 2017 10:53 pm; edited 7 times in total |
|
|
|
Doulos
|
Posted:
Mon Apr 24, 2017 4:48 am |
|
I will try that when I get a change - hopefully soon. |
|
|
|
|
Doulos
|
Posted:
Tue Apr 25, 2017 4:43 am |
|
Thanks for you time in this (again) neralax, but I am getting the following error:Quote: | [25-Apr-2017 05:42:09 America/Chicago] PHP Parse error: syntax error, unexpected '' <input value="Submit" t' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ';' in /home/****/public_html/modules/Groups/admin/NSNGroupsUsersGroups.php on line 21 |
|
|
|
|
|
neralex
|
Posted:
Tue Apr 25, 2017 8:10 am |
|
Fixed and tweaked! Copy & paste it again. |
|
|
|
|
Doulos
|
Posted:
Tue Apr 25, 2017 2:33 pm |
|
|
|
|
|