79 lines
2.2 KiB
PHP
79 lines
2.2 KiB
PHP
<?php
|
|
function setup_site_roles()
|
|
{
|
|
remove_role( 'subscriber' ); // Hier 'custom_role_slug' durch den tatsächlichen Slug der zu löschenden Rolle ersetzen
|
|
remove_role( 'contributor' ); // Hier 'custom_role_slug' durch den tatsächlichen Slug der zu löschenden Rolle ersetzen
|
|
remove_role( 'author' ); // Hier 'custom_role_slug' durch den tatsächlichen Slug der zu löschenden Rolle ersetzen
|
|
remove_role( 'editor' ); // Hier 'custom_role_slug' durch den tatsächlichen Slug der zu löschenden Rolle ersetzen
|
|
|
|
$role = get_role( 'director' );
|
|
if ( null === $role ) {
|
|
add_role(
|
|
'director',
|
|
true === get_option( 'solea_used_for_state', false )
|
|
? __( 'State director', 'mareike' )
|
|
: __( 'Club director', 'mareike' ),
|
|
kompass_get_capa_editor()
|
|
);
|
|
} else {
|
|
$role = get_role( 'director' );
|
|
foreach ( kompass_get_capa_editor() as $capability => $value ) {
|
|
$role->add_cap( $capability );
|
|
}
|
|
}
|
|
|
|
add_role( 'author', 'Redakteur', kompass_get_capa_editor() );
|
|
|
|
$role = get_role( 'user' );
|
|
if ( null === $role ) {
|
|
add_role(
|
|
'user',
|
|
'Standardnutzer',
|
|
array('read' => true)
|
|
);
|
|
} else {
|
|
$role->add_cap( 'read' );
|
|
}
|
|
|
|
}
|
|
|
|
function kompass_get_capa_editor() : array
|
|
{
|
|
return [
|
|
'moderate_comments' => true,
|
|
'manage_categories' => true,
|
|
'manage_links' => true,
|
|
'upload_files' => true,
|
|
'unfiltered_html' => true,
|
|
'edit_posts' => true,
|
|
'edit_others_posts' => true,
|
|
'edit_published_posts' => true,
|
|
'publish_posts' => true,
|
|
'edit_pages' => true,
|
|
'read' => true,
|
|
'level_7' => true,
|
|
'level_6' => true,
|
|
'level_5' => true,
|
|
'level_4' => true,
|
|
'level_3' => true,
|
|
'level_2' => true,
|
|
'level_1' => true,
|
|
'level_0' => true,
|
|
'edit_others_pages' => true,
|
|
'edit_published_pages' => true,
|
|
'publish_pages' => true,
|
|
'delete_pages' => true,
|
|
'delete_others_pages' => true,
|
|
'delete_published_pages' => true,
|
|
'delete_posts' => true,
|
|
'delete_others_posts' => true,
|
|
'delete_published_posts' => true,
|
|
'delete_private_posts' => true,
|
|
'edit_private_posts' => true,
|
|
'read_private_posts' => true,
|
|
'delete_private_pages' => true,
|
|
'edit_private_pages' => true,
|
|
'read_private_pages' => true,
|
|
|
|
];
|
|
} |