2010-10-16, 10:32 PM
Hello everyone,
I have a mod installed called "Last Visits" this make it possible to see the 10 last visits on your profile.
I have 2 questions for this mod.
Question 1:
How can I edit the name of the mod so that there is not showing on the forum last visits but the last 10 visits.
Question 2:
The option is showing up on the bottom of the page on the right, how can I fix this that this will shows on the left side of the profile page??
here is the code of the mod:
Thanks for helping me with this!!
I have a mod installed called "Last Visits" this make it possible to see the 10 last visits on your profile.
I have 2 questions for this mod.
Question 1:
How can I edit the name of the mod so that there is not showing on the forum last visits but the last 10 visits.
Question 2:
The option is showing up on the bottom of the page on the right, how can I fix this that this will shows on the left side of the profile page??
here is the code of the mod:
Quote:<?php
//*************************************//
//*************************************//
//*********** Last Visitors ************//
//*************************************//
//*************************************//
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
$plugins->add_hook("member_profile_end", "lastvisitors_profile");
function lastvisitors_info()
{
return array('name' => 'Last Visitors in Profile',
'description' => 'Add a Box in Users Profiles with Last 10 Users Have Visit It',
'website' => '',
'author' => 'LLNN',
'authorsite' => '',
'version' => '1.1',
'compatibility' => '1*',
'guid' => '9e2233dc1d258ae05ecba084c4b0dda6'
);
}
function lastvisitors_activate()
{
global $mybb, $db, $templates;
require MYBB_ROOT.'/inc/adminfunctions_templates.php';
$sql ="CREATE TABLE".TABLE_PREFIX."lastvisitor
(
uid
VARCHAR( 10 ) NOT NULL ,
vid
VARCHAR( 10 ) NOT NULL ,
time
VARCHAR( 50 ) NOT NULL
) ENGINE = MYISAM ;";
$db->write_query($sql);
$template1 = array("title" => "userprofile_lastvisit",
"template" => "<br />
<table border=\"0\" cellspacing=\"{\$theme\[\'borderwidth\'\]}\" cellpadding=\"{\$theme\[\'tablespace\'\]}\" class=\"tborder\">
<tr>
<td colspan=\"2\" class=\"thead\"><strong>Last Visits</strong></td>
<tr>
<td class=\"trow1\">{\$lastvisitor}</td>
</tr>
</tr>
</tr>
</table>","sid" => -1);
$db->insert_query("templates", $template1);
find_replace_templatesets('member_profile', '#{\$modoptions}#', "{\$modoptions}
{\$last_visit}");
}
function lastvisitors_deactivate()
{
global $mybb, $db, $templates;
$sql ="DROP TABLEmybb_lastvisitor
;";
$db->write_query($sql);
require MYBB_ROOT.'/inc/adminfunctions_templates.php';
find_replace_templatesets('member_profile', '#\{\$last_visit\}#', '', 0);
$db->delete_query("templates","title IN('userprofile_lastvisit')");
}
function lastvisitors_profile(){
global $mybb, $db, $templates, $theme, $lastvisitor, $memprofile, $last_visit ;
$myuid = $memprofile['uid'];
$vuid = $mybb->user['uid'];
$query = $db->simple_select('lastvisitor', '*', "uid='".$myuid."' and vid='".$vuid."'");
$nr = $db->num_rows($query);
IF($vuid != "0" and $vuid != $myuid ){
$tt = time();
IF($nr<1){
$db->write_query("INSERT INTO".TABLE_PREFIX."lastvisitor
VALUES ('$myuid', '$vuid','$tt')");
}else{
$db->update_query("lastvisitor", array('time' => $tt), "uid='".$myuid."' and vid='".$vuid."'");
}
}
$query = $db->query('SELECT * FROM ' . TABLE_PREFIX . 'lastvisitor,' . TABLE_PREFIX . 'users WHERE ' . TABLE_PREFIX . 'users.uid=' . TABLE_PREFIX . 'lastvisitor.vid AND ' . TABLE_PREFIX . 'lastvisitor.uid='.$myuid.' ORDER BY ' . TABLE_PREFIX . 'lastvisitor.time DESC LIMIT 10;');
while($row = $db->fetch_array($query)){
$u = $row['vid'];
$un = get_user($u);
if($un!=""){
$date = my_date($mybb->settings['dateformat'], $row['time']);
$time = my_date($mybb->settings['timeformat'], $row['time']);
$username = format_name($row['username'], $row['usergroup'], $row['displaygroup']);
$username = build_profile_link($username, $row['uid']);
$lastvisitor = $lastvisitor.$username."(".$date." - ".$time.") , ";
}
}
eval("\$last_visit = \"".$templates->get("userprofile_lastvisit")."\";");
}
?>
Thanks for helping me with this!!