MyBB Community Forums

Full Version: Download Threads
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Download Threads

Authors: Dragonexpert & Laird

Current Version: 1.1

This plugin enables users to download an entire thread in a variety of formats.  At this time the supported formats are HTML which you can customize using templates and JSON.  HTML utilizes the post parser to parse message so you get the html output of the message.  JSON uses the raw data.

Features
- Uses Language Variables on front end
- Uses the template system
- Ability to restrict which forums threads can be downloaded
- Ability to restrict which usergroups can download threads.
- Uses an organized file structure to make it easy to edit.

Installation
1) Upload all files to their corresponding location.
2) Install & Activate in the Admin CP
3) Adjust Settings if desired.
4) Adjust usergroup permissions if desired.
5) Edit templates if desired. These are global templates.

Github: https://github.com/dragonexpert/downloadthread
Hi, thank you for your contribution Smile

A question, where is $groupscache defined?
https://github.com/dragonexpert/download...s.php#L109
Another good plugin dragon, thanks for your contribution.
(2021-03-03, 05:35 AM)Omar G. Wrote: [ -> ]A question, where is $groupscache defined?

Currently beginning on line #23 of global.php:

https://github.com/mybb/mybb/blob/6e9a1f...al.php#L23
Oh, but global.php isn't loaded in the ACP. Simply $groupscache = $mybb->cache->read("usergroups"); would make it a one-line fix.
(2021-03-03, 09:19 AM)Omar G. Wrote: [ -> ]Oh, but global.php isn't loaded in the ACP.

Oops. My mistake. I knew it was defined somewhere 'cos the checkbox it controls works as expected. global.php was an untested assumption. I've tracked down the true culprit though. It's line 1288 of functions.php, in the function usergroup_permissions(), which is called on line 515 of admin/index.php.

(2021-03-03, 09:19 AM)Omar G. Wrote: [ -> ]Simply $groupscache = $mybb->cache->read("usergroups"); would make it a one-line fix.

Now I'm undecided as to whether this is a good idea anyway. Perhaps best is to include your one-liner, but wrapped in the conditional:
if (!is_array($groupscache))
If the variable is set before then it might be better to use a if check, yes. I just missed to track the set of the variable.
Some things to consider for future releases for features:

- Cooldown between downloads. This would be a usergroup setting. Super Admin would be exempt since typically they would also have direct access to the database and file system.

- When a thread is downloaded have a setting to keep that file until a new post happens in that thread. This way it prevents a potentially expensive query if it is a thread with many replies.

- Log the downloading of a thread somewhere. The log could be viewable in the Admin CP near the other logs.

- Setting to add additional fields for the download. JSON would always be the raw data from those so no human readable.

- Possibly have CSV be a format to choose from.
So far we have CSV support working on Github. I have figured out also how to make it so the result will be a zip file so it will use less bandwidth for you and for your visitors. I have the Zip File feature working on my demo site, but it should be treated as experimental. If it fails to create a Zip file, it will just do a regular file like it currently does.
What is the practical use of a CSV? I mean, why would users download in such format?
Pages: 1 2