I'll test this now, but it does look good, thanks :)![]()
This is a discussion on Uber/Phx Friends Online within the Habbo Releases forums, part of the Habbo Hotel category; Someone was messaging me on MSN asking whether I could create something to list all the friends online for Uber ...

Someone was messaging me on MSN asking whether I could create something to list all the friends online for Uber CMS (Uber or Phoenix database). So here is how I would do it:
Setup Instructions
Run the following query in the database of your server.
Go to your 'comp-me.tpl' and add the following piece of code within PHP tags at the top of the file.Code:DROP PROCEDURE IF EXISTS friends; DELIMITER // CREATE PROCEDURE friends(IN username VARCHAR(16), OUT friends TEXT) LANGUAGE SQL DETERMINISTIC SQL SECURITY DEFINER COMMENT 'Friends Online stored procedure for Uber and Phoenix created by Sniffy.' BEGIN DECLARE online_status VARCHAR(1); DECLARE message_nofriends VARCHAR(100); SET online_status = '1'; SET message_nofriends = 'You do not have any friends online.'; SELECT IFNULL(CONCAT(GROUP_CONCAT('<a href="#">', (SELECT u2.username FROM users u2 WHERE u2.id = mf.user_two_id AND u2.online = online_status LIMIT 0,1) SEPARATOR '</a>, <a href="#">'), '</a>.'), message_nofriends) INTO friends FROM users u1 INNER JOIN messenger_friendships mf ON mf.user_one_id = u1.id WHERE mf.user_one_id = (SELECT u3.id FROM users u3 WHERE u3.username = username LIMIT 0,1); END //
Then print the variable '$friends' where ever you would like in your 'comp-me.tpl' to display the user's friends that are online.PHP Code:$username = USER_NAME;
$result1 = mysql_query("CALL friends('{$username}', @friends);");
$result2 = mysql_query("SELECT @friends AS friends;");
$friends = mysql_fetch_object($result2)->friends;
Removal Instructions:
Run the following query in your database.
Remove the following code from 'comp-me.tpl'.Code:DROP PROCEDURE IF EXISTS friends;
Credits:PHP Code:$username = USER_NAME;
$result1 = mysql_query("CALL friends('{$username}', @friends);");
$result2 = mysql_query("SELECT @friends AS friends;");
$friends = mysql_fetch_object($result2)->friends;
- Sniffy.
I'll test this now, but it does look good, thanks :)![]()
Hope this works <3
Thankyou so much. Needing this for Ages :L
EDIT:
Worked like a charm . Thanks :D.
Last edited by zuc0001; 27-01-12 at 04:55 AM.
Kinda old but nice (Y)
Posted via Mobile Device
No problem gents! Glad you all are making use of this.
Looks nice, still you didn't explain wy inner join should be better then left join..
Look forward to an real explanation.
Posted via Mobile Device
@Hejula, I do not know you so I do not think I would of sent you code, let alone sent you code months ago that I created 2 days ago. Maybe you should post your code rather than accusing me of stealing yours so that we can compare. But of course if you are lying about created a script like this it is fine, no hard feelings. Just do not spam my release thread.
This is legit. Tried it on my retro, its PERFECT.
Thanks, I am really happy you are all enjoying this. It is encouraging me to expand on this.
This opens up a whole new world for me ....LOL
@leenster, no problem. Here to contribute!
Sniffy, I have a request (if possible :P)
If you're able to, would you be able to code a script so that it shows your unread minimail messages?
Because I am integrating minimail into the navigation bar at the top, and I would like it to show your unread messages.
I'm not the best PHP / SQL coder, so if you're able to do it, I would be grateful<3
EDIT:
So that it says like: Minimail (5)
5 = unread messages etc