A Few Tweaks to the Document Repository Plugin

For those of you that haven’t seen it, Ron Rennick wrote an amazing plugin for us at University of Mary Washington that lets us manage all of our documents (PDF, Word, Excel, etc.) from a single site in our WordPress network; and then insert links to those documents from within any other site in the network. The plugin handles revisioning the documents, and ensures that a single permalink always leads to the latest and greatest version of the document.

Just in case you’re wondering, yes, the Document Repository plugin is completely compatible with multisite (duh!) and with multi-network setups of WordPress.

In our particular situation, there were a handful of additional tweaks I wanted to make to the plugin, though. They weren’t really within Ron’s purview to make, since they didn’t effect the overall utility or performance of the plugin; I just wanted to make things a little cleaner and easier to use in our installation.

Therefore, I wrote up a simple mu-plugin (you could choose to use any or all of this code in a mu-plugin, or just paste it into your theme’s functions.php file; the code is completely modular).

The functions in that code make the following changes:

  1. Remove the Posts, Media, Links, Pages and Gravity Forms* menus from the admin menu on the site we’re using for the Document Repository. We will be using the Document Repository all by itself on that site, and all posts and pages will be handled on other sites in the network, so we didn’t want anything else cluttering up the admin area and confusing our users.
  2. Adjust the capabilities for users on the Documents site. In our case, we didn’t want WordPress “authors” to be able to “publish” documents (we only want them to be able to save them in pending or draft status; waiting for another user to actually approve and publish the documents). We also didn’t want WordPress editors to be able to edit the taxonomy values, so we took that capability away from them.
  3. Remove the Quick Press dashboard widget. Since we won’t be using standard posts on our Documents site, we didn’t want users to be confused into thinking that they could quick-press a document. Therefore, we just removed it.
  4. Remove the “Insert Gravity Form*” button from the Upload/Insert area about the document editor. Since the permalinks for all documents redirect to the documents themselves, there was no reason whatsoever for a user to ever try to insert a Gravity Form* into the body/description of a document post. To reduce confusion, we simply removed that button from the Upload/Insert area above the editor when someone is editing a document post.

As I said above, each of the functions is completely modular, so if you would like to add one or more of these features to the Document Repository plugin, please feel free to copy and paste the appropriate function(s).

View the Code

*Gravity Forms is a premium plugin used to create and manage Web-based forms.

**As a side note, this Document Repository plugin should not at all be confused with my List Attachments Shortcode plugin (I was asked about this earlier this week). They have completely and totally different functionality. The Document Repository plugin manages documents/downloadable items from a central site. Each Document is a separate post on that site. The List Attachments Shortcode plugin simply displays a list of any items that have been attached to a single post/page.

Leave a Reply

Your email address will not be published. Required fields are marked *