Change WordPress user roles and capabilities › Forums › Give user access to plugin – how to › Need to Provide Access to Newletter plugin please help!
- This topic has 3 replies, 2 voices, and was last updated 5 years, 4 months ago by Vladimir.
-
AuthorPosts
-
08/07/2019 at 14:30 #5799alijandroParticipant
Hey all if you could help me please. I need to give the author role on my site access to the newsletter plugin. Plugin wordpress homepage is:
Any guidance help here is most appreciated.
08/07/2019 at 21:38 #5800alijandroParticipantThese page permissions are missing: resume_plugins / resume_themes
I have searched the lists for all there worth and cannot find either of these options. The view page permissions states I need these to allow others to view this plugin. Can you help please.
09/07/2019 at 03:00 #5802VladimirKeymasterresume_plugins
and `resume_themes’ capabilities are not created by wordpress as all other WP built-in user capabilities. This capabilities are added by WordPress to the user automatically in case user has correspondent WP default capability:/** * Filters the user capabilities to grant the 'resume_plugins' and 'resume_themes' capabilities as necessary. * * @since 5.2.0 * * @param bool[] $allcaps An array of all the user's capabilities. * @return bool[] Filtered array of the user's capabilities. */ function wp_maybe_grant_resume_extensions_caps( $allcaps ) { // Even in a multisite, regular administrators should be able to resume plugins. if ( ! empty( $allcaps['activate_plugins'] ) ) { $allcaps['resume_plugins'] = true; } // Even in a multisite, regular administrators should be able to resume themes. if ( ! empty( $allcaps['switch_themes'] ) ) { $allcaps['resume_themes'] = true; } return $allcaps; }
As you can see from the code above, user with ‘activate_plugins’ automatically can ‘resume_plugins’ and user with ‘switch_themes’ automatically can ‘resume_themes’.
09/07/2019 at 03:08 #5803VladimirKeymaster‘Newsletter’ plugin was written in special way: it defines admin menu items with virtual capability ‘exist’ which available to any user.
‘Newsletter’ applies/checks permissions before it defines admin menu items. It’s not friendly to the WordPress user capabilities system. It uses directly WordPress built-in roles: administrator or editor (if it’s allowed at the plugin settings page – “Enable access to blog editors”. Parts of menu is available for the ‘administrator’ role only:
function is_allowed() { return current_user_can('administrator') || $this->options['editor'] == 1 && current_user_can('editor'); } function admin_menu() { if (!$this->is_allowed()) return; add_menu_page('Newsletter', 'Newsletter', 'exist', 'newsletter_main_index', '', plugins_url('newsletter') . '/images/menu-icon.png', '30.333'); $this->add_menu_page('index', __('Dashboard', 'newsletter')); $this->add_admin_page('info', __('Company info', 'newsletter')); if (current_user_can('administrator')) { $this->add_menu_page('welcome', __('Welcome', 'newsletter')); $this->add_menu_page('main', __('Settings and More', 'newsletter')); $this->add_admin_page('smtp', 'SMTP'); $this->add_admin_page('status', __('Status', 'newsletter')); } }
So User Role Editor will not help you with access to this plugin for a custom role. It would be possible only after direct editing of the code above and other.
-
AuthorPosts
- You must be logged in to reply to this topic.