WordPress.org

Make WordPress Core

Ticket #17394: test-role.php

File test-role.php, 460 bytes (added by whiteatom, 3 years ago)

Plugin to add test role

Line 
1<?php #/*
2#Plugin Name: Test Role Plugin
3#Description: Adds a single test role 'Test' to demo a WP bug
4#Author: whiteatom
5#Version: 1.0
6
7register_activation_hook(__FILE__, 'create_role' ); // creates roles
8register_deactivation_hook(__FILE__, 'delete_role' );
9
10function create_role(){
11     $editor = get_role('editor');
12     $ed_caps = $editor->capabilities;
13        add_role('test-role', 'Test', $ed_caps);
14}
15
16function delete_role(){
17        remove_role('test-role');
18}
19
20?>