FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » FudAPI Examples
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: FudAPI Examples [message #34246 is a reply to message #19431] Mon, 16 October 2006 04:15 Go to previous messageGo to previous message
DaveQB is currently offline  DaveQB   Australia
Messages: 109
Registered: January 2006
Location: Sydney
Karma:
Senior Member

Got something and posting what I found for any other newbies, like me, that might be following this thread.

I created this script.

<?php

include("/full/path/to/this/file/fudapi.inc.php");

$ret = fud_fetch_online_users();
print_r($ret);
echo "\n\n";

print "$ret->alias\n";

?>



The print_r($ret);

returns:

stdClass Object
(   
    [id] => 2
    [alias] => DaveQB
    [time_sec] => 1160962637
    [private] => 0
)                               



while the print "$ret->alias";
returns the username

DaveQB


Thats with someone logged on.
With no one online you simply get


Array                                                                                                              
(                                                                                                                  
)                                                                                                                  
                                                                                                                   
                                                                                                                   
PHP Notice:  Trying to get property of non-object in /home/wspirates/domains/forums.wspirates.com/public_html/users
.php on line 9                                                                                                     


And line 9 contains the printing of the alias var in the object $ret. So one needs to check if the object is created [that there is someone online] before you start using values from the object created.

Hope that helps someone.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Deleting Moderation Queue
Next Topic: integration with a cms (the user database) possible?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 05:47:56 GMT 2024

Total time taken to generate the page: 0.04018 seconds