Hack Forums
[MyBB] [Plugin] Thread Results Online Status - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Webmasters (https://hackforums.net/forumdisplay.php?fid=141)
+---- Forum: Website Construction (https://hackforums.net/forumdisplay.php?fid=50)
+---- Thread: [MyBB] [Plugin] Thread Results Online Status (/showthread.php?tid=5367455)



[Plugin] Thread Results Online Status - Xerotic - Aug 8, 2016

Greetings! Today I present a plugin created for MyBB software that was inspired by this thread: https://hackforums.net/showthread.php?tid=5363460

Essentially this plugin will allow you to easily view if a member is online while you are browsing forums (forumdisplay.php).

[Image: 4K73lne.png]

The green circle is the default online color and the gray circle is the default offline color. I have opted not to include the "away" status.


Installation

Installation is very simple.
  • Create the file: inc/plugins/tr_online_status.php
    • Be sure to create the file in the plugins directory!
  • Fill the newly created file with the following code (pastebin embed):
    Spoiler (Click to View)
  • Active the plugin via the plugin manager in AdminCP.

inc/plugins/tr_online_status.php and activate the plugin (Thread Results Online Status) in the plugin manager.

Only one template edit is made.

template name: forumdisplay_thread
before: {$thread['profilelink']}
after: {$thread['online_status']}{$thread['profilelink']}

The function uses two hooks and NO additional queries are made. The first hook alters the $ratingadd variable to include u.lastvisit, u.lastactive, u.invisible to be grabbed when querying for the list of forum threads. The second hook processes the online status of the user and displays either online or offline icon.

To change the color of the online/offline icons, simply change the color values for these two variables in the plugin code:

Code
$online_color = "#32CD32";
$offline_color = "#666666";

The current colors are designed for a dark theme.

SOURCE CODE (pastebin embed):
Spoiler (Click to View)

Enjoy!


* - TheChiеf - Aug 8, 2016

This seems cool af to me. Could you possibly make it a userscript?


* - Stag - Aug 8, 2016

Very nice man :) Awesome to see how quick you did this


* - Xerotic - Aug 8, 2016

(Aug 8, 2016 04:08 AM)Stag Wrote:  Very nice man :) Awesome to see how quick you did this

Thanks! Fortunately I have experience creating MyBB plugins so it was quick and easy work here. I would definitely love to see something like this on HF. 👹


* - Undefined - Aug 10, 2016

Please make this into an userscript. I'd love to see it.


* - Junx - Aug 11, 2016

Adding this but editing it to font awesome. Thanks for this!