Tutorial  Disable xThreads attachment download for guests.

One thing that bothers me with xThreads attachments is that they are available for guests. This might not be a problem with all boards and I'm not saying this is a issue for this site. But it would be nice to be able to set permissions for xThreads attachments.

First, we need to enable the LOAD_SESSION setting by changing its value to true (see line).
  1. Open file xthreads_attach.php located in your forum root directory.
  2. Frind the following line:
    define('LOAD_SESSION', false);
  3. Update to:
    define('LOAD_SESSION', true);
  4. Save and upload the file back to your forum root directory if needed.
  5. Finally, import the attached file using the Hooks plugin.

This will accomplish two things, first it will disable all xThreads attachments for guests. It will also disable attachments for groups that can't see the field. Currently xThreads assumes that if the user can't see the thread there isn't need to check for permissions as getting the download link could be quite difficult. This might or not be the best approach, even so I decided to apply this as it doesn't causes a big change on load or resource usage, but you can decide to remove that part.

There could be also the case that you want users to see attachments without being able to download. But for that we would need deeper changes or more steps. I will research this possibility later on when I find a need for that.

In this community I activated this feature mostly for you to test.
This post was last modified: 10 Jun, 2020, 1:14 pm by Omar G..

There are currently no posts to display. Be the first one to leave a reply.

Current time: 13 Jun, 2024, 12:48 am