Admin
09-16-2001, 10:00 PM
This was requested by David Copeland.
He wanted to be able to list all users that have or don't have access to a certain forum.
This is very very easy to install, you just need to add one block of code and a link! :)
Demo:
http://www.vbulletin.com/forum/attachment.php?s=&postid=172632
Install:
In user.php (admin folder), add this code:
echo "<li><a href=\"user.php?s=$session[sessionhash]&action=findaccess\">List by access masks</a></li>\n";
right after
echo "<li><a href=\"user.php?s=$session[sessionhash]&action=find\">List all users</a></li>\n";
Still in user.php, add this code:
// ###################### Start Find by Access #######################
if ($action=="dofindaccess") {
if ($checkaccess!="1" and $checkaccess!="0") {
$action = "findaccess";
} else {
$lists = $DB_site->query("SELECT * FROM access");
$inquery = "";
while ($list = $DB_site->fetch_array($lists)) {
if ($list[forumid]==$forumfrom and $list[accessmask]==$checkaccess) {
if ($inquery) {
$inquery .= ",";
}
$inquery .= "$list[userid]";
}
}
if ($inquery=="") {
echo "No users found.";
$action = "findaccess";
} else {
$users = $DB_site->query("SELECT userid,username,usergroupid,password,email,FROM_UN IXTIME(joindate) AS joindate,FROM_UNIXTIME(lastvisit) AS lastvisit,posts FROM user WHERE userid IN ($inquery)");
echo "<p>Click username to view forum profile.</p>";
doformheader("","");
echo "<tr class='tblhead'>";
echo "<td><p><b><span class='tblhead'>Name</span></b></p></td>";
echo "<td><p><b><span class='tblhead'>Options</span></b></p></td>";
echo "<td><p><b><span class='tblhead'>Email</span></b></p></td>";
echo "<td><p><b><span class='tblhead'>Password</span></b></p></td>";
echo "<td><p><b><span class='tblhead'>Join Date</span></b></p></td>";
echo "<td><p><b><span class='tblhead'>Last Visit</span></b></p></td>";
echo "<td><p><b><span class='tblhead'>Posts</span></b></p></td>";
echo "</tr>\n";
while ($user=$DB_site->fetch_array($users)) {
echo "<tr class='".getrowbg()."'>";
echo "<td><p><a href='../member.php?s=$session[sessionhash]&action=getinfo&userid=$user[userid]' target='_blank'>$user[username]</a> </p></td>";
echo "<td><p>".
makelinkcode("edit","user.php?s=$session[sessionhash]&action=edit&userid=$user[userid]").
makelinkcode("email password","user.php?s=$session[sessionhash]&action=emailpassword&email=$user[email]").
makelinkcode("remove","user.php?s=$session[sessionhash]&action=remove&userid=$user[userid]").
makelinkcode("edit access masks","user.php?s=$session[sessionhash]&action=editaccess&userid=$user[userid]").
"</p></td>";
echo "<td><p><a href='mailto:$user[email]'>$user[email]</a> </p></td>";
echo "<td><p>$user[password] </p></td>";
echo "<td><p>$user[joindate]</p></td>";
echo "<td><p>$user[lastvisit]</p></td>";
echo "<td><p>$user[posts]</p></td>";
echo "</tr>\n";
}
echo "</table></td></tr></table></form>";
}
}
}
// ###################### Start List by Access #######################
if ($action=="findaccess") {
doformheader("user","dofindaccess");
maketableheader("List Users by Access Masks","",0);
echo "<tr class='firstalt'><td colspan=2><p>Here you can list all users that match the settings you set below.</p></td></tr>\n";
maketableheader("Forum Select");
makeforumchoosercode("Forum you'd like to order by:",forumfrom);
makeyesnocode("Does the user has access to that forum?",checkaccess,"2");
echo "</p></td></tr>\n";
doformfooter("List users");
}
right before
cpfooter();
?>
The end.
See, I told you it's easy! :D
Now you have a link for this under Users => Find => List by access masks (under List all users).
By the way, I know that one part of the code there could be combined with the other search part, but this is just as good.
Sue me. ;) :p
Feedback please. :)
He wanted to be able to list all users that have or don't have access to a certain forum.
This is very very easy to install, you just need to add one block of code and a link! :)
Demo:
http://www.vbulletin.com/forum/attachment.php?s=&postid=172632
Install:
In user.php (admin folder), add this code:
echo "<li><a href=\"user.php?s=$session[sessionhash]&action=findaccess\">List by access masks</a></li>\n";
right after
echo "<li><a href=\"user.php?s=$session[sessionhash]&action=find\">List all users</a></li>\n";
Still in user.php, add this code:
// ###################### Start Find by Access #######################
if ($action=="dofindaccess") {
if ($checkaccess!="1" and $checkaccess!="0") {
$action = "findaccess";
} else {
$lists = $DB_site->query("SELECT * FROM access");
$inquery = "";
while ($list = $DB_site->fetch_array($lists)) {
if ($list[forumid]==$forumfrom and $list[accessmask]==$checkaccess) {
if ($inquery) {
$inquery .= ",";
}
$inquery .= "$list[userid]";
}
}
if ($inquery=="") {
echo "No users found.";
$action = "findaccess";
} else {
$users = $DB_site->query("SELECT userid,username,usergroupid,password,email,FROM_UN IXTIME(joindate) AS joindate,FROM_UNIXTIME(lastvisit) AS lastvisit,posts FROM user WHERE userid IN ($inquery)");
echo "<p>Click username to view forum profile.</p>";
doformheader("","");
echo "<tr class='tblhead'>";
echo "<td><p><b><span class='tblhead'>Name</span></b></p></td>";
echo "<td><p><b><span class='tblhead'>Options</span></b></p></td>";
echo "<td><p><b><span class='tblhead'>Email</span></b></p></td>";
echo "<td><p><b><span class='tblhead'>Password</span></b></p></td>";
echo "<td><p><b><span class='tblhead'>Join Date</span></b></p></td>";
echo "<td><p><b><span class='tblhead'>Last Visit</span></b></p></td>";
echo "<td><p><b><span class='tblhead'>Posts</span></b></p></td>";
echo "</tr>\n";
while ($user=$DB_site->fetch_array($users)) {
echo "<tr class='".getrowbg()."'>";
echo "<td><p><a href='../member.php?s=$session[sessionhash]&action=getinfo&userid=$user[userid]' target='_blank'>$user[username]</a> </p></td>";
echo "<td><p>".
makelinkcode("edit","user.php?s=$session[sessionhash]&action=edit&userid=$user[userid]").
makelinkcode("email password","user.php?s=$session[sessionhash]&action=emailpassword&email=$user[email]").
makelinkcode("remove","user.php?s=$session[sessionhash]&action=remove&userid=$user[userid]").
makelinkcode("edit access masks","user.php?s=$session[sessionhash]&action=editaccess&userid=$user[userid]").
"</p></td>";
echo "<td><p><a href='mailto:$user[email]'>$user[email]</a> </p></td>";
echo "<td><p>$user[password] </p></td>";
echo "<td><p>$user[joindate]</p></td>";
echo "<td><p>$user[lastvisit]</p></td>";
echo "<td><p>$user[posts]</p></td>";
echo "</tr>\n";
}
echo "</table></td></tr></table></form>";
}
}
}
// ###################### Start List by Access #######################
if ($action=="findaccess") {
doformheader("user","dofindaccess");
maketableheader("List Users by Access Masks","",0);
echo "<tr class='firstalt'><td colspan=2><p>Here you can list all users that match the settings you set below.</p></td></tr>\n";
maketableheader("Forum Select");
makeforumchoosercode("Forum you'd like to order by:",forumfrom);
makeyesnocode("Does the user has access to that forum?",checkaccess,"2");
echo "</p></td></tr>\n";
doformfooter("List users");
}
right before
cpfooter();
?>
The end.
See, I told you it's easy! :D
Now you have a link for this under Users => Find => List by access masks (under List all users).
By the way, I know that one part of the code there could be combined with the other search part, but this is just as good.
Sue me. ;) :p
Feedback please. :)