Recent Users List 1.2.4 SP1.1, 1.2, 1.3 This mod adds a list of the x most recent visitors, optionally with their avatars, to the right of the info centre on the board index. It is intended to add a little colour and sense of community to your board. It works with SP1.1, SP1.2 and SP1.3. You can see examples of the various output styles at: http://www.badpoo.co.uk/ronnie/images/examples/rul_full.gif http://www.badpoo.co.uk/ronnie/images/examples/rul_resized.gif http://www.badpoo.co.uk/ronnie/images/examples/rul_no_avatars.gif After installing the mod and uploading, you must set the options through the usual preferences page. FEATURES: - The list outputs the most recent visitor first, descending to the last visitor. - Avatars can be disabled, shown resized to a height/width/height and width you specify or shown at normal size. - Avatars can be resized down on the fly to avoid ugly layouts when large avatars get on the list. - Avatars can link to the View Profile or IM Send pages, or not link at all. - A user will never appear twice in the list - for example, if they're currently fourth in the list then they log in again, they'll zoom to the top of the list and the other entries will be pushed down to make way. - Indicates if the user is online now. - Compatible with the following mods: New Calendar by Ironwing, GauGau, & Nermware; Calendar by Matthew Throesch; MSN Messenger by Omario; YaBB Chat! for YaBB Gold SP1 by _Max, Omario, Samm; Top Threads by CoolMan25; Forum Staff Info by BHRA Webmaster; Countdown by Matthew Throesch. CHANGES IN V1.2.4: - Added compatibility with the Calendar mod by Matthew Throesch, Top Threads mod by CoolMan25, Forum Staff Info by BHRA Webmaster and Countdown by Matthew Throesch. KNOWN PROBLEM: - The javascript code used to resize avatars has some kind of bug that sometimes causes resized avatars to show as tiny 1x1 pixel images. If you reload the page or go to another page then come back in your history to it, the avatars then show correctly. This definitely happens on IE5 onwards - not sure about other browsers/versions. I don't know why this happens. If it becomes a major problem to you then the only option is to disable resizing (set the width and height to 0 in preferences) which will stop YaBB using javascript to display the avatars. Karma to BHRA Webmaster and his smart_resize.mod code which is used in this mod. Ronnie http://www.badpoo.co.uk/ronnie/pages/yabbmods.shtml Sources/BoardIndex.pl sub BoardIndex { #RECENT USERS LIST MOD START if ($username ne 'Guest') { require "$sourcedir/LogInOut.pl"; &RecentUsersList; } #RECENT USERS LIST MOD END $curforumurl = $curposlinks ? qq~$mbname~ : $mbname; #RECENT MEMBERS MOD START if ($rul_show_avatars && ($rul_avatar_width || $rul_avatar_height)) { $yymain .= qq~ ~; } #RECENT MEMBERS MOD END } $yymain .= qq~

} #set the correct rowspan for the recent users list main cell #this setting works with the standard yabb info centre (rowspan 6 for guests, 4 when logged in) $rul_rowspan = ($username eq 'Guest') ? 6 : 4; #the following add-on compatibility settings aren't guaranteed to work because most of these mods don't have specific settings to let us know whether anything has been added to the info centre #the compromise is to check if a variable used by these mods exists, and if so presume the mod has been added to the info centre #compatibility with the New Calendar mod by Ironwing, GauGau, & Nermware if ($newcalspread || $newcalindexmini) { $rul_rowspan += 2; } #compatibility with the Calendar mod by Matthew Throesch if ($calindex == 1) { $rul_rowspan += 2; } #compatibility with the MSN Messenger mod by Omario if (-e("$imagesdir/msn.gif")) { $rul_rowspan += 2; } #compatibility with the Top Threads mod by CoolMan25 if ($tttxt{'01'}) { $rul_rowspan += 2; } #compatibility with the Forum Staff Info mod by BHRA Webmaster if ($forum_staff) { $rul_rowspan += 2; } #compatibility with the Countdown mod by Matthew Throesch if (-e("$vardir/countdown.txt")) { $rul_rowspan += 2; } #compatibility with the YaBB Chat! for YaBB Gold SP1 mod by _Max, Omario, Samm if (-e("$vardir/ChatSettings.txt")) { require "$vardir/ChatSettings.txt"; chomp $chatgroup; @chatgrouplist = split(",",$chatgroup); $chatgroupflag = 0; foreach $chatgroupitem (@chatgrouplist) { if ($settings[7] eq $chatgroupitem) { $chatgroupflag = 1; } } if ($chatopen == 1 || $chatgroupflag == 1 || ($chatopen == 0 && $settings[7] eq 'Administrator')) { $rul_rowspan += 2; } } $yymain .= qq~

$txt{'685'} ~; $yymain .= qq~ $txt{'200'} $txt{'685'} $rul_users_display $lud_txt{'1'} ~; $yymain .= qq~ $txt{'200'} ~; &RecentUsersListShow; $yymain .= qq~ sub MarkAllRead { #RECENT USERS LIST #v1.2.4 #OUTPUTS A TABLE WITH $rul_users_display ROWS - ONE FOR EACH USER IN THE LIST sub RecentUsersListShow { fopen(FILE, "$vardir/lastuseronline.txt"); @lastusers = ; fclose(FILE); chomp @lastusers; $counter = 1; $yymain .= qq~~; foreach $lastuser_line (@lastusers) { ($last_username, $last_userwhen) = split(/\|/, $lastuser_line); #is this user online now? $online_now = ($users =~ /username=$last_username"/) ? "
$lud_txt{'2'}" : ''; #it should never happen, but a Guest entry might have been stored in the file. this avoids showing it if (fopen(MFILE, "$memberdir/$last_username.dat")) { @memberinfo = ; fclose(MFILE); chomp @memberinfo; $last_userwhen = &timeformat($last_userwhen) || $last_userwhen; #do we want to show an avatar? if ($rul_show_avatars) { #correct url allowing for custom avatars if ($memberinfo[13] =~ m~\Ahttp://~) { $avatar = $memberinfo[13]; } else { $avatar = $facesurl . '/' . $memberinfo[13]; } #is resizing enabled or shall we just show a plain image tag? #if we're using avatar resizing if ($rul_avatar_width || $rul_avatar_height) { #decide what the avatar link should be if ($rul_avatar_link == 2) { $avatars_cell = qq~~; } elsif ($rul_avatar_link == 1) { $avatars_cell = qq~~; } else { $avatars_cell = qq~~; } } #else we're not using resizing so just use the normal image tag else { #decide what the avatar link should be if ($rul_avatar_link == 2) { $avatars_cell = qq~~; } elsif ($rul_avatar_link == 1) { $avatars_cell = qq~~; } else { $avatars_cell = qq~~; } } } #else we're not showing avatars, so just show the text counter else { $avatars_cell = qq~~; } #output this row $yymain .= qq~$avatars_cell~; } $counter++; } $yymain .= qq~
\n\n\n\n\n\n$lud_txt{'12'} $memberinfo[1]$lud_txt{'13'} $memberinfo[1]$memberinfo[1]$counter.
$memberinfo[1]
$last_userwhen$online_now
~; }
Sources/LogInOut.pl $yySetCookies1 = cookie(-name => "$cookieusername", -value => "$username", -path => "/", -expires => "$ck{'len'}"); #RECENT USERS LIST MOD START if ($username ne 'Guest') { &RecentUsersList; } #RECENT USERS LIST MOD END $yySetCookies1 = cookie(-name => "$cookieusername", -value => "", -path => "/", -expires => "Thursday, 01-Jan-1970 00:00:00 GMT"); #RECENT USERS LIST MOD START if ($username ne 'Guest') { &RecentUsersList; } #RECENT USERS LIST MOD END sub sharedLogin { #RECENT USERS LIST #v1.2.4 #ORGANISES AND UPDATES THE lastuseronline.txt FILE CONTAINING THE LAST $rul_users_display USERS ONLINE sub RecentUsersList { #how many users to store on file $rul_users_display = $rul_users_display || 5; $display = $rul_users_display - 1;#to take into account we're dealing with [0] $user_in_file = 0; fopen(LUO, "$vardir/lastuseronline.txt"); @lastusers = ; fclose(LUO); #see if there are redundant entries in the file that we don't currently want with $display #old entries appear after reducing $display e.g. from 7 to 5 - first time this code run after reducing there would be 2 unwanted entries in @lastusers $lastusers_count = scalar(@lastusers) - 1; if ($lastusers_count > $display) { for ($r = $lastusers_count; $r > $display; $r--) { pop(@lastusers); } } #check if this user already has an entry in the log for ($i = $display; $i >= 0; $i--) { ($this_username, $junk) = split(/\|/, $lastusers[$i]); if ($this_username eq $username) { $user_in_file = 1; last; } } #arrange file depending whether this user is already in it if (! $user_in_file) { #shift each of the other entries back for ($z = $display; $z > 0; $z--) { $lastusers[$z] = $lastusers[$z - 1]; } #insert this user at the top of the file $lastusers[0] = qq~$username|$date\n~; } #else they are in the file else { #first, check it's not just [0], which we can replace easily if ($i == 0) { #insert this user at the top of the file $lastusers[0] = qq~$username|$date\n~; } #no, it's not [0], so we've got to shift the others around else { #set that line to be the one above it e.g. [2] is replaced by contents of [1] for ($k = $i; $k > 0; $k--) { $lastusers[$k] = $lastusers[$k - 1]; } #insert this user at the top of the file $lastusers[0] = qq~$username|$date\n~; } } #write to file fopen(LUO, ">$vardir/lastuseronline.txt"); print LUO @lastusers; fclose(LUO); } Sources/AdminEdit.pl # figure out what to print if ($rul_users_display eq '') { $rul_users_display = 5; } if ($rul_avatar_width eq '') { $rul_avatar_width = 0; } if ($rul_avatar_height eq '') { $rul_avatar_height = 0; } if ($rul_show_avatars) { $rul_show_avatars_checked = ' checked'; } if ($rul_avatar_link == 2) { $rul_avatar_link_selected2 = ' selected'; } elsif ($rul_avatar_link == 1) { $rul_avatar_link_selected1 = ' selected'; } else { $rul_avatar_link_selected0 = ' selected'; } $txt{'478'}
$lud_txt{'3'} $lud_txt{'4'} $lud_txt{'8'} $lud_txt{'7'} $lud_txt{'5'} $lud_txt{'6'}
# Set as 0 or 1 if box was checked or not my $fi; push(@onoff, "rul_show_avatars"); # If empty fields are submitted, set them to default-values to save yabb from crashing #recent users list settings $rul_avatar_link = $FORM{'rul_avatar_link'} || 0; $rul_avatar_width = $FORM{'rul_avatar_width'} || 0; $rul_avatar_height = $FORM{'rul_avatar_height'} || 0; $rul_users_display = $FORM{'rul_users_display'} || 5; if ($rul_users_display > 99) { $rul_users_display = 99; } \$timeout = $timeout; # Minimum time between 2 postings from the same IP #RECENT USERS LIST \$rul_show_avatars = $rul_show_avatars; #$lud_txt{'4'} \$rul_avatar_link = $rul_avatar_link; #$lud_txt{'8'} \$rul_avatar_width = $rul_avatar_width; #$lud_txt{'5'} \$rul_avatar_height = $rul_avatar_height; #$lud_txt{'6'} \$rul_users_display = $rul_users_display; #$lud_txt{'3'} english.lng 1; $lud_txt{'1'} = 'Most Recent Visitors'; $lud_txt{'2'} = 'Online now'; $lud_txt{'3'} = 'Number of recent users to show on board index'; $lud_txt{'4'} = 'Show avatars in list?'; $lud_txt{'5'} = 'Avatar resizing - maximum width in pixels (0 to disable)'; $lud_txt{'6'} = 'Avatar resizing - maximum height in pixels (0 to disable)'; $lud_txt{'7'} = 'Note on avatar resizing - it is best to set only one of the following values, normally the width. This allows the avatars to be kept in proportion after being resized. If you set both, the avatar will be forced to that size.'; $lud_txt{'8'} = 'What should the avatars link to?'; $lud_txt{'9'} = 'No link'; $lud_txt{'10'} = 'View profile'; $lud_txt{'11'} = 'IM send'; $lud_txt{'12'} = 'Send Instant Message to'; $lud_txt{'13'} = 'View Profile of';