bump version numbor
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 12 Feb 2016 18:42:54 +0000 (13:42 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 12 Feb 2016 18:42:54 +0000 (13:42 -0500)
controllers/admin.php
index.php
models/coupon.php

index e19840d..6dc0131 100644 (file)
@@ -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)
     {
index b77ceea..81ef4d4 100644 (file)
--- 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
  */
index 74e1337..ee8c54d 100644 (file)
@@ -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
             )
         ));
     }