Media Library Access For Everyone

All WordPress features are tied into roles and capabilities system to determine if users can access and use these features. The same goes for Media Library, and by default bbPress subscriber role can’t use it, so normal users in the forum can’t use Media Library.

That is fine for most uses, but if you want to use the TinyMCE editor for topics and replies, subscribers can use the editor, but the Add Media button will not be available. But, the problem here is not simply to add the capability for uploading files to subscriber role (that is more or less the easy part), the problem is the process of upload itself. Here is a bit of a background on how Media Library works.

When you create a normal post or page, when you start working on a new post/page, WordPress saves it in the background as soon as you start working. And, when you use Media Library, any file uploaded is assigned to that post even if it is new and not even saved. But, with bbPress topics and replies, things don’t (and can’t) work like that. bbPress is saving topic and reply only when you click Submit, it is not created in advanced like WordPress does with posts/pages. So, when you use the Media Library to write the topic/reply, the file you upload through it will be assigned to parents, and in case of a new topic, files will be assigned to the forum in which the forum is assigned. In case of a new reply, the file is assigned to the topic.

And there lies the problem, upload_files capability depends on the post/page/forum/topic/reply file is uploaded to. So, if subscriber creates a new topic, it needs a capability to upload files into parent forum, and if subscriber creates a new reply, it needs the capability to upload files to a topic.

So, to solve this problem, GD bbPress Toolbox Pro has an option to enable support for Media Library to subscribers, and it is disabled by default. This option is part of the Tweaks Feature. You need to enable it from plugin panel Features -> Tweaks -> Allow Participants to use Media Library. And once enabled, the plugin will override capabilities for subscribers when need to allow them to use Media Library and Add Media button for TinyMCE.

Important to know:

  • There is no way to control what subscribers can upload.
  • Once they are allowed to upload, subscribers can upload as many files as they want.
  • Subscribers can delete own files, they can’t delete other files uploaded by other users.
  • Subscribers can’t see files uploaded by other users.

Make sure you understand all this, and what will happen if you allow subscribers to upload files and use the Add Media button in TinyMCE editor.

Rate this article

You are not allowed to rate this post.

Leave a Comment