Added new user roles
This commit is contained in:
parent
bee1f6c96c
commit
d2c74a158a
@ -65,4 +65,4 @@ function enqueue_custom_password_js() {
|
||||
]);
|
||||
}
|
||||
|
||||
#add_action( 'after_setup_theme', 'register_custom_theme_directory' );
|
||||
add_action( 'after_setup_theme', 'kompass_after_setup_theme' );
|
||||
|
@ -1,7 +1,7 @@
|
||||
<h4>Version 4.3.8</h4>
|
||||
<ul>
|
||||
<li>Google- und Bing-Verifizierung nun auch im Plugin möglich</li>
|
||||
|
||||
<li>Neue Nutzerrollen</li>
|
||||
</ul>
|
||||
|
||||
<h4>Version 4.3.7</h4>
|
||||
|
@ -3,5 +3,6 @@ require_once (ABSPATH . '/wp-admin/includes/plugin.php');
|
||||
require_once (ABSPATH . '/wp-admin/includes/class-wp-filesystem-base.php');
|
||||
require_once (ABSPATH . '/wp-admin/includes/class-wp-filesystem-direct.php');
|
||||
require_once (ABSPATH . '/wp-includes/pluggable.php');
|
||||
require_once (ABSPATH . '/wp-includes/capabilities.php');
|
||||
require_once (ABSPATH . '/wp-admin/includes/template.php');
|
||||
require_once (ABSPATH . '/wp-admin/includes/file.php');
|
102
includes/roles.php
Normal file
102
includes/roles.php
Normal file
@ -0,0 +1,102 @@
|
||||
<?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
|
||||
$capabilities = array(
|
||||
'read' => true, // Die Rolle kann Beiträge lesen
|
||||
'edit_posts' => true, // Die Rolle kann Beiträge bearbeiten
|
||||
'delete_posts' => true, // Die Rolle kann Beiträge löschen
|
||||
'publish_posts' => true, // Die Rolle kann Beiträge veröffentlichen
|
||||
// Weitere Berechtigungen können nach Bedarf hinzugefügt werden
|
||||
);
|
||||
|
||||
// Rolle hinzufügen
|
||||
add_role( 'stafue', 'Stammesführung', kompass_get_capa_stafue() );
|
||||
add_role( 'grufue', 'Gruppenführung', kompass_get_capa_grufue() );
|
||||
add_role( 'aktionsleitung', 'Aktionsleitung', kompass_get_capa_aktionsleitung() );
|
||||
add_role( 'author', 'Redakteur', kompass_get_capa_editor() );
|
||||
|
||||
$role = get_role( 'administrator' );
|
||||
foreach (kompass_get_capa_stafue() as $capability => $value) {
|
||||
$role->add_cap( $capability );
|
||||
}
|
||||
}
|
||||
|
||||
function kompass_get_capa_stafue() : array
|
||||
{
|
||||
return array_merge(
|
||||
[
|
||||
'create_groups' => true,
|
||||
'delete_groups' => true,
|
||||
'edit_groups' => true,
|
||||
'delete_teilis' => true,
|
||||
'move_teilis' => true,
|
||||
'create_events' => true,
|
||||
], kompass_get_capa_aktionsleitung(), kompass_get_capa_grufue(), kompass_get_capa_editor());
|
||||
}
|
||||
|
||||
|
||||
|
||||
function kompass_get_capa_aktionsleitung() : array
|
||||
{
|
||||
return [
|
||||
'create_event_teilis' => true,
|
||||
'edit_event_teilis' => true,
|
||||
'delete_event_teilis' => true,
|
||||
'send_event_mails' => true,
|
||||
];
|
||||
}
|
||||
|
||||
function kompass_get_capa_grufue() : array
|
||||
{
|
||||
return [
|
||||
'create_teilis' => true,
|
||||
'edit_teilis' => true,
|
||||
'send_mails' => true
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
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,
|
||||
|
||||
];
|
||||
}
|
@ -13,8 +13,10 @@ require_once dirname(__FILE__) . '/update.class.php';
|
||||
|
||||
require_once BDP_LV_PLUGIN_DIR . 'includes/FileAccess.class.php';
|
||||
require_once BDP_LV_PLUGIN_DIR . 'includes/WpConfigEditor.class.php';
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/includes/roles.php');
|
||||
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/includes/filters.php');
|
||||
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/lib/ics-parser/Event.php');
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/lib/ics-parser/ICal.php');
|
||||
|
||||
@ -37,6 +39,12 @@ function bdp_kompass_load_plugin_textdomain() {
|
||||
}
|
||||
|
||||
|
||||
function kompass_after_setup_theme()
|
||||
{
|
||||
setup_site_roles();
|
||||
#register_custom_theme_directory();
|
||||
|
||||
}
|
||||
|
||||
|
||||
$loginHandler = new LoginHandler();
|
||||
|
Loading…
Reference in New Issue
Block a user