From: Steve Sutton Date: Fri, 12 Feb 2016 18:42:54 +0000 (-0500) Subject: bump version numbor X-Git-Tag: v1.1.3^2 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=f684ac024f572c4173b0bfae378e64adf4d0b506;p=WP-Plugins%2Fglm-coupons.git bump version numbor --- diff --git a/controllers/admin.php b/controllers/admin.php index e19840d..6dc0131 100644 --- a/controllers/admin.php +++ b/controllers/admin.php @@ -11,6 +11,21 @@ class glm_coupon_admin public $pluginDirName; public $wpdb; + static public function activate_plugin() + { + glm_coupon_admin::add_capability(); + } + + static public function add_capability() + { + $roles = get_editable_roles(); + foreach ($GLOBALS['wp_roles']->role_objects as $key => $role) { + if (isset($roles[$key]) && $role->has_cap(GLM_COUPON_BUILTIN_CAPABILITIES)) { + $role->add_cap(GLM_COUPON_TERM_CAPABILITIES); + } + } + } + public function __construct($path, $wpdb) { diff --git a/index.php b/index.php index b77ceea..81ef4d4 100644 --- a/index.php +++ b/index.php @@ -2,7 +2,7 @@ /** * Plugin Name: Gaslight Media Coupons * Description: Coupon Application for Gaslight Media Clients. - * Version: 0.1.2 Beta + * Version: 0.1.3 Beta * Author: Steve Sutton * Author URI: http://www.gaslightmedia.com * License: All right reserved @@ -18,6 +18,13 @@ define('GLM_COUPON_VERSION', '0.0.5'); define('GLM_COUPON_VERSION_OPTION_NAME', 'glm_coupons_db_version'); define('GLM_COUPON_POST_TYPE', 'glm_coupons'); define('GLM_COUPON_TAX_CATEGORIES', 'glm_couponscategory'); +define('GLM_COUPON_BUILTIN_CAPABILITIES', 'edit_posts'); +define('GLM_COUPON_TERM_CAPABILITIES', 'manage_glmcouponterms'); + +/* Register Activation or Deactivation hooks + */ +register_activation_hook(__FILE__, array('glm_coupon_admin', 'activate_plugin')); + /** * Required class files */ diff --git a/models/coupon.php b/models/coupon.php index 74e1337..ee8c54d 100644 --- a/models/coupon.php +++ b/models/coupon.php @@ -430,10 +430,10 @@ class glm_coupons_coupon 'show_admin_column' => true, '_builtin' => true, 'capabilities' => array( - 'manage_terms' => 'manage_glmcouponterms', - 'edit_terms' => 'manage_glmcouponterms', - 'delete_terms' => 'manage_glmcouponterms', - 'assign_terms' => 'manage_glmcouponterms' + 'manage_terms' => GLM_COUPON_TERM_CAPABILITIES, + 'edit_terms' => GLM_COUPON_TERM_CAPABILITIES, + 'delete_terms' => GLM_COUPON_TERM_CAPABILITIES, + 'assign_terms' => GLM_COUPON_TERM_CAPABILITIES ) )); }