Hanzo1
(Hanzo)
2019 年3 月 21 日 08:55
1
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.
joebuhlig
(Joe Buhlig)
2019 年3 月 21 日 12:32
5
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.
Hanzo1
(Hanzo)
2019 年3 月 21 日 22:36
6
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 个赞
tshenry
(Taylor)
2019 年3 月 22 日 01:03
7
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 个赞
Hanzo1
(Hanzo)
2019 年3 月 22 日 12:10
8
Thanks so much! Appreciate you doing this; you may close this thread, what I was going after has been achieved.
3 个赞