2024-03-16 16:35:18 +01:00
|
|
|
<?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
|
|
|
|
|
2024-07-30 23:06:59 +02:00
|
|
|
$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 );
|
|
|
|
}
|
2024-03-16 16:35:18 +01:00
|
|
|
}
|
|
|
|
|
2024-07-30 23:06:59 +02:00
|
|
|
add_role( 'author', 'Redakteur', kompass_get_capa_editor() );
|
2024-03-16 16:35:18 +01:00
|
|
|
|
2024-07-30 23:06:59 +02:00
|
|
|
$role = get_role( 'user' );
|
|
|
|
if ( null === $role ) {
|
|
|
|
add_role(
|
|
|
|
'user',
|
|
|
|
'Standardnutzer',
|
|
|
|
array('read' => true)
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
foreach ( solea_get_capabilities_user() as $capability => $value ) {
|
|
|
|
$role->add_cap( 'read' );
|
|
|
|
}
|
|
|
|
}
|
2024-03-16 16:35:18 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
|
|
|
];
|
|
|
|
}
|