2016-07-27, 09:40 AM
2016-07-27, 10:00 AM
<?php
define('IN_MYBB', 1);
define('THIS_SCRIPT', basename(__FILE__));
require_once './global.php';
// Read usergroup cache
$usergroupcache = $cache->read('usergroups');
// Usergroup array
$groups = array('4','3');
foreach($groups AS $validgroup)
{
print($usergroupcache[ $validgroup ]['title'].'<br />');
}
Image:
2016-07-27, 10:03 AM
They're in ACP : 1 - 7
2016-07-27, 10:07 AM
No, it's about php code for developement plugin.
2016-07-27, 10:13 AM
(2016-07-27, 10:07 AM)adi19 Wrote: [ -> ]No, it's about php code for developement plugin.
My code will print the usergroups name specified in the $groups array.
2016-07-27, 10:15 AM
My bad! Not get usergroup by id group.
Get usergroup by id user (uid).
I have a array with uid and I want usergroup id by uid.
Get usergroup by id user (uid).
I have a array with uid and I want usergroup id by uid.
2016-07-27, 10:21 AM
(2016-07-27, 10:15 AM)adi19 Wrote: [ -> ]My bad! Not get usergroup by id group.
Get usergroup by id user (uid).
I have a array with uid and I want usergroup id by uid.
Ah. You can use this!
<?php
define('IN_MYBB', 1);
define('THIS_SCRIPT', basename(__FILE__));
require_once './global.php';
$uids = array('1','2','3','330'); // UID Array
foreach($uids AS $uid)
{
$getinfo = get_user($uid);
$group = $getinfo['usergroup'];
print($group.'<br />');
}
2016-07-27, 10:25 AM
Hmm...yes, but I want a good complexity.
For good complexity, it's about query, but i dont know what is the query.
For good complexity, it's about query, but i dont know what is the query.
2016-07-27, 12:10 PM
The query is:
with mybb code:
SELECT usergroup FROM mybb_users WHERE uid = variable_uid
with mybb code:
$result = $db->simple_select("users", "usergroup", "uid = {$uid}");
if($db->num_rows > 0) {
$result = $db->fetch_array($result);
$usergroup = $result['usergroup'];
}
2016-07-27, 02:46 PM
Don't forget display_group and additional_groups!