![]() |
More/Smarter Attachment.php hooks I currently have a forum that NO-ONE but the moderators can download threads from. I want to make it possible for the user to download files from that thread as well (eg: User creates thread and adds a file. Moderator modifies the file and posts the modified version back in the thread. Users who created the original thread can download the modified file, but no other user can.) This could also extend into a system where the buddies of the user can download files. Have currently hard-modified line 186 of attachment.php, but I would prefer something like the following be done as standard in the product... Lide 186+ before... Code: $viewpermission = ($vbulletin->GPC['thumb'] ? 'canseethumbnails' : 'cangetattachment'); if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) OR !($forumperms & $vbulletin->bf_ugp_forumpermissions[$viewpermission]) OR (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) AND ($attachmentinfo['postuserid'] != $vbulletin->userinfo['userid'] OR $vbulletin->userinfo['userid'] == 0))) Line 186+ after... Code: $viewpermission = ($vbulletin->GPC['thumb'] ? 'canseethumbnails' : 'cangetattachment'); $hook_viewpermission = !($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) OR !($forumperms & $vbulletin->bf_ugp_forumpermissions[$viewpermission]) OR (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) AND ($attachmentinfo['postuserid'] != $vbulletin->userinfo['userid'] OR $vbulletin->userinfo['userid'] == 0)); ($hook = vBulletinHook::fetch_hook('attachment_viewpermissi on')) ? eval($hook) : false; if ($hook_viewpermission) I could then use the hook to change the re-calculate the value if I desired. Note: This would be incredibly useful in MANY other places as well, particularly where the code has the "standard_error" function that effectively ends the operation. |
الساعة الآن 05:01 AM |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.5.2 TranZ By
Almuhajir