Soliloquy Documentation

Documentation, Reference Materials, and Tutorials for Soliloquy

Using A WordPress User Role

Does your WordPress site have multiple authors contributing to your blog posts? Perhaps you use the predefined WordPress user role of Author or Contributor? I’m going to share with you my experience with WordPress user roles.

What are WordPress user roles?

WordPress user roles are used so that you can grant other users access to your site to create posts and even Soliloquy sliders without giving them access to your theme or plugin sections of your WordPress admin. However, there are many differences for each WordPress user role. You can read more about WordPress roles here from our friends at WPBeginner.

WordPress user role

Contributor vs Author

You may ask “what is the difference between the role Contributor and the role Author?”

Contributor roles can create and edit their own posts as well as delete their own posts (as long as they are not currently published). However, they do not have access to publish posts or upload images. This seems less likely of a solution if you were wanting them to be able to insert images into their posts or even create sliders to use in their posts.

Author roles have the access to create, edit and publish posts as well as delete posts (including published ones) and upload images. This means they could easily create a slider and insert that into their post as well.

You can give your users the ‘Contributor’ role and easily give them access to upload images and create sliders just by changing their role using either a plugin or a custom function.

Using a plugin

You can use a a free plugin like User Role Editor. This plugin will allow you to manage the permissions each role has.

Using a custom function

Note: Before adding any custom function to your theme it is important to use a child theme first. This will allow you to keep your theme updates current without losing any edits you’ve made to your theme.

For tips on creating a child theme, please visit this article from WPBeginner.

Alternatively, you can use a child theme and a custom function to give users with the Contributor role permission to upload images to all posts and pages (including Soliloquy sliders).

if ( current_user_can('contributor') && !current_user_can('upload_files') )
    add_action('admin_init', 'allow_contributor_uploads');
function allow_contributor_uploads() {
    $contributor = get_role('contributor');
    $contributor->add_cap('upload_files');
}
[i]
[i]