vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.7 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=228)
-   -   Miscellaneous Hacks - You Can't See Attached Files Before Replying (https://vborg.vbsupport.ru/showthread.php?t=180151)

germinus 05-21-2008 10:00 PM

You Can't See Attached Files Before Replying
 
This mod hides your attachments to a post until the reader has added a reply, I must point out that I did not create this mod but found it lieing about in the 3.5 section.

https://vborg.vbsupport.ru/showthread.php?p=1431885

It was pointed out that this mod was of no use due to the fact that all a user had to do was click the paperclip icon in the forum index and they would be able to download without having to reply. This issue has now been resolved and users will no longer be able to bypass this mod.

All credit should go to Stoebi for the updates :)

**updated**
1.1.2
- Fixed: uncached template in showpost
- Fixed: cantseeattach in showpost, although user replied

veenuisthebest 05-22-2008 04:50 PM

reserved !!

Stoebi 05-22-2008 09:13 PM

Hi
  • Queries in postbit_display_complete are bad solutions
  • Template edit not necessary
  • Missing phrase, yours is hardcoded :(
  • Template is uncached
  • Missing table prefix
Your template is using <normalfont>You must reply to be able to download the file</normalfont>. Never heard about such a tag <normalfont> ;)

Better:
Template postbit_cantseeattach:
HTML Code:

<span class="smallfont">$vbphrase[cantseeattach]</span>
My ideas, not tested, but it should work:

For template cache:
Hook cache_templates:
PHP Code:

if (THIS_SCRIPT == 'showthread')
{
    
$globaltemplates[] = 'postbit_cantseeattach';


Reduce queries in hook postbit_display_complete:
PHP Code:

if ($this->post['attach'])
{
    GLOBAL 
$m$vbulletin;

    if (!
$vbulletin->userinfo['userid'] OR $vbulletin->userinfo['userid'] != $m AND !can_moderate($forumid))
    {
        eval(
'$this->post[\'imageattachmentlinks\'] = "' fetch_template('postbit_cantseeattach') . '";');
        eval(
'$this->post[\'thumbnailattachments\'] = "' fetch_template('postbit_cantseeattach') . '";');
        eval(
'$this->post[\'imageattachments\'] = "' fetch_template('postbit_cantseeattach') . '";');
        eval(
'$this->post[\'otherattachments\'] = "' fetch_template('postbit_cantseeattach') . '";');
        eval(
'$this->post[\'moderatedattachments\'] = "' fetch_template('postbit_cantseeattach') . '";');
    }


Hook showthread_post_start:
PHP Code:

if ($thread['attach'])
{
    
$p $db->query_first("SELECT userid
            FROM " 
TABLE_PREFIX "post
        WHERE threadid = 
$threadid AND userid = " $vbulletin->userinfo['userid'] . "
    "
);

    
$m $p['userid'];


For showing or not showing paperclip in threadbit.
Hook threadbit_process:
PHP Code:

if ($thread['attach'])
{
    GLOBAL 
$db$vbulletin;

    
$p $db->query_first("SELECT userid
            FROM " 
TABLE_PREFIX "post
        WHERE threadid = 
$thread[realthreadid] AND userid = " $vbulletin->userinfo['userid'] . "
    "
);

    
$m $p['userid'];

    if (!
$vbulletin->userinfo['userid'] OR $vbulletin->userinfo['userid'] != $m AND !can_moderate($forumid))
    {
        
$show['paperclip'] = false;
    }


A variable/phrase cantseeattach is needed also:
Content:
Code:

You must reply to be able to download the file
I've no idea, how can i better reduce the queries in theadbit_process.
If anyone know how we can optimize it better, please let us know. :)



Regards,

Stoebi

codershark 05-23-2008 01:11 AM

Thank you so much Stoebi! Works very fine.

germinus 05-23-2008 02:43 PM

Stoebi sent me an updated version of this which has now been attached, I suggest you download the updated version. Thanks to Stoebi for the update!

BiZiMDiYaR 05-24-2008 09:51 PM

Hi,

downloaded. but i installed the 1 file, but it didn;t work.. can we have a clear working procedure on this ( should be simple, must be doing something wrong. ) ?

Thanks.

sweetguy2004 05-25-2008 08:05 PM

thanks nick hack but can u add thanks also

germinus 05-28-2008 06:02 PM

another update added

da_judge 07-09-2008 05:22 PM

Wicked plugin... clicked install

But how do u disable for certain usergroups, I dont want it to work with all user groups

Cheers

lstintxs100 07-09-2008 05:25 PM

This is so tempting for my techs. I am going to download and think on this one. This could be a good way to increase activity.


All times are GMT. The time now is 07:40 AM.

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.01207 seconds
  • Memory Usage 1,756KB
  • 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
  • (1)bbcode_code_printable
  • (1)bbcode_html_printable
  • (4)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete