MiraTech
MiraTech

Reputation: 1352

Assign role to users wordpress

I wanna give a role access to shop manager in my website to use WP LIVE STATISTICS (a wordpress plugin) and check statistics, so can anyone tell me which filter should i use? or any other suggestion? Thank you in advanced!

Upvotes: 0

Views: 104

Answers (2)

MiraTech
MiraTech

Reputation: 1352

Open your child theme functions.php file and add the below code as exactly as given.

remove_action('admin_menu', 'wpls_menu_init');
add_action('admin_menu', 'new_wpls_menu_init');
function new_wpls_menu_init() {
add_menu_page(__('WP Live Stats - Settings','wpls'), __('WP Live Stats','wpls'), 'manage_woocommerce', 'wpls_settings', 'wpls_settings');

add_submenu_page('wpls_settings', __('WPLS Dashboard','menu-wpls'), __('Dashboard','menu-wpls'), 'manage_woocommerce', 'wpls_dashboard', 'wpls_dashboard');

add_submenu_page('wpls_settings', __('Live Visitors','menu-wpls'), __('Live Visitors','menu-wpls'), 'manage_woocommerce', 'wpls_admin_online', 'wpls_admin_online');

add_submenu_page('wpls_settings', __('Visitors','menu-wpls'), __('Visitors','menu-wpls'), 'manage_woocommerce', 'wpls_admin_visitors', 'wpls_admin_visitors');

//add_submenu_page('wpls_settings', __('Top Geo','menu-wpls'), __('Top Geo','menu-wpls'), 'manage_woocommerce', 'wpls_admin_geo', 'wpls_admin_geo');

add_submenu_page('wpls_settings', __('Filter','menu-wpls'), __('Filter Stats','menu-wpls'), 'manage_woocommerce', 'wpls_admin_filter', 'wpls_admin_filter');

}

And this would show WP LIVE STATISTICS to the shop manager!

Upvotes: 1

Naresh Kumar P
Naresh Kumar P

Reputation: 4210

In order to assign user role to the created user you can prefer this plugin and set up the role first for the User - https://wordpress.org/plugins/user-role-editor/

And after that you can use the Adminimize plugin https://wordpress.org/plugins/adminimize/ and you can set the privileges whom you need to show up the plugin when the login is successful at their sign up accounts.

This is one of the easiest method that we have in WordPress to enable differential login based on User Role. Follow the Adminimize Steps to Set privileges for the User Role and Display of Dashboard.

Upvotes: 0

Related Questions