Hi there i have site which i am trying to configure so it shows links to the forums e.g new threads newest registered member ect. I already have the code for the newest forum threads implemented but I'm stuck on displaying the newest registered member so any help or sample code would be greatly appreciated. Also i apologize if this has been asked before.
Cheers
Killy
I will provide you with 2 ways, 1 totaly independent from MyBB system, The other in case you have your external page as part of MyBB (Included global.php)
1- Independent script
<?php
//Connect to mybb db
mysql_connect("localhost", "username", "password") or die("Could not connect to MySQL");
mysql_select_db("db_username") or die("Could not connect to MySQL");
$query = mysql_query("SELECT uid, username FROM mybb_users ORDER BY regdate DESC LIMIT 0,1");
$user = mysql_fetch_array($query);
$newest_member = "<a href=\"/forums/member.php?action=profile&uid={$user['uid']}\">{$user['username']}</a>";
echo $newest_member;
?>
You need to change few things in the connect and select db function.
2- Case of the page is a part of MyBB
All you need is this code
if(!$stats['lastusername'])
{
$newestmember = "no-one";
}
else
{
$newestmember = build_profile_link($stats['lastusername'], $stats['lastuid']);
}
thanks that worked a treat. Thank you for the quick response as well