vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.7 Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=229)
-   -   Show Thread Enhancements - Show attachments to members only (https://vborg.vbsupport.ru/showthread.php?t=199690)

wolfstream 12-23-2008 10:00 PM

Show attachments to members only
 
Now, I know that vb will stop unregistered users from downloading attachments, but here's another quick way to get the attachment itself SHOWN to members only, while letting guests know they're missing something

In postbit_attachment, look for
Code:

<tr>
        <td><img class="inlineimg" src="$stylevar[imgdir_attach]/$attachment[attachmentextension].gif" alt="<phrase 1="$attachment[attachmentextension]">$vbphrase[file_type_x]</phrase>" width="16" height="16" border="0" style="vertical-align:baseline" /></td>
        <td><a href="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&amp;d=$attachment[dateline]"<if condition="$show['newwindow']"> target="_blank"</if>>$attachment[filename]</a> ($attachment[filesize]<if condition="$show['views']">, <phrase 1="$attachment[counter]">$vbphrase[x_views]</phrase></if>)</td>
</tr>

And replace with:
Code:

<tr>
        <if condition="$show['member']">

        <td><img class="inlineimg" src="$stylevar[imgdir_attach]/$attachment[attachmentextension].gif" alt="<phrase 1="$attachment[attachmentextension]">$vbphrase[file_type_x]</phrase>" width="16" height="16" border="0" style="vertical-align:baseline" /></td>
        <td><a href="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&amp;d=$attachment[dateline]"<if condition="$show['newwindow']"> target="_blank"</if>>$attachment[filename]</a> ($attachment[filesize]<if condition="$show['views']">, <phrase 1="$attachment[counter]">$vbphrase[x_views]</phrase></if>)</td>

<else />
<td> This post has an attachment which you could see if you were <a href="/register.php">registered</a>. Registering is quick and easy</td>
</if>
</tr>

This will let guests know they're missing out on viewing an attachment. Very easy to do!

Allan 12-24-2008 09:55 AM

humm, nice idea, installed ^^

Charlie98902 12-24-2008 03:21 PM

Installed as well thanks.

KevinL 12-24-2008 08:38 PM

heh...I had this in the paid requests like 2 days ago.

Only difference (i think) is that I want guests to see the thumbnail then when clicked it loads to a message/picture saying to registrar...

Tagged. I'll keep an eye on this ;)

wolfstream 12-24-2008 09:02 PM

Pretty easy to do. I'm assuming you meant something like it is setup here?
Didn't get a demo out earlier, as I did this originally for a client (really, it was a 5 second hack) who didn't mind me redistributing it.

to do that, replace postbit_attachment with
Code:

<tr>
        <td><img class="inlineimg" src="$stylevar[imgdir_attach]/$attachment[attachmentextension].gif" alt="<phrase 1="$attachment[attachmentextension]">$vbphrase[file_type_x]</phrase>" width="16" height="16" border="0" style="vertical-align:baseline" /></td>
        <if condition="$show['member']">
<td><a href="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&amp;d=$attachment[dateline]"<if condition="$show['newwindow']"> target="_blank"</if>>$attachment[filename]</a> ($attachment[filesize]<if condition="$show['views']">, <phrase 1="$attachment[counter]">$vbphrase[x_views]</phrase></if>)</td>
<else />
<td> This post has an attachment which you could see if you were <a href="/register.php">registered</a>. Registering is quick and easy</td>
</if>
</tr>


KevinL 12-24-2008 09:16 PM

Oh sorry I was speaking more of image attachments. Like in combination with lytebox.

I guess this could be adapted to that somehow though..hmm I might have to take a look. I was thinking maybe just an <if> statement might get this to work... maybe it will haha

Here was my last post... https://vborg.vbsupport.ru/showpost....&postcount=461 (you don't have to look at this or do anything with this hahah)

PaiNx 03-24-2009 03:23 AM

Awesome little template mod and just what I have been looking for...

Thanks:D

Edit: I selected the wrong rating, but I meant to give it a 5 star. Can this be changed?...Sorry

QuackWare 06-29-2009 01:05 AM

Thanks, exactly what I was looking for.

lm3a.net 08-23-2009 10:27 AM

thank you,,


All times are GMT. The time now is 02:03 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01048 seconds
  • Memory Usage 1,731KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete