Created
May 6, 2016 12:39
-
-
Save TwisterMc/e2e358473d0acdf603f1867d34370c65 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
/** | |
* Create custom WordPress Role 'Webmaster' with all Administrator capabilities. | |
* Remember to delete this code when done as it's only needed once. | |
*/ | |
$customRoleName = 'Webmaster'; | |
$customRoleID = 'webmaster'; // No spaces, all lowercase | |
$createCustomRole = add_role( | |
$customRoleID, | |
__( $customRoleName ), | |
array( | |
'activate_plugins' => true, | |
'add_users' => true, | |
'assign_campaign_terms' => true, | |
'assign_give_campaigns_terms' => true, | |
'assign_give_forms_terms' => true, | |
'assign_give_payments_terms' => true, | |
'copy_posts' => true, | |
'create_roles' => true, | |
'create_users' => true, | |
'delete_campaign' => true, | |
'delete_campaign_terms' => true, | |
'delete_campaigns' => true, | |
'delete_donation' => true, | |
'delete_donations' => true, | |
'delete_event_categories' => true, | |
'delete_events' => true, | |
'delete_forums' => true, | |
'delete_funder' => true, | |
'delete_give_campaigns' => true, | |
'delete_give_campaigns_terms' => true, | |
'delete_give_campaignss' => true, | |
'delete_give_forms' => true, | |
'delete_give_forms_terms' => true, | |
'delete_give_formss' => true, | |
'delete_give_payments' => true, | |
'delete_give_payments_terms' => true, | |
'delete_give_paymentss' => true, | |
'delete_locations' => true, | |
'delete_others_campaigns' => true, | |
'delete_others_donations' => true, | |
'delete_others_events' => true, | |
'delete_others_forums' => true, | |
'delete_others_give_campaignss' => true, | |
'delete_others_give_formss' => true, | |
'delete_others_give_paymentss' => true, | |
'delete_others_locations' => true, | |
'delete_others_pages' => true, | |
'delete_others_posts' => true, | |
'delete_others_recurring_events' => true, | |
'delete_others_replies' => true, | |
'delete_others_topics' => true, | |
'delete_pages' => true, | |
'delete_plugins' => true, | |
'delete_posts' => true, | |
'delete_private_campaigns' => true, | |
'delete_private_donations' => true, | |
'delete_private_give_campaignss' => true, | |
'delete_private_give_formss' => true, | |
'delete_private_give_paymentss' => true, | |
'delete_private_pages' => true, | |
'delete_private_posts' => true, | |
'delete_published_campaigns' => true, | |
'delete_published_donations' => true, | |
'delete_published_give_campaignss' => true, | |
'delete_published_give_formss' => true, | |
'delete_published_give_paymentss' => true, | |
'delete_published_pages' => true, | |
'delete_published_posts' => true, | |
'delete_recurring_events' => true, | |
'delete_replies' => true, | |
'delete_roles' => true, | |
'delete_themes' => true, | |
'delete_topics' => true, | |
'delete_users' => true, | |
'edit_campaign' => true, | |
'edit_campaign_terms' => true, | |
'edit_campaigns' => true, | |
'edit_dashboard' => true, | |
'edit_donation' => true, | |
'edit_donations' => true, | |
'edit_event_categories' => true, | |
'edit_events' => true, | |
'edit_files' => true, | |
'edit_forums' => true, | |
'edit_funder' => true, | |
'edit_give_campaigns' => true, | |
'edit_give_campaigns_terms' => true, | |
'edit_give_campaignss' => true, | |
'edit_give_forms' => true, | |
'edit_give_forms_terms' => true, | |
'edit_give_formss' => true, | |
'edit_give_payments' => true, | |
'edit_give_payments_terms' => true, | |
'edit_give_paymentss' => true, | |
'edit_locations' => true, | |
'edit_others_campaigns' => true, | |
'edit_others_donations' => true, | |
'edit_others_events' => true, | |
'edit_others_forums' => true, | |
'edit_others_give_campaignss' => true, | |
'edit_others_give_formss' => true, | |
'edit_others_give_paymentss' => true, | |
'edit_others_locations' => true, | |
'edit_others_pages' => true, | |
'edit_others_posts' => true, | |
'edit_others_recurring_events' => true, | |
'edit_others_replies' => true, | |
'edit_others_topics' => true, | |
'edit_pages' => true, | |
'edit_plugins' => true, | |
'edit_posts' => true, | |
'edit_private_campaigns' => true, | |
'edit_private_donations' => true, | |
'edit_private_give_campaignss' => true, | |
'edit_private_give_formss' => true, | |
'edit_private_give_paymentss' => true, | |
'edit_private_pages' => true, | |
'edit_private_posts' => true, | |
'edit_published_campaigns' => true, | |
'edit_published_donations' => true, | |
'edit_published_give_campaignss' => true, | |
'edit_published_give_formss' => true, | |
'edit_published_give_paymentss' => true, | |
'edit_published_pages' => true, | |
'edit_published_posts' => true, | |
'edit_recurring_events' => true, | |
'edit_roles' => true, | |
'edit_theme_options' => true, | |
'edit_themes' => true, | |
'edit_users' => true, | |
'export' => true, | |
'export_charitable_reports' => true, | |
'export_give_reports' => true, | |
'import' => true, | |
'install_plugins' => true, | |
'install_themes' => true, | |
'level_0' => true, | |
'level_true,' => true, | |
'level_true,0' => true, | |
'level_2' => true, | |
'level_3' => true, | |
'level_4' => true, | |
'level_5' => true, | |
'level_6' => true, | |
'level_7' => true, | |
'level_8' => true, | |
'level_9' => true, | |
'list_roles' => true, | |
'list_users' => true, | |
'manage_bookings' => true, | |
'manage_campaign_terms' => true, | |
'manage_categories' => true, | |
'manage_charitable_settings' => true, | |
'manage_give_campaigns_terms' => true, | |
'manage_give_forms_terms' => true, | |
'manage_give_payments_terms' => true, | |
'manage_give_settings' => true, | |
'manage_links' => true, | |
'manage_options' => true, | |
'manage_others_bookings' => true, | |
'moderate_comments' => true, | |
'promote_users' => true, | |
'publish_campaigns' => true, | |
'publish_donations' => true, | |
'publish_events' => true, | |
'publish_forums' => true, | |
'publish_give_campaignss' => true, | |
'publish_give_formss' => true, | |
'publish_give_paymentss' => true, | |
'publish_locations' => true, | |
'publish_pages' => true, | |
'publish_posts' => true, | |
'publish_recurring_events' => true, | |
'read' => true, | |
'read_campaign' => true, | |
'read_donation' => true, | |
'read_funder' => true, | |
'read_give_campaigns' => true, | |
'read_give_forms' => true, | |
'read_give_payments' => true, | |
'read_others_locations' => true, | |
'read_private_campaigns' => true, | |
'read_private_donations' => true, | |
'read_private_events' => true, | |
'read_private_forms' => true, | |
'read_private_give_campaignss' => true, | |
'read_private_give_formss' => true, | |
'read_private_give_paymentss' => true, | |
'read_private_locations' => true, | |
'read_private_pages' => true, | |
'read_private_posts' => true, | |
'read_private_recurring_events' => true, | |
'read_private_replies' => true, | |
'read_private_topics' => true, | |
'remove_users' => true, | |
'restrict_content' => true, | |
'switch_themes' => true, | |
'unfiltered_html' => true, | |
'unfiltered_upload' => true, | |
'update_core' => true, | |
'update_plugins' => true, | |
'update_themes' => true, | |
'upload_event_images' => true, | |
'upload_files' => true, | |
'ure_create_capabilities' => true, | |
'ure_create_roles' => true, | |
'ure_delete_capabilities' => true, | |
'ure_delete_roles' => true, | |
'ure_edit_roles' => true, | |
'ure_manage_options' => true, | |
'ure_reset_roles' => true, | |
'view_charitable_sensitive_data' => true, | |
'view_give_campaigns_stats' => true, | |
'view_give_forms_stats' => true, | |
'view_give_payments_stats' => true, | |
'view_give_reports' => true, | |
'view_give_sensitive_data' => true, | |
'wdf_add_fundraisers' => true, | |
'wdf_edit_settings' => true, | |
'wdf_manage_all_fundraisers' => true, | |
'wdf_manage_pledges' => true, | |
) | |
); | |
if ( null !== $createCustomRole ) { | |
echo 'Yay! New role' . $customRoleName . ' created!'; | |
} | |
else { | |
echo 'Oh... The ' . $customRoleName . ' role already exists, please delete the code from your site.'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment