Forums

Unfortunately no one can be told what FluxBB is - you have to see it for yourself.

You are not logged in.

#1 2014-02-05 06:18:24

Different55
Member
Registered: 2011-11-18
Posts: 173

Members Online Today

Link to mod page

Here's another short mod that adds a list of the users that have logged in today to the bottom of the index page. It was originally made for PunBB and was posted on PunRes.net, but I changed some things to make it work with 1.5.6. Since there are no files to upload, I've included the readme here:

##
##
##         Mod title: 	Members Online Today
##
##      Mod version: 	1.2
##  Works on FluxBB: 	1.5.6
##     Release date: 	Released on PunRes.net on 6/09/2006, and on FluxBB.org on 2/04/2014
##           Author: 	Vincent Garnier aka vin100 (vin100@forx.fr) Ported to FluxBB by Jarom Ort aka Different55 (jdiff55@gmail.com)
##
##      Description: 	This mod displays a list of the members who logged in today on the index.
##
##   Affected files: 	index.php
##                      lang/english/index.php
## 
##       Affects DB: 	No
##
##            Notes:	Initial port to FluxBB 1.5.6. Probably works on other FluxBB 1.5.* versions with little to no modification.
##
##       DISCLAIMER:  	Please note that "mods" are not officially supported by
##                    	PunBB. Installation of this modification is done at your
##                    	own risk. Backup your forum database and any and all
##                    	applicable files before proceeding.
##
##
##
#
#-------------[ 1. OPEN ]----------------
#
	index.php
#
#-------------[ 2. FIND ]----
#
	$num_users = count($users);
#
#-------------[ 3. AFTER, ADD ]----------------
#
	// users online today 
$result = $db->query("SELECT username, id, last_visit from ".$db->prefix."users WHERE last_visit >= '".strtotime('today')."' ORDER by last_visit DESC") or error("Unable to find the list of the users online today", __FILE__, __LINE__, $db->error());

	$users_today = array();
	while ($pun_user_online_today = $db->fetch_assoc($result))
		$users_today[] .=  "\n\t\t\t\t".'<dd style="display:inline"><a href="profile.php?id='.$pun_user_online_today['id'].'" title="Last visit of '.$pun_user_online_today['username'].' : '.format_time($pun_user_online_today['last_visit']).'">'.$pun_user_online_today['username'].'</a>';
		
	$num_users_today = count($users_today);
#
#-------------[ 4. FIND ]----
#
	echo "\t\t\t\t".'<dd><span>'.sprintf($lang_index['Users online'], '<strong>'.forum_number_format($num_users).'</strong>').'</span></dd>'."\n\t\t\t\t".'<dd><span>'.sprintf($lang_index['Guests online'], '<strong>'.forum_number_format($num_guests).'</strong>').'</span></dd>'."\n\t\t\t".'</dl>'."\n";

#
#-------------[ 5. REPLACE WITH ]--------------
#
	echo "\t\t\t\t".'<dd><span>'.sprintf($lang_index['Users online'], '<strong>'.forum_number_format($num_users).'</strong>').'</span></dd>'."\n\t\t\t\t".'<dd><span>'.sprintf($lang_index['Guests online'], '<strong>'.forum_number_format($num_guests).'</strong>').'</span></dd>'."\n\t\t\t".'<dd><span>'.sprintf($lang_index['Users today'], '<strong>'.forum_number_format($num_users_today).'</strong>').'</span></dd>'."\n\t\t\t".'</dl>'."\n";

#
#-------------[ 6. FIND ]----
#
	if ($num_users > 0)
		echo "\t\t\t".'<dl id="onlinelist" class="clearb">'."\n\t\t\t\t".'<dt><strong>'.$lang_index['Online'].' </strong></dt>'."\t\t\t\t".implode(',</dd> ', $users).'</dd>'."\n\t\t\t".'</dl>'."\n";
	else
		echo "\t\t\t".'<div class="clearer"></div>'."\n";
#
#-------------[ 7. AFTER, ADD ]----------------
#
// list users on line today
    echo "\t\t\t".'<dl id="onlinetodaylist">'."\n\t\t\t\t".'<dt><strong>'.$lang_index['Online today'].': </strong></dt>';
                
    if ($num_users_today > 0) 
        echo implode(',</dd> ', $users_today).'</dd>'."\n\t\t\t".'</dl>'."\n";
    else
        echo '<dd><em></em></dd>'."\n\t\t\t".'</dl>'."\n";
#
#-------------[ 8. OPEN ]----------------
#
	lang/english/index.php
#
#-------------[ 9. FIND (line: 4)]----
#
	$lang_index = array(
#
#-------------[ 10. AFTER, ADD ]----------------
#
'Online today'	=>	'Online today',
'Users today'	=>	'Registered users today: %s',
#
#-------------[ 11. SAVE, UPLOAD ]-----------------------
#

Last edited by Different55 (2014-02-05 06:19:18)

Offline

Board footer

Powered by FluxBB 1.5.8