Add site admin capabilities for multisite

This commit is contained in:
Brian Miyaji
2014-01-24 03:22:48 +11:00
parent ef3136801f
commit 8a2fb895b1
3 changed files with 58 additions and 104 deletions

View File

@@ -0,0 +1,36 @@
<?php
function sportspress_admin_init() {
$post_types = array(
'sp_events',
'sp_calendars',
'sp_teams',
'sp_tables',
'sp_players',
'sp_lists',
'sp_staffs',
'sp_configs',
);
$caps = array(
'publish',
'delete',
'delete_others',
'delete_private',
'delete_published',
'edit',
'edit_others',
'edit_private',
'edit_published',
'read_private',
);
// Site Admin
$administrator = get_role( 'administrator' );
foreach( $post_types as $post_type ):
foreach ( $caps as $cap ):
$administrator->add_cap( $cap . '_' . $post_type );
endforeach;
endforeach;
}
add_action( 'admin_init', 'sportspress_admin_init' );