Last active
July 8, 2019 11:09
-
-
Save andykillen/7ac599af9760d0f7831511ce76f28492 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: New User Roles | |
Plugin URI: https://github.com/andykillen | |
Description: Adds additional role(s) | |
Version: 1.0 | |
Author: Andrew Killen | |
*/ | |
function new_user_roles_plugin_activation() { | |
$capibilities = [ | |
'activate_plugins' => false, | |
'delete_others_pages' => true, | |
'delete_others_posts' => true, | |
'delete_pages' => true, | |
'delete_posts' => true, | |
'delete_private_pages' => true, | |
'delete_private_posts' => true, | |
'delete_published_pages' => true, | |
'delete_published_posts' => true, | |
'edit_dashboard' => false, | |
'edit_others_pages' => true, | |
'edit_others_posts' => true, | |
'edit_pages' => true, | |
'edit_posts' => true, | |
'edit_private_pages' => true, | |
'edit_private_posts' => true, | |
'edit_published_pages' => true, | |
'edit_published_posts' => true, | |
'edit_theme_options' => true, | |
'export' => false, | |
'import' => false, | |
'list_users' => true, | |
'manage_categories' => false, | |
'manage_links' => true, | |
'manage_options' => false, | |
'moderate_comments' => true, | |
'promote_users' => true, | |
'publish_pages' => true, | |
'publish_posts' => true, | |
'read_private_pages' => true, | |
'read_private_posts' => true, | |
'read' => true, | |
'remove_users' => true, | |
'switch_themes' => false, | |
'upload_files' => true, | |
'customize' => true, | |
'delete_site' => false, | |
'update_core' => false, | |
'update_plugins' => false, | |
'update_themes' => false, | |
'install_plugins' => false, | |
'install_themes' => false, | |
'upload_plugins' => false, | |
'upload_themes' => false, | |
'delete_themes' => false, | |
'delete_plugins' => false, | |
'edit_plugins' => false, | |
'edit_themes' => false, | |
'edit_files' => false, | |
'edit_users' => true, | |
'create_users' => true, | |
'delete_users' => true, | |
'unfiltered_html' => true, | |
]; | |
add_role( 'business_owner', 'Business Owner', $capibilities); | |
} | |
register_activation_hook( __FILE__, 'new_user_roles_plugin_activation' ); | |
register_deactivation_hook(__FILE__, 'new_user_roles_plugin_deactivation'); | |
function new_user_roles_plugin_deactivation() | |
{ | |
remove_role('business_owner'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment