[Paid] Restrict Uploads

What would you like done?
Restrict uploads to either a Trust Level or Group.

For instance, restrict to Trust Level 2.
Trust Levels below 2 can’t see the “upload” button.

When do you need it done?
The sooner the better, but no rush… perhaps within the next week would be good.

What is your budget, in $ USD that you can offer for this task?
Let’s talk.

Are you trying to limit the actual ability for this to happen or just hide the button? You can hide the button with CSS for non-staff pretty easy.

Ideally limit the actual ability to prevent bad actors, but if you could point me towards how to hide the button I could test it out quickly and see how it operates, then come back and update the thread if I’m still seeking out the former.

Mainly just seeking this task out to prevent any bad actors or new forum members from uploading irrelevant content until a certain trust level so they’re more trusted to go free.

2 Likes

Try this out:

<script type="text/discourse-plugin" version="0.8.25">
  const { authorizesOneOrMoreExtensions } = require("discourse/lib/utilities");
  api.modifyClass('controller:composer', {
      allowUpload: Ember.computed(function() {
        let user = api.getCurrentUser()
        if(user.trust_level >= 2 || user.staff && authorizesOneOrMoreExtensions()) {
            return true;
        }
      })
  });
</script>

That should prevent the button from even rendering. I might make this into a theme-component where you can set the trust level.

8 Likes

Thanks so much! Appreciate you doing this; you may close this thread, what I was going after has been achieved.

3 Likes