Ning Developer Docs

I recently developed a pretty simple hack to track online users on a Ning site with very little overhead. I've attached the two files needed. Once loaded and hooked up properly you can get info anytime--very useful from your smartphone for example. It's fun to see how many people just joined your network while out at dinner or a movie, say.

Place XG_Online.php in /lib.
Place InfoController.php in /widgets/admin/controllers.

To track online users, you need to add the following PHP code to the end of your footer.php file (just before </body>). This call is meant to be extremely lightweight:

XG_App::includeFileOnce('/lib/XG_Online.php'); XG_Online::userOnline();

From your browser, enter these addresses to get real-time info:

http://sitename.ning.com/admin/info/dash (for dashboard)
http://sitename.ning.com/admin/info/online (for online users)

With this core online function, you could build a widget that displays online users graphically. I just haven't gotten around to it yet to add it here.

Reply to this post if you have questions.

Enjoy!

Views: 16

Attachments:

Replies are closed for this discussion.

Replies to This Discussion

Ted,
I'd love to see what you've done with this.
We've done some basic stats for our site, but haven't added any code to show how many users are on the site at any given time.
Hi Dayne, just attached the two files you can add to your site.
Anjo, when I click your link I get "page doesn't exist". There is no check for login in the script, so not sure why you are seeing the form. If you login, do you see the dashboard?
having some problems
i created both files and added the code to footer.php file

http://blingmy.ning.com/admin/info/dash

http://blingmy.ning.com/admin/info/online
Sorry, sounds like this version of code doesn't automatically create the directory for tracking online users. You need to create the folder /xn_private/xn_volatile/onlineusers/ in your tree. I should upload a newer version. So little time...
That sounds good ted... thanks where waiting for newer version
You have to have your site code to do this right? I am not brave enough to do that.

It would be very helpful to see "who's online" and be able to track member activity.

Sandy
Hi TED great job, dashboard working perfectly but for online users i have the following fatal error :

Fatal error: Class 'FB_Utils' not found in /sitename/widgets/admin/controllers/InfoController.php on line 53

can you help me to sort out this

Thanks

JEF
Hi Ted
you say :
"To track online users, you need to add the following PHP code to the end of your footer.php file (just before). This call is meant to be extremely lightweight:
XG_App::includeFileOnce('/lib/XG_Online.php'); XG_Online::userOnline();"

But which footer file and which repository ??

Dashboard working perfectly but online user have the following error :

Fatal error: Class 'FB_Utils' not found in /sitename/widgets/admin/controllers/InfoController.php on line 53

Do you have an issue to solve this ?

Thanks

JEF
I've got the same problem:

Fatal error: Class 'FB_Utils' not found in /apps/centralcoasttoday/widgets/admin/controllers/InfoController.php on line 53

Thanks!
Sorry everyone about the typo, also about taking so long to fix this. Download the revised InfoController.php file and reinstall. It should work now. FB_Utils.php was a former file/class name which is now XG_Online.php. Enjoy.
Thanks a million for posting this Ted, is there a way to make it work without source code?

All I want is a page that any user can access that shows all their online friends - which bit of the code do I need?

RSS

© 2026   Created by Ning Developer Admin.   Powered by

Badges  |  Report an Issue  |  Terms of Service