PDA

View Full Version : vBulletin Attachment Downloads Tracker - Help needed


J98680Bxxxxx
04-08-2008, 05:11 PM
The idea seems simple: track which users have downloaded vBulletin attachments. :)

Currently, only the views count on attachments is kept in the database, through the "attachmentviews" table.

Goals: :up:
1. Extend the database to include a table "attachmentsdownloaded" that records information on users who have downloaded attachments
$db->query_write("CREATE TABLE ".TABLE_PREFIX."attachmentdownloaded (userid int(10) unsigned NOT NULL default 0,attachmentid int(10) unsigned NOT NULL default 0,dateline int(10) unsigned NOT NULL default 0,ipaddress varchar(20) NOT NULL default '',PRIMARY KEY (userid,attachmentid),KEY dateline (attachmentid,dateline),KEY ipaddress (ipaddress))

2. Modify the "attachment.php" or any other file to record users information whenever the attachment views counter is updated?
if (!$vbulletin->GPC['thumb'] AND connection_status() == 0 AND $lastbyte == ($attachmentinfo['filesize'] - 1))
{
$db->query_write("INSERT INTO ".TABLE_PREFIX."attachmentdownloaded (userid, attachmentid, dateline, ipaddress) VALUES ($vbulletin->userinfo['userid'], $attachmentinfo[attachmentid], TIMENOW, IPADDRESS) ");
}

3. List attachments downloaded for each user

I have tested 1 & 2 but got the error: "Internet Explorer cannot download the file ?attachment.php?..."??? :eek:

Any help or a quick mods on this is highly appreciated.

Lynne
04-08-2008, 07:02 PM
Something like this? Who Downloaded This Attachment (https://vborg.vbsupport.ru/showthread.php?t=103155&highlight=download%2A)

J98680Bxxxxx
04-08-2008, 07:11 PM
Something like this? Who Downloaded This Attachment (https://vborg.vbsupport.ru/showthread.php?t=103155&highlight=download%2A)


:up: Thanks Lynne, much appreciated. The mod you just referred to is perfect. It?s indeed what I have been looking for. Thanks again.