diff --git a/arcHIVE-wp-plugin.php b/arcHIVE-wp-plugin.php index def79b0..7c3716f 100644 --- a/arcHIVE-wp-plugin.php +++ b/arcHIVE-wp-plugin.php @@ -56,6 +56,8 @@ include( ARCHIVE_WPPLUGIN_PATH . 'includes/arcHIVE-init-textdomain.php'); include( ARCHIVE_WPPLUGIN_PATH . 'includes/arcHIVE-enable-svg.php'); +include_once( ARCHIVE_WPPLUGIN_PATH . 'includes/arcHIVE-add-roles.php'); + if ( is_admin() ) { //include_once( plugin_dir_path( __FILE__ ) . 'includes/arcHIVE-admin-stylesheet.php' ); include( ARCHIVE_WPPLUGIN_PATH . 'includes/arcHIVE-admin-stylesheet.php'); diff --git a/includes/arcHIVE-add-roles.php b/includes/arcHIVE-add-roles.php new file mode 100644 index 0000000..9c5c0c3 --- /dev/null +++ b/includes/arcHIVE-add-roles.php @@ -0,0 +1,47 @@ + + */ + + // create new roles on plugin activation + // https://developer.wordpress.org/reference/functions/add_role/ + function archive_wpplugin_add_roles_on_plugin_activation() { + // if ( get_option( 'custom_roles_version' ) < 1 ) { + $resourceeditorcapabilities = array( + 'read' => true, + 'level_0' => true + ); + $resourceauthorcapabilities = array( + 'read' => true, + 'level_0' => true + ); + $resourceauthorcapabilities = array( + 'read' => true, + 'level_0' => true + ); + remove_role('archive_resource_editor'); + add_role( 'archive_resource_editor', 'Resource Editor', $resourceeditorcapabilities ); + remove_role('archive_resource_author'); + add_role( 'archive_resource_author', 'Resource Author', $resourceauthorcapabilities ); + remove_role('archive_resource_contributor'); + add_role( 'archive_resource_contributor', 'Resource Contributor', $resourcecontributorcapabilities ); + // update_option( 'custom_roles_version', 1 );} + } +register_activation_hook( __FILE__, 'archive_wpplugin_add_roles_on_plugin_activation' );