MyBB Community Forums

Full Version: memberlist to website
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

I would like to have page that list my gid 9 users (main and additional).
How can I get it without mybb user control = I want to list those in our web site. I just need usernames, nothing else.

like this:
user1
user2
user3
etc...

another columns maybe later but for now this would do great.

Any ideas how would I do this?

Ok.. answering to myself .. here is how to do it:

include("../secretfolder/mybb.php");   /* use your own connection string here example $db = new mysqli('localhost', 'user', 'pass', 'demo'); */

if($db->connect_errno > 0){
    die('Unable to connect to database [' . $db->connect_error . ']');
}

$sql = <<<SQL
SELECT * FROM `your_mybb_users` WHERE `usergroup` = 9 OR `additionalgroups` = 9 ORDER BY `username` ASC 
SQL;

if(!$result = $db->query($sql)){
    die('There was an error running the query [' . $db->error . ']');
}

while($row = $result->fetch_assoc()){

print $row['username'] . '<br />';

}