MyBB Hacks

Full Version: Use MyBB's attachment.php to Download XThreads Attachment
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
XThreads itself already have a permission to view its attachments (files or images). And XThreads has a global settings to change the attachments URL based on IP and/or time.

This is only my ugly and a very simple "trick" to add a permission to download XThreads attachments. I use MyBB's attachment.php file for this (using attachment_start hook). I use this for file attachments (not image attachments).

In this example, it will look at the XThreads Viewable by Usergroups settings permission to download the attachment.

We can use something like this in the Display Format:

HTML Code
<a href="{$mybb->settings['bburl']}/attachment.php?xtaid={$GLOBALS['threadfields']['key']['aid']}">Download</a>

I don't know what I should use for the aid in the Display Format, so I use the {$GLOBALS['threadfields']['key']['aid']}. We can design it as our needs (using button, form and etc).

Because I'm not a coder, please tell me if there is something wrong with the code.

Good one RateU Smile

Thanks for sharing.
Nice try!
Just be aware that it's still possibly to fetch the URL that the user gets redirected to, but I can see this masking having uses at places.
(07-14-2012 12:08 PM)ZiNgA BuRgA Wrote: [ -> ]Just be aware that it's still possibly to fetch the URL that the user gets redirected to
Biggrin
Reference URL's