Ning Developer Network

Ted Cohn

Determining Online Users and Dashboard

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!

Attachments:

Replies are closed for this discussion.

Replies to This Discussion

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?
Sorry, I'm not sure how to do this and really have no time to investigate. Cheers!
Thanks TED

Can you tell me in which footer.php i ahve to insert part of code beforeunable tio locate it. Can you give the full path thanks

JEF
/widgets/index/templates/embed/footer.php
Thanks

Great all working perfectly now

JEF
Reload InfoController.php - there was a another typo. Sorry, I just don't have time to retest this stuff!
thanks ted.
Attachments:
Hi Anjo

Have had the same problem instead upoading the new file in you directory use the old one an just replace the wrong insturction by the new one i.e.

$who = Fb_Utils::whosOnline();

by

$who = XG_Online::whosOnline();


and you wont have prob anymore hope for you you still have to former file.

JEF
Hi ted ! this is sound great, but how do i find the following directory

/lib.
/widgets/admin/controllers.

Thanks

Dave
Il faut être en code décentralisé et dans ce cas tu ne bénéficie plus des mises à jour du code ning -
  • 1
  • 2

RSS

Documentation & Tips

© 2008   Created by Ning Developer Admin

Badges  |  Report an Issue  |  Privacy  |  Terms of Service