15 years on The Web
miniBB ® miniBB®
miniBB Support Forums
 | Forums | Register | Reply | Search | Statistics | Manual |
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /   

Simple array for all moderators in all forums ($mods)

Author tom322
Active Member
#1 | Posted: 14 Apr 2011 09:29 | Edited by: tom322 
In bb_specials.php I have this array of mods:

$mods=array(1=>array(2,3,4,5),2=>array(2,3,4,5),71=>array(2,3,4,5),3=>array(2,3,4,5),4=>array(2,3,4,5),5=>array(2,3,4,5) , 6=>array(2,3,4,5),7=>array(2,3,4,5),8=>array(2,3,4,5),9=>array(2,3,4,5),41=>array(2,3,4,5),42=>array(2,3,4,5),14=>array( 2,3,4,5),8=>array(2,3,4,5),17=>array(2,3,4,5),23=>array(2,3,4,5),18=>array(2,3,4,5),47=>array(2,3,4,5),43=>array(2,3,4,5 ),24=>array(2,3,4,5),28=>array(2,3,4,5),29=>array(2,3,4,5),30=>array(2,3,4,5),31=>array(2,3,4,5),32=>array(2,3,4,5),33=> array(2,3,4,5),34=>array(2,3,4,5),35=>array(2,3,4,5),36=>array(2,3,4,5),55=>array(2,3,4,5), 46=>array(2,3,4,5),38=>array(2,3,4,5),68=>array(2,3,4,5),69=>array(2,3,4,5));

That means that all moderators can moderate all forums. Is there a simpler way to write this array? Thank you.


PS> Nevermind, I think I found most of the answers here: Usergroups

Author myBTBdb
#2 | Posted: 15 Apr 2011 04:09 
$mods = array();
$forumCount = mysql_query("SELECT forum_id FROM minibbtable35_forums");
while($row=mysql_fetch_array($forumCount)) {
$id = $row['forum_id'];
$mods[$id] = array(7,23,31);

This is how I do it :)

Author tom322
Active Member
#3 | Posted: 15 Apr 2011 09:05 
Well, I like it because it's short but I'm not sure if doing a database query is not too complex for this task. I think some smart array (merge) should work faster ;)

Author Paul
Lead Developer
#4 | Posted: 18 Apr 2011 05:08 
The code provided by myBTBdb above just automates the process. Whenever you add a new forum, the list of moderators is automatically expanded to this forum. If you have a lot of forums, let's say 100, it would bring some comfort. It's an easy mySQL query - I think in terms of resources it is almost nothing to for the database. But in some aspects it could brings an additional load to the server.

Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications / Simple array for all moderators in all forums ($mods) Top

Your Reply Click this icon to move up to the quoted message

 Short link for this topic:

You are welcome to post anonymously, by entering a nickname with no password (if the similar Username has not been taken yet), or by leaving both fields empty. If you have a forums account, you can also sign in from this page without posting a message, or sign in and post at once.

Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.
miniBB Support Forums Powered by Forum Software miniBB ® Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contacts
Proceed with the Captcha add-on: protect your miniBB-forums from the automated spam and flood.
Captcha Addon for miniBB