A
A
aavbn2020-05-23 23:49:11
WordPress
aavbn, 2020-05-23 23:49:11

Wordpress creating role with plugin access?

You need to create user roles with access to certain plugins
For example, CF7 and Flaingo for the feedback operator

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
WP Panda, 2020-05-24
@wppanda5

You create a user, add a custom role and a custom feature to him. Then for him you close everything except what is allowed, check for a new opportunity. Allow / close as follows
You get a list of plugins like this

global $wp_list_table;
$plugins = $wp_list_table->items;
#Ключами тут являются строки такого вида 'plugin-directory/plugin-file.php' проверять по ним

Then hang yourself on the trail of the filter.
'site_transient_update_plugins' - hide the plugin update
'pre_current_active_plugins' - hide the plugin from the list of plugins
'admin_init' - here you check the current page and deny access to it
, check through current_screen and $_GET
and if it is forbidden, then do this Hide the menu like thiswp_die( 'Доступ запрещен' );
global $menu;
foreach ( $menu as $i => $item ) {
  unset( $menu[ $i ] );
}
#В $item[2] строка вида page.php?param=param_val - проверять по нему

Hook 'admin_menu'
This is an algorithm of how and what to do, if you understand, it will help, if not, then sorry ((write the functionality itself, but it is, there is no desire to waste an hour on it now

L
Lord_Dantes, 2020-05-24
@Lord_Dantes

Install a plugin to hide menu items from the admin panel, and there it seems like you can hide certain items for users.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question