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
neralex
Site Admin



Joined: Aug 22, 2007
Posts: 1537

PostPosted: Thu Jun 21, 2012 2:10 pm Reply with quote

I am a little bit confused about this variable. Can everyone help to understand it?

Code:
$radminsuper = false;  // tried to dispense with this variable but it is just simpler to have it here once at the top

// than to be running is_mod_admin in a bunch of functions
if (is_mod_admin('admin')) {
   $radminsuper = true;
}


In some modules was the variable set with 1 in other is it a false/true response. What is now correct to use?

How can i make a difference between the superadmins and the mod_admins?

for example:

Code:
if ($radminsuper) {

   echo ' i am a superadmin';
} elseif (is_mod_admin('admin')) {
   echo 'i am a mod_admin';
}


Or must i create here an sql query in the authors table?


Last edited by neralex on Thu Jun 21, 2012 3:27 pm; edited 1 time in total 
View user's profile Send private message
neralex







PostPosted: Thu Jun 21, 2012 3:26 pm Reply with quote

ok i believe... i have found the solution

Code:
if (is_mod_admin('admin')) {

   echo ' i am a superadmin';
} elseif (is_mod_admin($module_name)) {
   echo 'i am a mod_admin';
}
 
fkelly
Former Moderator in Good Standing



Joined: Aug 30, 2005
Posts: 3312
Location: near Albany NY

PostPosted: Fri Jun 22, 2012 2:58 pm Reply with quote

Superadmin status can only be determined reliably by querying the authors table and looking at the tinyint(1) field named radminsuper. If the field has a value of 1, then the author_id (field name: aid) has radminsuper status. This is set when creating or editing admins and is only settable by the GOD admin for a system.

Module administrative status is determined from a comma delimited field named admins in the modules table. It too is set by the GOD admin when he creates or edits an admin. The is_mod_admin() function is a shortcut way to determine administrative status for a given module. It is not correct to use is_mod_admin('admin') to determine radminsuper status.

[editorial]using the comma delimited field "admin" in this fashion is nuts but we're stuck with it for now. I use nsngroups in modules that I write for my own site but for general use and backwards compatibility we're stuck with the admin field. [/editorial]

Either 1 or true/false should work if used consistently, just remember that the field is set to a value of 1 if it's true.
 
View user's profile Send private message Visit poster's website
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Sat Jun 23, 2012 8:40 am Reply with quote

Just so everyone is aware.

is_mod_admin('founder') = superadmin
is_mod_admin('admin') = admin
is_mod_admin('$mdoulename') = module admin

_________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. 
View user's profile Send private message
neralex







PostPosted: Sat Jun 23, 2012 11:30 am Reply with quote

yeah, thanks guys!!
 
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 ©