MyBB Community Forums

Full Version: need code for show time here
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
good evening everybody
[Image: last_time_online.jpg]
look at the pic. how can we show last time online in reputation below thanks
thanks for replying but when user
Is online its showing online i want user online or offline it show always last time in this location
OK, then open the file postbit_lastactive.php from /inc/plugins/ in editor (eg.: Notepad++), search for:
$lang->load("postbit_lastactive");
if($post['lastvisit'] == $post['lastactive'] && (is_member($mybb->settings['pla_groupselect']) || $mybb->settings['pla_groupselect'] == "-1"))
{
	if(empty($mybb->settings['pla_timeformat']))
	{
		$mybb->settings['pla_timeformat'] = "relative";
	}
	$lastactivetime = my_date($mybb->settings['pla_timeformat'], $post['lastactive']);
	$postlastactive = '<br />'.$lang->sprintf($db->escape_string($lang->pla_lastactive), $lastactivetime);
}
elseif($post['lastvisit'] != $post['lastactive'] && (is_member($mybb->settings['pla_groupselect']) || $mybb->settings['pla_groupselect'] == "-1") && $mybb->settings['pla_showonlinestatus'] == "1")
{
	$onlinetextstring = empty($mybb->settings['pla_onlinestatus_text']) ? 'Online' : $mybb->settings['pla_onlinestatus_text'];
	$onlinecssstyle = '';
	if(!empty($mybb->settings['pla_onlinestatus_style']))
	{
		$onlinecssstylesheet = preg_replace("%(\r\n)|(\r)%", "", $mybb->settings['pla_onlinestatus_style']);
		$onlinecssstyle = 'style="'.$onlinecssstylesheet.'"';
	}			
	$postlastactive = '<br /><span '.$onlinecssstyle.'>'.$onlinetextstring.'</span>';
}
else
{
	$postlastactive = '';
}

and replace all with:
$lang->load("postbit_lastactive");
$postlastactive = '';
if(is_member($mybb->settings['pla_groupselect']) || $mybb->settings['pla_groupselect'] == "-1")
{
	if(empty($mybb->settings['pla_timeformat']))
	{
		$mybb->settings['pla_timeformat'] = "relative";
	}
	$lastactivetime = my_date($mybb->settings['pla_timeformat'], $post['lastactive']);
	$postlastactive = '<br />'.$lang->sprintf($db->escape_string($lang->pla_lastactive), $lastactivetime);
}
thanks sir problem solved
Nevermind
very good i have installed this plugin but space is coming in my forum
[Image: zlast_time_online.jpg]
WHEN I CHECK THIS THROUGH inspect element its showing <br>
when i removed <br> through inspect element then space removed
how can i change in plugin
You can remove the "<br />" in main plugin file from PHP variable $postlastactive

Change:
$postlastactive = '<br />'.$lang->sprintf($db->escape_string($lang->pla_lastactive), $lastactivetime);
and
$postlastactive = '<br /><span '.$onlinecssstyle.'>'.$onlinetextstring.'</span>';

To:
$postlastactive = $lang->sprintf($db->escape_string($lang->pla_lastactive), $lastactivetime);
and
$postlastactive = '<span '.$onlinecssstyle.'>'.$onlinetextstring.'</span>';
yes working perfect space removed thanks  mr SvePu
You're welcome!