Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

List Group Membership

Asked Modified Viewed 4,667 times
A
afoster
A
  • Senior Member, joined since
  • Contributed 725 posts on the community forums.
  • Started 128 threads in the forums
  • Started this discussions
asked
Senior Member

I'm trying to find some code that will list what group(s) each member is in without having to log in to check the admin panel. I know the group_id for each group, but when looking at the group participation in the users table, it is listed as .1 for group_id 1 .3 for group_id 3 etc

Does anyone have code that would take the group_id and match the .1 and list the member and group name?

I hope that is clear for you all.
0 replies

8 posts

C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

afoster, do you mean like that?

http://www.phpfusionmods.co.uk/forum/viewthread.php?thread_id=638&rowstart=0#post_4803

Or there is getgroupname() function which you can use like..

getgroupname(1);

1 being group id = 1


That what you mean? Any help?
0 replies
A
afoster
A
  • Senior Member, joined since
  • Contributed 725 posts on the community forums.
  • Started 128 threads in the forums
  • Started this discussions
answered
Senior Member

Thanks for the quick response. That is a start...what I would like is to be able to see what groups each member belongs to like:

username Groups

afoster Team A, Team B, Misc

The groups could also be listed one below the other although that would take up more space as:

afoster Team A
Team B
Misc

Don't know if that is possible though

It might be better to have them displayed in columns with the group names in the header of each column and the members in each group listed below the header?
0 replies
P
PolarFox
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
answered
Veteran Member

Don't know but maybe:
// Compile access levels & user group array
function getusergroups() {

or
// Get the name of the access level or user group
function getgroupname($group_id, $return_desc = false) {


Search core func or others:
http://www.php-fusion.co.uk/infusions...-functions
Edited by PolarFox on 25-01-2014 00:04,
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Quote

afoster wrote:

Thanks for the quick response. That is a start...what I would like is to be able to see what groups each member belongs to like:

username Groups

afoster Team A, Team B, Misc

The groups could also be listed one below the other although that would take up more space as:

afoster Team A
Team B
Misc

Don't know if that is possible though

It might be better to have them displayed in columns with the group names in the header of each column and the members in each group listed below the header?



members.php does that. It displays username and groups they are in? You could work with that?
0 replies
A
afoster
A
  • Senior Member, joined since
  • Contributed 725 posts on the community forums.
  • Started 128 threads in the forums
  • Started this discussions
answered
Senior Member

@PolarFox, would I place that code in a panel's openside() closeside()?

A@Jib, I'm sure you're right however my php coding is very limited. I am trying to figure out the code that Craig posted below the one you led me to in your initial post to see if I can adapt that to what I want, so far have not been able to. I will keep trying. Thanks to you both for your response.
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

members.php with only the things you want.

<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright (C) 2002 - 2011 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: members.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "maincore.php";
require_once THEMES."templates/header.php";
include LOCALE.LOCALESET."members.php";

add_to_title($locale['global_200'].$locale['400']);

opentable($locale['400']);

      if (!isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) { $_GET['rowstart'] = 0; }
   $rows = dbcount("(user_id)", DB_USERS." WHERE user_status='0'");

   if ($rows) {
      $i = 0;
      echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";
      echo "<td class='tbl2'><strong>".$locale['401']."</strong></td>\n";
      echo "<td class='tbl2'><strong>".$locale['405']."</strong></td>\n";
      echo "</tr>\n";
      $result = dbquery("SELECT user_id, user_name, user_status, user_level, user_groups FROM ".DB_USERS." WHERE user_status='0' ORDER BY user_level DESC, user_name LIMIT ".$_GET['rowstart'].",20");
      while ($data = dbarray($result)) {
         $cell_color = ($i % 2 == 0 ? "tbl1" : "tbl2"); $i++;
         echo "<tr>\n<td class='$cell_color'>\n".profile_link($data['user_id'], $data['user_name'], $data['user_status'])."</td>\n";
         $groups = "";
         $user_groups = explode(".", $data['user_groups']);
         $j = 0;
         foreach ($user_groups as $key => $value) {
            if ($value) {
               $groups .= "<a href='profile.php?group_id=".$value."'>".getgroupname($value)."</a>".($j < count($user_groups)-1 ? ", " : "");
            }
            $j++;
         }
         echo "<td class='$cell_color'>\n".($groups ? $groups : ($data['user_level'] == 103 ? $locale['407'] : $locale['406']))."</td></tr>\n";

      }
      echo "</table>\n";
   } else {
      echo "<div style='text-align:center'><br />\nNothing<br /><br />\n</div>\n";
   }
   
   echo "</tr>\n</table>\n";

closetable();
if ($rows > 20) { echo "<div align='center' style='margin-top:5px;'>".makepagenav($_GET['rowstart'],20,$rows,3,FUSION_SELF."?")."</div>\n"; }

require_once THEMES."templates/footer.php";
?>
0 replies
A
afoster
A
  • Senior Member, joined since
  • Contributed 725 posts on the community forums.
  • Started 128 threads in the forums
  • Started this discussions
answered
Senior Member

Thanks, I appreciate your help on this and I learned some more php.
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

No problem, always happy to help. :)
0 replies

Category Forum

User Administration - 8

Labels

None yet

Statistics

  • Views 0 views
  • Posts 8 posts
  • Votes 0 votes
  • Topic users 3 members

3 participants

C
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
A
A
  • Senior Member, joined since
  • Contributed 725 posts on the community forums.
  • Started 128 threads in the forums
  • Started this discussions
P
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet