2 min read 5 days ago

Meow Apps Plugins Access

Each plugin has a special code name (called a prefix) that you’ll use to control what plugin you are customizing. Here’s a quick list of those prefixes to help you out:

PluginPrefixAdditional filters
Database Cleanerdbclnr
AI Enginemwai
Meow Gallerymgl
Meow Lightboxmwl
Media File Renamermfrh
Social Enginesclegn_allow_moderation
Media Cleanerwpmc

We will be using two filters : _allow_setup and _allow_usage .

Setting the Scene with add_filter in functions.php

Want to customize who can do what? It’s all about tweaking the add_filter function in your theme’s functions.php file (or in a snippet plugin). Let’s take the Database Cleaner plugin as an example and set up a few different roles:

// 🎩 Editors and Admins, welcome to the Database Cleaner settings.
add_filter( 'dbclnr_allow_setup', function() {
	  $editors_admins = current_user_can( 'editor' ) || current_user_can( 'administrator' );
    return $editors_admins;
} );

// ✍️ Authors can use all the features in Database Cleaner.
add_filter( 'dbclnr_allow_usage', function() {
    return current_user_can( 'author' );
} );

Feel free to mix and match the roles and plugin prefixes to fit your needs. If you’ve got custom roles, just drop them into the mix like so:

// Custom role "content_manager" gets access to Meow Gallery
add_filter( 'mgl_allow_usage', function() {
    return current_user_can( 'content_manager' );
} );

You can customize this code how you want, if you use third party plugins for role management, you can use them here also.