48 lines
1.5 KiB
PHP
48 lines
1.5 KiB
PHP
|
<?php
|
||
|
/**
|
||
|
* Add roles for users
|
||
|
*
|
||
|
* @link https://arc-hive.zone
|
||
|
* @since 1.1.0
|
||
|
*
|
||
|
* @package archive_wpplugin
|
||
|
* @subpackage archive_wpplugin/includes
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* Add roles for users
|
||
|
*
|
||
|
* This class defines all code necessary to run during the plugin's activation.
|
||
|
*
|
||
|
* @since 1.1.0
|
||
|
* @package archive_wpplugin
|
||
|
* @subpackage archive_wpplugin/includes
|
||
|
* @author Jorge - vitrubio.net <jorge@vitrubio.net>
|
||
|
*/
|
||
|
|
||
|
// 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' );
|