The goal for this component of the website was to enable users to login and generate content for the site without giving them any access to the generic WordPress (WP) admin dashboard. The reason for this was two-fold:
- Create a custom user role for for the content generators outside of the organization and fine tune the Capabilities of this custom user role.
- Simplify the WP dashboard experience to make it easy for users who have never used WP before to add or edit content on the site.
Customizing user roles and capabilities in WP is relatively simple and there are many plugins available in the WP repository that can help us accomplish that goal. For this project I ended up using the Members plugin by Justin Tadlock.
Customizing the design and the functionality of the WordPress dashboard is far more complicated. For this project instead of starting with the generic WP dashboard, theming it and then stripping out functionality for our custom user roles, I decided to build a separate dashboard from scratch and scoped the functionality to exactly what we needed. When users in our custom roles log into WP we simply forward them to this new custom dashboard, whereas users with the traditional Administrator role (or higher) will be forwarded to the default WP dashboard in order to maintain total control over the site.
Sounds simple but you might be wondering: How exactly does one build a new custom dashboard for WordPress?
Behold the mighty ACF Pro!
One of my very favorite plugins, and one that I use on almost all of my projects, is Advanced Custom Fields Pro by Elliot Condon. This plugin helps me build out custom fields for many different content types on any edit screen in WP. It is incredibly powerful and easy to use.
Beyond the basic features of the free version of the plugin there are several more advanced features included in the Pro version that are well worth the cost of the license. One of lesser known and seldom discussed features in Pro is a function called ACF Form. This function is used to create forms that can be included on the front-end of your website.
By default the function outputs a form including all of the standard fields on the edit screen of a blog post. If you include this function inside the loop on the
single.php theme template file it allows the user (if logged in) to edit the blog post directly from the front end of the site. This definitely piqued my interest.
After digging into the documentation a bit more, I found that you can pass the
acf_form() function different parameters that will allow the form to be used to create a new blog post, or even create a new post for a custom post type in addition to editing the content. Beyond that you can set parameters to programmatically include any custom fields from ACF you want that are associated with that post type- basically allowing the logged-in user to create or edit any post-based content on the site.
But can we take it further? After some real deep digging I found out that you can even rig this ACF function to create/edit taxonomy terms and users for the site as well. These more advanced use cases ended up getting a bit hacky in terms of implementation but they got the job done and they still work now, years after I finished working on the project.
Tying it all together
Leveraging the ACF Form functionality to add content, I built out a suite of custom page templates for the client’s theme for each individual view we needed in the dashboard experience. The end result impressed the client and gave them the ability to invite new users to publish content on their platform in a comprehensive user interface that was totally cordoned off from the native WP dashboard.