vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   $usergroup[admin] and $usergroup[moderator] (https://vborg.vbsupport.ru/showthread.php?t=46696)

flup 12-15-2002 04:26 PM

$usergroup[admin] and $usergroup[moderator]
 
Are these the strings to show for example all the admins?

Xenon 12-15-2002 04:46 PM

nope

you have to use getpermissions function and then you can ask for those things:

PHP Code:

$perm getpermission();
if(
$perm['ismoderator']) echo "supermod";
if(
$perm['cancontrolpanel']) echo "admin"


flup 12-15-2002 04:50 PM

Ok, thx

flup 12-15-2002 04:52 PM

But, this will show all moderators or administrators?

Xenon 12-15-2002 04:57 PM

no, if you want to show all moderators or admin you have to use DB-queries:

PHP Code:

$admins=$DB_site->query("SELECT username, userid FROM user, usergroup WHERE user.usergroupid=usergroup.usergroupid AND usergroup.cancontrolpanel=1");
$adminnames="";
while(
$admin=$DB_site->fetch_array($admins)) {
  
$adminnames.=$admin[username]." ";


then you have a lisdt of all admin-names in $adminnames

flup 12-15-2002 04:59 PM

I get a DB error when I do:
<?php
The code you gave
?>

flup 12-15-2002 05:13 PM

Have tried alot, won't get it working

Xenon 12-15-2002 05:19 PM

have you required global.php?

it won't work without....

flup 12-15-2002 05:30 PM

It's IN global.php :)

Xenon 12-15-2002 08:59 PM

IN global.php????

what will you do? *gg*

be sure it's AFTER the requirement of db_mysql.php and there is already a connection to the db

flup 12-16-2002 01:50 PM

Yub IN global.php (forum/ADMIN/global.php)

I want to show all moderators and administrators under login screen. It's for my: Userinfo @ CP Login HACK.
This is an addon for it

Xenon 12-16-2002 02:25 PM

i've edited the code a bit, try it again now.

be sure you put it BEHIND that line :)
// end init db

flup 12-16-2002 02:39 PM

Ok, Will try thiz code

flup 12-16-2002 02:40 PM

Parse error: parse error in /home/joshua/www/forum/admin/global.php on line 122

Fatal error: Call to undefined function: adminlog() in /home/joshua/www/forum/admin/index.php on line 7


Added the code (with <?php and ?> in before and after) before // end init db.

This error, will try it without <?php


===============================
Without page is working but noting is showed :(

flup 12-16-2002 02:44 PM

oops :D added it BEFORE // end init db

LoL sorry :D

=======================
edit in the code, with <?php tags cauz else it would be normal text. But noting is shown, DB error is gone now (had a DB error with 1st code)

Xenon 12-16-2002 02:45 PM

of course it would show nothing

add echo $adminnames; after the whileloop.

<? ?> within a php block isn't allowed

flup 12-16-2002 02:49 PM

Ok, thx, getting a bit know with PHP now :D

flup 12-16-2002 02:50 PM

Thx it's working!!!

For moderators al: "admin" would be replaced with: "mod"
Or with "supermod" (or moderator) ?

Xenon 12-16-2002 02:57 PM

for supermoderators replace all admin with supermod and the cancontrolpanel=1 with ismoderator=1.

for normal moderators, you have to use another query...

flup 12-16-2002 02:59 PM

Ok, thx Bro

flup 12-16-2002 03:03 PM

That would become:

Code:

<?php
$supermods=$DB_site->query("SELECT username, userid FROM user, usergroup WHERE user.usergroupid=usergroup.usergroupid AND usergroup.ismoderator=1");
$supermodnames="";
while($supermod=$DB_site->fetch_array($supermod)) {
  $supermodnames.=$supermod[username]." ";
}
?>
<?php echo $supermodnames ?>


flup 12-16-2002 03:18 PM

But that ain't working

Xenon 12-16-2002 03:40 PM

of course,
you have misspelled something:
while($supermod=$DB_site->fetch_array($supermods)) {

you've forgotten the s

flup 12-16-2002 03:41 PM

Ok, thx, ++++ happens :D

Xenon 12-16-2002 03:44 PM

np

you're welcome

flup 12-16-2002 03:47 PM

You're Credits will be add to my: Admin CP userinfo hack


All times are GMT. The time now is 12:21 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01955 seconds
  • Memory Usage 1,753KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (26)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete