PDA

View Full Version : Download counter attachments


michaelbang
04-28-2012, 02:02 PM
Hi,

I'm looking for a mod that can show how many times a given attachment has been downloaded. E.g. next to the link in a post:

movie-from-my-holiday.mpg (downloaded: 135 times)

Is that possible?

Thanks

//Michael

BirdOPrey5
04-28-2012, 04:30 PM
That should be visible by default- it's called "views" but it's there.

Look at the attachment in this first post: https://www.vbulletin.com/forum/showthread.php/400165-vBulletin-Security-Patch-for-vBulletin-4-1-12-for-Suite-amp-Forum-04-23-2012

I see it is currently at "403 views."

michaelbang
04-30-2012, 08:32 AM
It's excactly what I want! But that's not visible in my forum. Is it something that I have to "turn on"?

--------------- Added 1335779546 at 1335779546 ---------------

Maybe something is wrong/missing in the postbit-attachment template?

BirdOPrey5
04-30-2012, 09:53 AM
Post a copy of your postbit attachment template here- they are small... Put it inside bbcode so it's easy to read.

Or, here is the default code for postbit_attachment:

[CODE]
<li>
<img class="inlineimg" src="{vb:stylevar imgdir_attach}/{vb:raw attachment.attachmentextension}.gif" alt="{vb:rawphrase file_type_x, {vb:raw attachment.attachmentextension}}" />
<a href="attachment.php?{vb:raw session.sessionurl}attachmentid={vb:raw attachment.attachmentid}&amp;d={vb:raw attachment.dateline}"<vb:if condition="$show['newwindow']"> target="_blank"</vb:if>>{vb:raw attachment.filename}</a>
({vb:raw attachment.filesize}<vb:if condition="$show['views']">, {vb:rawphrase x_views, {vb:raw attachment.counter}}</vb:if>)
</li>


The code in red controls the showing of views... I don't see anywhere to disable the showing of views and it is always enabled by default. But it is in a condition so I don't know.

michaelbang
04-30-2012, 10:08 AM
Seeing anything wrong?

<li>
<img class="inlineimg" src="{vb:stylevar imgdir_attach}/{vb:raw attachment.attachmentextension}.gif" alt="{vb:rawphrase file_type_x, {vb:raw attachment.attachmentextension}}" />
<a href="attachment.php?{vb:raw session.sessionurl}attachmentid={vb:raw attachment.attachmentid}&amp;d={vb:raw attachment.dateline}"<vb:if condition="$show['newwindow']"> target="_blank"</vb:if>>{vb:raw attachment.filename}</a>
({vb:raw attachment.filesize}<vb:if condition="$show['views']">, {vb:rawphrase x_views, {vb:raw attachment.counter}}</vb:if>)
</li>

BirdOPrey5
04-30-2012, 11:10 AM
No... I don't know why the showing of views would be disabled- I didn't see any options that control this...

In the code change:

<vb:if condition="$show['views']">

to

<vb:if condition="1">

and that should force the views to show.

There is an option in Admin CP -> Settings -> Options -> Attachment Options that lets you decide if views are updated immediately or the default once per hour to reduce load on the server.

michaelbang
04-30-2012, 11:31 AM
I tried to change the code. Did nothing.

Do you mean "Message Attachment Options" in "Settings/Options"? I cant find the option you mention here.

Thanks for the support!

BirdOPrey5
04-30-2012, 02:02 PM
Setting <vb:if condition="1"> made no change? Are you sure you made it to the correct style?

Can I get a link to a post on your forum with an attachment in it?

The setting I was talking about is actually under "Server Settings and Optimization Options" - sorry.

michaelbang
04-30-2012, 02:17 PM
I changed the postbit_attachment template in Postbit Templates.

<li>
<img class="inlineimg" src="{vb:stylevar imgdir_attach}/{vb:raw attachment.attachmentextension}.gif" alt="{vb:rawphrase file_type_x, {vb:raw attachment.attachmentextension}}" />
<a href="attachment.php?{vb:raw session.sessionurl}attachmentid={vb:raw attachment.attachmentid}&amp;d={vb:raw attachment.dateline}"<vb:if condition="$show['newwindow']"> target="_blank"</vb:if>>{vb:raw attachment.filename}</a>
({vb:raw attachment.filesize}<vb:if condition="1">, {vb:rawphrase x_views, {vb:raw attachment.counter}}</vb:if>)
</li>

I'll PM you a link to my forum and a post with an attachment.

BirdOPrey5
04-30-2012, 03:03 PM
The link you sent me- the issue is those are "inline attachments" so they show up differently.

It actually tells you the views if you mouse-over the link.

To get the real counter like they have on the link I sent you to vBulletin.com you need to edit the post and remove the attachments from being inline (just delete them from the editor box) and they will show up as real attached files with the view counter.

michaelbang
04-30-2012, 03:49 PM
OMG! All this working around, and then it turns out - I just attached them "wrong"!

Thanks a million! Problem solved. :)

BirdOPrey5
04-30-2012, 05:52 PM
:up: Don't forget to reset (revert) your template to undo the change.

michaelbang
04-30-2012, 06:01 PM
:up: Don't forget to reset (revert) your template to undo the change.

You mean the postbit_attachment template? Undo the "1"?

BirdOPrey5
04-30-2012, 06:18 PM
yes.