MyBB Community Forums

Full Version: Add counter for Buddy List - shows number of users who have added to their list
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Does anyone know if it's at all possible to add a counter to a users profile which shows the number of times that user has been added to other users buddy lists. If this is possible the counter would need to be accurate and also account for when users remove them from the buddy list.

I would be grateful to receive some views on this and if it could be possible or not.

Applogies if this is in the wrong forum section.

Thanks
Yep, you can do that with:

count();

if($mybb->user['buddylist'])
{
    $query = $db->simple_select('users', '*', "uid IN ({$mybb->user['buddylist']})");
    while($buddy = $db->fetch_array($query))
    {
        $buddy['username'] = htmlspecialchars_uni($buddy['username']);
        echo $buddy['username']."is my buddy!\n";
    }
$counted = count($buddy['username']);
echo "I also have a total of:  {$counted}.";
}
else
{
    echo "I have no buddies.\n";
} 
Wow I'm impressed this can be done i think this could be an amazing feature as it will show how popular a user is.

So this piece of code will add and subtract the number based on users adding and deleting a user from buddy lists.

Can this counter be displayed next to the button for adding a user to show how many buddy lists they are already in?

Thanks