Google+

Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[1.6.x] Last Visitors in Profile
#1
Acest plugin arata ultimii vizitatori in profil.

[Image: 27392-1274996072-mybb_print1_lv.JPG]
Am modificat lastvisitors.php astfel incat sa nu mai arate data la care s-au facut vizitele.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?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 TABLE `dava_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!=""){






$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")."\";"); 

}

?>



Attached Files
.zip   Last Visitors in Profile.zip (Size: 1.7 KB / Downloads: 24)
Reply
#2
Mie nu imi vede pluginu apare ca e avtivat , dau deactivate si da eroarea :

Quote:MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1051 - Unknown table 'mybb_lastvisitor'
Query:
DROP TABLE `mybb_lastvisitor`;

Please contact the MyBB Group for support.

Versiunea forumului e 1.6.5 probabil nu e compatibil cum as putea rezolva ?
Reply
#3
(12-01-2011, 11:28 PM)NuTzU Wrote: Mie nu imi vede pluginu apare ca e avtivat , dau deactivate si da eroarea :

Quote:MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1051 - Unknown table 'mybb_lastvisitor'
Query:
DROP TABLE `mybb_lastvisitor`;

Please contact the MyBB Group for support.

Versiunea forumului e 1.6.5 probabil nu e compatibil cum as putea rezolva ?

Yeah, problema e ca pluginul este pe 1.1, nu pe 1.6.5 so... aici e buba. Roaga-l pe Mihai sa-ti faca un upgrade la el sau cere intr-un topic si ti-se va da, banuiesc....
Keep walking !   http://www.mybb.ro
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)