miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /  
 

Usergroups

 
Author _Marco
Partaker
#1 | Posted: 11 Feb 2006 00:48 
I have a wish...

When your forum is growing, the administration of bb_specials.php gets more and more complex. It's easy to forget something or make an error.
A benefit of having usergroups would be that you can add a group of people to a forum (or make them a moderator) by simply adding them to a group.

The way I imagine this could work is:

$userRanks=array(1,2,3,4,5,6,7,8,9)

$urGroup1=array('$urGroup2',5,6,9) // my members
$urGroup2=array(1,2,3) // my moderators

$clForums=array(1,2);

$clForumsUsers[1]=array('$urGroup1',7,8);
$clForumsUsers[2]=array('$urGroup1',4);

$mods=array(
1=>array('$urGroup2',6),
2=>array('$urGroup2'),
);


This is not real code (coz I can't write that) but just a suggestion about how it could work.
When you ad a user to a group, he also gets the access just like other group-members.

Could this be possible?

_Marco

Author Team
8-)
#2 | Posted: 13 Feb 2006 09:50 
I think, there is nothing special to implement this as new feature (and totally complicate already overcomplicated miniBB). You already can have such kind of groups and make additional coding in the same bb_specials.php file, if necessary, using basic array merging functions.

For example:

$urGroup1=array(1,2,3); // my moderators
$urGroup2=array_merge($urGroup1,array(5,6,9)); // my members

$clForums=array(1,2);

$clForumsUsers[1]=array_merge($urGroup1,array(7,8));
$clForumsUsers[2]=array_merge($urGroup2,array(4));

Author _Marco
Partaker
#3 | Posted: 13 Feb 2006 16:42 
Thank you! I did not know about the basic array merging functions.
Gonna give it a try soo.

Thanx!

_Marco

Author _Marco
Partaker
#4 | Posted: 13 Feb 2006 22:22 
It's working, but I found 2 little things that don't do it the way I want.

If I use this function for moderators, I get "errors in line 11 and 49 of bb_func_vforum.php". (so I don't use that)

In the "About User" screen, under User Activities, only public forums are shown and not private forums that this person has access to.

Don't know if this is worth looking into.

_Marco

Author Team
8-)
#5 | Posted: 13 Feb 2006 22:52 
Until you provide your existing code snippet, we can not say anything precisely.

Author _Marco
Partaker
#6 | Posted: 14 Feb 2006 16:51 
This is my code:

// OHRJ Leden
$urGroup1=array(2,3,4,5,7,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24 ,31,34,52);
// OHRJ Moderators
$urGroup2=array(2,3,5,7);
// Web members
$urGroup3=array_merge($urGroup2,array(4,10,20,23,52));
// Lopers
$urGroup4=array_merge($urGroup1,array(33,42,43,44,45,46,49,51));

$mods=array(
3=>array($urGroup2),
4=>array($urGroup2),
7=>array($urGroup2),
8=>array_merge($urGroup2,array(17))
);

$clForums=array(4,7,8,9,10);
$clForumsUsers[4]=array($urGroup1);
$clForumsUsers[7]=array($urGroup3);
$clForumsUsers[8]=array($urGroup2);
$clForumsUsers[9]=array(1);
$clForumsUsers[10]=array(1);


_Marco

Author lime
Partaker
#7 | Posted: 14 Feb 2006 17:45 
I think it should be:

$clForums=array(4,7,8,9,10);
$clForumsUsers[4]=$urGroup1;
$clForumsUsers[7]=$urGroup3;
$clForumsUsers[8]=$urGroup2;

$clForumsUsers[9]=array(1);
$clForumsUsers[10]=array(1);


since $urGroup1, $urGroup2, $urGroup3 are already arrays but I'm not sure if this is where you're getting your errors from it doesn't look like line 11 or 49

Author Team
8-)
#8 | Posted: 15 Feb 2006 09:35 
Yes, lime is right. Marco - try his fix.

P.S. Sorry, I've deleted previous messages - I had complete mess in my head yesterday ;-)

Author _Marco
Partaker
#9 | Posted: 22 Feb 2006 22:42 
lime
Thank you. This solved my issue with the "About User" screen (private forums postcount).

I also solved the issue for moderators:

$mods=array(
3=>array_merge($urGroup2,array(2)),
4=>$urGroup2,
7=>$urGroup2,
8=>$urGroup2,
11=>array(2),
);

$clForums=array(4,7,8,9,10);
$clForumsUsers[4]=array_merge($urGroup2,array(2));
$clForumsUsers[7]=$urGroup3;
$clForumsUsers[8]=$urGroup2;
$clForumsUsers[9]=array(1);
$clForumsUsers[10]=array(1);

Thanks,

_Marco

Author Dare
Guest
#10 | Posted: 3 Dec 2006 01:12 
I have installed to my forum this system, but i have a question: how to the certain group to make the status? for example:

$userRanks=array( $urGroup2 => 'Guard');

Author Paul
Lead Developer 
#11 | Posted: 3 Dec 2006 09:25 
foreach($urGroup2 as $key=>$val) $userRanks[$key]='Guard';

Author littlefixit
Partaker
#12 | Posted: 25 Jan 2007 09:18 
Here's a question: Is there any way to use get this information from a database, and then put it into the arrays that way? For Example:

// BEGIN EXAMPLE CODING //

include 'opendb.php';

$query='SELECT users FROM users WHERE rank=1';
$query2='SELECT users FROM users WHERE rank=2';
/*
[in this example, 'users' represents whatever users table being utilized in the database, and 'rank' represents whatever condition to be met.]
*/

$result=mysql_query($query);
$result2=mysql_query($query2);

include closedb.php;

// Somehow inject the contents of the $result into the bb_special.php code:

$clForums=array(1,2);
$clForumsUsers[1]=$result;
$clForumsUsers[2]=$result2;

// END CODE //

? I understand that my SQL syntax is likely to be laughable, and I apologize. But my real questions are as follows:

1. What needs to be 'included' (i.e. include opendb.php) in order to connect to a database without errors on the bb_specials.php page, if at all possible?

2. How would one (or what PHP command) is used to convert the result of the SQL query into an array that can be used as in the above examples (the individuals using the '$urGroup' methods)?

3. If it is impossible to connect to the database via the bb_specials.php page, on which page do the 'connect to database' statements need to be placed in order to pass the relevant database information to this page?

I would GREATLY appreciate any insights you have on this (these) matters, and will understand if I am asking too much.
Thank you for your time,
-littlefixit

Author Paul
Lead Developer 
#13 | Posted: 25 Jan 2007 10:38 
1. What needs to be 'included' (i.e. include opendb.php) in order to connect to a database without errors on the bb_specials.php page, if at all possible?

1. Nothing. miniBB connects to the database once per session (once per opening any forum section), connection string is in setup_mysql.php. Most likely you need to use the same connection.

2. How would one (or what PHP command) is used to convert the result of the SQL query into an array that can be used as in the above examples (the individuals using the '$urGroup' methods)?

I think you need just to get the data once, like...

$sqlgroups=array();
if($row=db_simpleSelect(0, $Tu, 'user_rank, user_id', 'user_rank', '>', 0)){
do{
$sqlgroups[$row[0]][]=$user_id;
}
while(if($row=db_simpleSelect(1));
}

so finally you will have $sqlgroups[1], $sqlgroups[2] etc.

Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /
 Usergroups
 Share Topic's Link

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


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Check out the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑