Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x
Author Message
Doulos
Life Cycles Becoming CPU Cycles



Joined: Jun 06, 2005
Posts: 732

PostPosted: Sat Apr 22, 2017 12:05 pm Reply with quote

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.
 
View user's profile Send private message
kguske
Site Admin



Joined: Jun 04, 2004
Posts: 6433

PostPosted: Sun Apr 23, 2017 6:58 am Reply with quote

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
 
View user's profile Send private message
Doulos







PostPosted: Sun Apr 23, 2017 10:57 am Reply with quote

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







PostPosted: Sun Apr 23, 2017 2:03 pm Reply with quote

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







PostPosted: Sun Apr 23, 2017 3:17 pm Reply with quote

OK, thanks. I will look at that.
 
neralex
Site Admin



Joined: Aug 22, 2007
Posts: 1774

PostPosted: Sun Apr 23, 2017 4:28 pm Reply with quote

Quick and dirty without styles and without translation but I guess you are able to add it. Very Happy
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>'
,'&nbsp;<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&amp;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 '&nbsp;&nbsp;- <span class="italic">' . _EXPIRES . ' ' . date('d F Y', $edate) . '</span>';
} else {
echo '&nbsp;&nbsp;- <span class="italic">' . _NOTSET . '</span>';
}
if ($muid == $uid) {
echo '&nbsp;(' , _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 
View user's profile Send private message
Doulos







PostPosted: Mon Apr 24, 2017 4:48 am Reply with quote

I will try that when I get a change - hopefully soon.
 
Doulos







PostPosted: Tue Apr 25, 2017 4:43 am Reply with quote

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 ''&nbsp;<input value="Submit" t' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ';' in /home/****/public_html/modules/Groups/admin/NSNGroupsUsersGroups.php on line 21
 
neralex







PostPosted: Tue Apr 25, 2017 8:10 am Reply with quote

Fixed and tweaked! Copy & paste it again.
 
Doulos







PostPosted: Tue Apr 25, 2017 2:33 pm Reply with quote

Works perfect. Thanks.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©