Torrent and Profile Views mod
Credit to original author djhowarth. Big Thanks for this great mod
Run SQL
Open torrents-details.php and find:
Replace with:
Also find:
Replace with:
Features...
- show users visited the torrent aslong as there privacy is not strong
- seperator , of last comma removed...
- (count) of views / times they visted the torrent...
- This replaces the standard hits/views code
-------------------------------------------------------------
For Profile Views Continue Open account-details.php and find:
Underneath Add:
Also find:
Underneath Add:
In the file english.php add:
$LANG["VIEWED_BY"] = "Viewed by";
$LANG["TORRENT_NOT_VIEWED"] = "This torrent has not had any views yet";
$LANG["PROFILE_VIEWS"] = "Profile views";
$LANG["NO_PROFILE_VIEWS"] = "This member has had no profile views";
Profile:

Torrent:
Credit to original author djhowarth. Big Thanks for this great mod
Run SQL
CREATE TABLE IF NOT EXISTS `trackerviews` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`subject` int(10) unsigned NOT NULL DEFAULT '0',
`viewer` int(10) unsigned NOT NULL DEFAULT '0',
`count` int(10) NOT NULL DEFAULT '0',
`type` enum('torrent','profile') DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;Open torrents-details.php and find:
if ($_GET["hit"]) {
SQL_Query_exec("UPDATE torrents SET views = views + 1 WHERE id = $id");
header("Location: torrents-details.php?id=$id");
die;
}Replace with:
if ($_GET["hit"])
{
$query = (mysqli_fetch_row(SQL_Query_exec("SELECT COUNT(*) FROM `trackerviews` WHERE `viewer` = " . $CURUSER["id"] . " AND `subject` = '$id' AND `type` = 'torrent'")));
if ($query[0] == 0)
{
SQL_Query_exec("INSERT INTO `trackerviews` (`subject`, `viewer`, `count`, `type`)
VALUES (" . $id . ", " . $CURUSER["id"] . ", '1', 'torrent')");
}
else
{
SQL_Query_exec("UPDATE `trackerviews` SET `count` = `count` + '1' WHERE `subject` = '$id' AND `viewer` = " . $CURUSER["id"] . " AND `type` = 'torrent'");
}
header("Location: torrents-details.php?id=$id");
die;
}Also find:
print("<tr><td align='left'><b>".T_("HITS").":</b></td><td>" . number_format($row["hits"]) . "</td></tr>\n");Replace with:
/* Torrent Views... */
$query = SQL_Query_exec("SELECT DISTINCT(viewer), username, count FROM trackerviews LEFT JOIN users ON trackerviews.viewer = users.id WHERE trackerviews.type = 'torrent' AND trackerviews.subject = '$id' AND users.privacy != 'strong' AND users.status = 'confirmed' AND users.enabled = 'yes' LIMIT 10");
if (mysqli_num_rows($query) > 0)
{
print("<tr><td align='left'><b>".T_("VIEWED_BY").":</b></td><td>");
$user = "";
while ($rows = mysqli_fetch_array($query))
{
$user .= "<a href='account-details.php?id=" . $rows["viewer"] . "'>" . class_user($rows["username"]) . "</a> (" . number_format($rows["count"]) . "), ";
}
$users = substr($user, 0, (strlen($user) - 2));
print( $users . "</td></tr>");
}
else
{
print("<tr><td align='left'><b>".T_("VIEWED_BY").":</b></td><td><strong>".T_("TORRENT_NOT_VIEWED")."</strong></td></tr>\n");
}
/* End */Features...
- show users visited the torrent aslong as there privacy is not strong
- seperator , of last comma removed...
- (count) of views / times they visted the torrent...
- This replaces the standard hits/views code
-------------------------------------------------------------
For Profile Views Continue Open account-details.php and find:
if (($user["enabled"] == "no" || ($user["status"] == "pending")) && $CURUSER["edit_users"] == "no")
show_error_msg(T_("ERROR"), T_("NO_ACCESS_ACCOUNT_DISABLED"), 1);Underneath Add:
if ($CURUSER["id"] != $id)
{
$query = (mysqli_fetch_row(SQL_Query_exec("SELECT COUNT(*) FROM `trackerviews` WHERE `viewer` = " . $CURUSER["id"] . " AND `subject` = '$id' AND `type` = 'profile'")));
if ($query[0] == 0)
{
SQL_Query_exec("INSERT INTO `trackerviews` (`subject`, `viewer`, `count`, `type`) VALUES (" . $id . ", " . $CURUSER["id"] . ", '1', 'profile')");
}
else
{
SQL_Query_exec("UPDATE `trackerviews` SET `count` = `count` + '1' WHERE `subject` = '$id' AND `viewer` = " . $CURUSER["id"] . " AND `type` = 'profile'");
}
}
Also find:
}else{
echo sprintf(T_("REPORT_MEMBER_MSG"), $user["id"]);
}
end_frame();Underneath Add:
if ($user["privacy"] != "strong" || ($CURUSER["control_panel"] == "yes"))
{
begin_frame(T_("PROFILE_VIEWS"));
$query = SQL_Query_exec("SELECT DISTINCT(viewer), username, count FROM trackerviews LEFT JOIN users ON trackerviews.viewer = users.id WHERE trackerviews.type = 'profile' AND trackerviews.subject = '$id' AND users.privacy != 'strong' AND users.status = 'confirmed' AND users.enabled = 'yes' LIMIT 10");
if (mysqli_num_rows($query) > 0)
{
$view = "";
while ($rows = mysqli_fetch_array($query))
{
$view .= "<a href='account-details.php?id=" . $rows["viewer"] . "'>" . class_user($rows["username"]) . "</a> (" . number_format($rows["count"]) . "), ";
}
$users = substr($view, 0, (strlen($view) - 2));
echo($users);
}
else
{
echo("<center><strong>".T_("NO_PROFILE_VIEWS")."</strong></center>");
}
end_frame();
}In the file english.php add:
$LANG["VIEWED_BY"] = "Viewed by";
$LANG["TORRENT_NOT_VIEWED"] = "This torrent has not had any views yet";
$LANG["PROFILE_VIEWS"] = "Profile views";
$LANG["NO_PROFILE_VIEWS"] = "This member has had no profile views";
Profile:

Torrent:
Last edited by coco on 2021-07-19 11:33:06
