Add proper permissions to admin role

This commit is contained in:
Brian Miyaji
2014-01-22 05:05:23 +11:00
parent 16677ff2a5
commit 86b06e3ec6
5 changed files with 83 additions and 35 deletions

View File

@@ -4,58 +4,102 @@ function sportspress_activation_hook() {
$role = get_role( 'administrator' ); $role = get_role( 'administrator' );
// Events // Events
$role->add_cap( 'edit_sp_event' );
$role->add_cap( 'edit_sp_events' );
$role->add_cap( 'edit_others_sp_events' );
$role->add_cap( 'delete_sp_event' );
$role->add_cap( 'publish_sp_events' );
$role->add_cap( 'read_sp_events' ); $role->add_cap( 'read_sp_events' );
$role->add_cap( 'read_private_sp_events' ); $role->add_cap( 'read_private_sp_events' );
$role->add_cap( 'edit_sp_event' );
$role->add_cap( 'edit_sp_events' );
$role->add_cap( 'edit_published_sp_events' );
$role->add_cap( 'edit_private_sp_events' );
$role->add_cap( 'edit_others_sp_events' );
$role->add_cap( 'delete_sp_event' );
$role->add_cap( 'delete_published_sp_events' );
$role->add_cap( 'delete_private_sp_events' );
$role->add_cap( 'delete_others_sp_events' );
$role->add_cap( 'publish_sp_events' );
// Calendars
$role->add_cap( 'read_sp_calendars' );
$role->add_cap( 'read_private_sp_calendars' );
$role->add_cap( 'edit_sp_calendar' );
$role->add_cap( 'edit_sp_calendars' );
$role->add_cap( 'edit_published_sp_calendars' );
$role->add_cap( 'edit_private_sp_calendars' );
$role->add_cap( 'edit_others_sp_calendars' );
$role->add_cap( 'delete_sp_calendar' );
$role->add_cap( 'delete_published_sp_calendars' );
$role->add_cap( 'delete_private_sp_calendars' );
$role->add_cap( 'delete_others_sp_calendars' );
$role->add_cap( 'publish_sp_calendars' );
// Teams // Teams
$role->add_cap( 'edit_sp_team' );
$role->add_cap( 'edit_sp_teams' );
$role->add_cap( 'edit_others_sp_teams' );
$role->add_cap( 'delete_sp_team' );
$role->add_cap( 'publish_sp_teams' );
$role->add_cap( 'read_sp_teams' ); $role->add_cap( 'read_sp_teams' );
$role->add_cap( 'read_private_sp_teams' ); $role->add_cap( 'read_private_sp_teams' );
$role->add_cap( 'edit_sp_team' );
$role->add_cap( 'edit_sp_teams' );
$role->add_cap( 'edit_published_sp_teams' );
$role->add_cap( 'edit_private_sp_teams' );
$role->add_cap( 'edit_others_sp_teams' );
$role->add_cap( 'delete_sp_team' );
$role->add_cap( 'delete_published_sp_teams' );
$role->add_cap( 'delete_private_sp_teams' );
$role->add_cap( 'delete_others_sp_teams' );
$role->add_cap( 'publish_sp_teams' );
// League Tables // League Tables
$role->add_cap( 'edit_sp_table' );
$role->add_cap( 'edit_sp_tables' );
$role->add_cap( 'edit_others_sp_tables' );
$role->add_cap( 'delete_sp_table' );
$role->add_cap( 'publish_sp_tables' );
$role->add_cap( 'read_sp_tables' ); $role->add_cap( 'read_sp_tables' );
$role->add_cap( 'read_private_sp_tables' ); $role->add_cap( 'read_private_sp_tables' );
$role->add_cap( 'edit_sp_table' );
$role->add_cap( 'edit_sp_tables' );
$role->add_cap( 'edit_published_sp_tables' );
$role->add_cap( 'edit_private_sp_tables' );
$role->add_cap( 'edit_others_sp_tables' );
$role->add_cap( 'delete_sp_table' );
$role->add_cap( 'delete_published_sp_tables' );
$role->add_cap( 'delete_private_sp_tables' );
$role->add_cap( 'delete_others_sp_tables' );
$role->add_cap( 'publish_sp_tables' );
// Players // Players
$role->add_cap( 'edit_sp_player' );
$role->add_cap( 'edit_sp_players' );
$role->add_cap( 'edit_others_sp_players' );
$role->add_cap( 'delete_sp_player' );
$role->add_cap( 'publish_sp_players' );
$role->add_cap( 'read_sp_players' ); $role->add_cap( 'read_sp_players' );
$role->add_cap( 'read_private_sp_players' ); $role->add_cap( 'read_private_sp_players' );
$role->add_cap( 'edit_sp_player' );
$role->add_cap( 'edit_sp_players' );
$role->add_cap( 'edit_published_sp_players' );
$role->add_cap( 'edit_private_sp_players' );
$role->add_cap( 'edit_others_sp_players' );
$role->add_cap( 'delete_sp_player' );
$role->add_cap( 'delete_published_sp_players' );
$role->add_cap( 'delete_private_sp_players' );
$role->add_cap( 'delete_others_sp_players' );
$role->add_cap( 'publish_sp_players' );
// Player Lists // Player Lists
$role->add_cap( 'edit_sp_list' );
$role->add_cap( 'edit_sp_lists' );
$role->add_cap( 'edit_others_sp_lists' );
$role->add_cap( 'delete_sp_list' );
$role->add_cap( 'publish_sp_lists' );
$role->add_cap( 'read_sp_lists' ); $role->add_cap( 'read_sp_lists' );
$role->add_cap( 'read_private_sp_lists' ); $role->add_cap( 'read_private_sp_lists' );
$role->add_cap( 'edit_sp_list' );
$role->add_cap( 'edit_sp_lists' );
$role->add_cap( 'edit_published_sp_lists' );
$role->add_cap( 'edit_private_sp_lists' );
$role->add_cap( 'edit_others_sp_lists' );
$role->add_cap( 'delete_sp_list' );
$role->add_cap( 'delete_published_sp_lists' );
$role->add_cap( 'delete_private_sp_lists' );
$role->add_cap( 'delete_others_sp_lists' );
$role->add_cap( 'publish_sp_lists' );
// Staff // Staff
$role->add_cap( 'edit_sp_staff' );
$role->add_cap( 'edit_sp_staffs' );
$role->add_cap( 'edit_others_sp_staffs' );
$role->add_cap( 'delete_sp_staff' );
$role->add_cap( 'publish_sp_staffs' );
$role->add_cap( 'read_sp_staffs' ); $role->add_cap( 'read_sp_staffs' );
$role->add_cap( 'read_private_sp_staffs' ); $role->add_cap( 'read_private_sp_staffs' );
$role->add_cap( 'edit_sp_staff' );
$role->add_cap( 'edit_sp_staffs' );
$role->add_cap( 'edit_published_sp_staffs' );
$role->add_cap( 'edit_private_sp_staffs' );
$role->add_cap( 'edit_others_sp_staffs' );
$role->add_cap( 'delete_sp_staff' );
$role->add_cap( 'delete_published_sp_staffs' );
$role->add_cap( 'delete_private_sp_staffs' );
$role->add_cap( 'delete_others_sp_staffs' );
$role->add_cap( 'publish_sp_staffs' );
// Settings // Settings
$role->add_cap( 'read_sp_configs' ); $role->add_cap( 'read_sp_configs' );

View File

@@ -14,7 +14,7 @@ function sportspress_calendar_post_init() {
'rewrite' => array( 'slug' => get_option( 'sp_calendar_slug', 'calendars' ) ), 'rewrite' => array( 'slug' => get_option( 'sp_calendar_slug', 'calendars' ) ),
'show_in_menu' => 'edit.php?post_type=sp_event', 'show_in_menu' => 'edit.php?post_type=sp_event',
'show_in_admin_bar' => true, 'show_in_admin_bar' => true,
// 'capability_type' => 'sp_calendar' 'capability_type' => 'sp_calendar'
); );
register_post_type( 'sp_calendar', $args ); register_post_type( 'sp_calendar', $args );
} }

View File

@@ -14,7 +14,7 @@ function sportspress_table_post_init() {
'rewrite' => array( 'slug' => get_option( 'sp_table_slug', 'tables' ) ), 'rewrite' => array( 'slug' => get_option( 'sp_table_slug', 'tables' ) ),
'show_in_menu' => 'edit.php?post_type=sp_team', 'show_in_menu' => 'edit.php?post_type=sp_team',
'show_in_admin_bar' => true, 'show_in_admin_bar' => true,
// 'capability_type' => 'sp_table' 'capability_type' => 'sp_table'
); );
register_post_type( 'sp_table', $args ); register_post_type( 'sp_table', $args );
} }

View File

@@ -3,7 +3,7 @@ Contributors: themeboy
Tags: sports, sports journalism, teams, team management, fixtures, results, standings, league tables, leagues, reporting, themeboy, wordpress sports, configurable Tags: sports, sports journalism, teams, team management, fixtures, results, standings, league tables, leagues, reporting, themeboy, wordpress sports, configurable
Requires at least: 3.5 Requires at least: 3.5
Tested up to: 3.8 Tested up to: 3.8
Stable tag: 0.1.5 Stable tag: 0.1.6
License: GPLv3 License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -11,6 +11,10 @@ SportsPress is a flexible sports management plugin that adds team management fun
== Changelog == == Changelog ==
= 0.1.6 =
* Tweak - Activate per post type permissions.
* Tweak - Give admin all permissions for custom posts.
= 0.1.5 = = 0.1.5 =
* Tweak - Remove flag images to lighten download size. * Tweak - Remove flag images to lighten download size.

View File

@@ -6,7 +6,7 @@
Plugin Name: SportsPress Plugin Name: SportsPress
Plugin URI: http://themeboy.com/sportspress Plugin URI: http://themeboy.com/sportspress
Description: Manage your club and its players, staff, events, league tables, and player lists. Description: Manage your club and its players, staff, events, league tables, and player lists.
Version: 0.1.3 Version: 0.1.6
Author: ThemeBoy Author: ThemeBoy
Author URI: http://themeboy.com/ Author URI: http://themeboy.com/
License: GPLv3 License: GPLv3
@@ -18,7 +18,7 @@ if ( !function_exists( 'add_action' ) ) {
exit; exit;
} }
define( 'SPORTSPRESS_VERSION', '0.1.3' ); define( 'SPORTSPRESS_VERSION', '0.1.6' );
define( 'SPORTSPRESS_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); define( 'SPORTSPRESS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'SPORTSPRESS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); define( 'SPORTSPRESS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
define( 'SPORTSPRESS_PLUGIN_FILE', __FILE__ ); define( 'SPORTSPRESS_PLUGIN_FILE', __FILE__ );