From 208089d4dbf476f1cd6209bcaa84edd69cec45eb Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Sat, 14 Jun 2014 18:09:48 +1000 Subject: [PATCH] Display SP in admin menu for league managers --- includes/admin/class-sp-admin-menus.php | 4 +++- includes/admin/settings/class-sp-settings-general.php | 5 ++--- includes/class-sp-install.php | 2 +- includes/class-sp-post-types.php | 4 ++-- sportspress.php | 8 ++++---- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/includes/admin/class-sp-admin-menus.php b/includes/admin/class-sp-admin-menus.php index 3be19d52..67ad57c3 100644 --- a/includes/admin/class-sp-admin-menus.php +++ b/includes/admin/class-sp-admin-menus.php @@ -25,7 +25,9 @@ class SP_Admin_Menus { add_action( 'admin_menu', array( $this, 'admin_menu' ), 6 ); add_action( 'admin_menu', array( $this, 'leagues_menu' ), 7 ); add_action( 'admin_menu', array( $this, 'seasons_menu' ), 8 ); - add_action( 'admin_menu', array( $this, 'status_menu' ), 20 ); + + if ( current_user_can( 'manage_options' ) ) + add_action( 'admin_menu', array( $this, 'status_menu' ), 20 ); if ( apply_filters( 'sportspress_show_addons_page', false ) ) // Make true to display by default add_action( 'admin_menu', array( $this, 'addons_menu' ), 70 ); diff --git a/includes/admin/settings/class-sp-settings-general.php b/includes/admin/settings/class-sp-settings-general.php index db54059d..d88165b9 100644 --- a/includes/admin/settings/class-sp-settings-general.php +++ b/includes/admin/settings/class-sp-settings-general.php @@ -27,8 +27,8 @@ class SP_Settings_General extends SP_Settings_Page { add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 ); add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) ); add_action( 'sportspress_admin_field_country', array( $this, 'country_setting' ) ); - add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) ); add_action( 'sportspress_admin_field_frontend_styles', array( $this, 'frontend_styles_setting' ) ); + add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) ); } /** @@ -237,10 +237,9 @@ class SP_Settings_General extends SP_Settings_Page { * @param mixed $name * @param mixed $id * @param mixed $value - * @param string $desc (default: '') * @return void */ - function color_picker( $name, $id, $value, $desc = '' ) { + function color_picker( $name, $id, $value ) { echo '
' . esc_html( $name ) . '
'; diff --git a/includes/class-sp-install.php b/includes/class-sp-install.php index e7757a3f..cb250677 100644 --- a/includes/class-sp-install.php +++ b/includes/class-sp-install.php @@ -347,7 +347,6 @@ class SP_Install { foreach ( $cap_group as $cap ): $wp_roles->add_cap( 'sp_league_manager', $cap ); $wp_roles->add_cap( 'administrator', $cap ); - $wp_roles->add_cap( 'administrator', 'manage_sportspress' ); endforeach; endforeach; endif; @@ -364,6 +363,7 @@ class SP_Install { $capabilities = array(); $capabilities['core'] = array( + 'manage_sportspress', 'view_sportspress_reports', 'edit_sp_player_statistics', 'edit_sp_team_columns', diff --git a/includes/class-sp-post-types.php b/includes/class-sp-post-types.php index a44b8fce..38c0bc16 100644 --- a/includes/class-sp-post-types.php +++ b/includes/class-sp-post-types.php @@ -9,8 +9,8 @@ if ( ! defined( 'ABSPATH' ) ) { * Registers post types and taxonomies * * @class SP_Post_types - * @version 0.7 - * @package SportsPress/Classes/Products + * @version 1.0.5 + * @package SportsPress/Classes * @category Class * @author ThemeBoy */ diff --git a/sportspress.php b/sportspress.php index 49427c23..b5fd39cb 100644 --- a/sportspress.php +++ b/sportspress.php @@ -3,7 +3,7 @@ * Plugin Name: SportsPress * Plugin URI: http://themeboy.com/sportspress/ * Description: Manage your club and its players, staff, events, league tables, and player lists. - * Version: 1.0.4 + * Version: 1.0.5 * Author: ThemeBoy * Author URI: http://themeboy.com/ * Requires at least: 3.8 @@ -123,7 +123,7 @@ final class SportsPress { } /** - * Show action links on the plugin screen + * Show action links on the plugin screen. * * @param mixed $links * @return array @@ -172,7 +172,7 @@ final class SportsPress { } /** - * Define SP Constants + * Define SP Constants. */ private function define_constants() { define( 'SP_PLUGIN_FILE', __FILE__ ); @@ -282,7 +282,7 @@ final class SportsPress { } /** - * Ensure theme and server variable compatibility and setup image sizes.. + * Ensure theme and server variable compatibility and setup image sizes. */ public function setup_environment() { add_theme_support( 'post-thumbnails' );