MyBB Community Forums

Full Version: Profile Visitors (like IPB last guests)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Feel free to code your own plugin... thats all. It is for free, so dont be moron
Version 1.9.0
* Fix installation (MySQL 5.6+ compatibility)
* Removed "Thanks" code
Lightbulb 
In the profileVisitors.tpl.php we can add:

        self::$tpl[] = array(
            "title" => 'profileVisitors_Disabled',
            "template" => $db->escape_string('<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
	<tr>
		<td class="thead"><strong>{$lang->profileVisitorsTitle}</strong></td>
	</tr>
	<tr>
		<td class="{$bgcolor} smalltext" style="text-align: center; font-style: italic">The recent visitors block is disabled and is not being shown to other users.</td>
	</tr>
</table>'),
            "sid" => "-1",
            "version" => "1.0",
            "dateline" => TIME_NOW,
        );

Then in profileVisitors.php we can

replace:
        // Something to do?
        if (!$memprofile['show_profile_visitors'] || !$num_visitors) {
            return;
        }

with:
        // Something to do?
        if (!$num_visitors) {
            return;
        }

replace:
        // Display table
        $profileVisitorsList = '';
        foreach ($visitors as $visitor) { 
            $visitor['username'] = format_name($visitor['username'], $visitor['usergroup'], $visitor['displaygroup']);
    		$visitor['profilelink'] = build_profile_link($visitor['username'], $visitor['uid']);
            $visitor['date'] = my_date('relative', $visitor['datestamp']);
			$avatar = format_avatar(htmlspecialchars_uni($visitor['avatar']), $visitor['avatardimensions'], my_strtolower(self::getConfig('AvatarWidth')));
            $bgcolor = alt_trow();
            eval("\$profileVisitorsList .= \"" . $templates->get("profileVisitors_Row") . "\";");	
        }
        eval("\$profileVisitors = \"" . $templates->get("profileVisitors") . "\";"); 

with:
        // Display table
        if (!$memprofile['show_profile_visitors']) {
			eval("\$profileVisitors = \"" . $templates->get("profileVisitors_Disabled") . "\";");
		} else {	
			$profileVisitorsList = '';
			foreach ($visitors as $visitor) { 
				$visitor['username'] = format_name($visitor['username'], $visitor['usergroup'], $visitor['displaygroup']);
				$visitor['profilelink'] = build_profile_link($visitor['username'], $visitor['uid']);
				$visitor['date'] = my_date('relative', $visitor['datestamp']);
				$avatar = format_avatar(htmlspecialchars_uni($visitor['avatar']), $visitor['avatardimensions'], my_strtolower(self::getConfig('AvatarWidth')));
				eval("\$profileVisitorsList .= \"" . $templates->get("profileVisitors_Row") . "\";");	
			}
			eval("\$profileVisitors = \"" . $templates->get("profileVisitors") . "\";"); 
		} 

Result:
[Image: Screenshot-from-2019-07-11-04-13-05.png]
Pages: 1 2 3