Restrict Access in Admin Panel

I believe the correct solution here is to just update the $capability component of the admin_menu items rather than just remove them from the menu structure. Try this: /** Set ‘administrator’ cap for particular menu items **/ function update_admin_menu() { global $menu, $submenu; $menu[10][1] = ‘administrator’; // Media foreach( $submenu[‘upload.php’] as &$item ) { $item[1] … Read more

How to check user role?

Looking around Google for a few minutes yielded several promising results. Here’s a more detailed one adapted from a snippet on The Code Collective: function get_user_roles( $user_id ) { $user_roles = []; $user = get_userdata( $user_id ); $capabilities = $user->{$wpdb->prefix . ‘capabilities’}; if ( !isset( $wp_roles ) ) { $wp_roles = new WP_Roles(); foreach ( … Read more

Menu page with list of users

As a plugin all that I can give to you is this. <?php /* Plugin Name: Users Table Plugin URI: http://www.exe.ie Description: A list of all available users with their ID, Name, Registration Date, Nickname, User Level and User Role Version: 1.0 Author: Daniel Conde Author URI: http://www.exe.ie License: GPL */ add_action(‘admin_menu’, ‘my_user_table_menu’); function my_user_table_menu() … Read more

WP welcome email depending on user role

Roles are assigned by the admin (or automatically by some theme or plugin) and therefor can not be assigned before the user is manageable by the admin, which doesn’t happen before all the activation stages are completed. Therefor there is not enough info at the signup stage about the user role and you need to … Read more

How to make the Newsletter plugin visible to users with author privileges?

The plugin contains for example these lines: add_menu_page(‘Newsletter’, ‘Newsletter’, ($this->options[‘editor’] == 1) ? ‘manage_categories’ : ‘manage_options’, ‘newsletter_main_index’); add_submenu_page(‘newsletter_main_index’, $title, $title, ($newsletter->options[‘editor’] == 1) ? ‘manage_categories’ : ‘manage_options’, $name, $name); add_submenu_page(null, $title, $title, ($newsletter->options[‘editor’] == 1) ? ‘manage_categories’ : ‘manage_options’, $name, $name); so it looks like you have the option to display the Newsletter menu for … Read more