From 591e15e29ba749ebc4841f7f699e40eff5b47846 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Fri, 22 Jan 2016 11:14:08 -0500 Subject: [PATCH] Add capabilities and fix form action Form action now set to the actual page url. Adding post type capabilities for the CPT of glmcoupon. Adding capabalities requried for the terms of the coupons. Need to add the creation of the capability as it is not automatically added by wordpress like the CPT are. --- models/coupon.php | 22 +++++++++++++++++++--- views/front/couponList.php | 2 +- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/models/coupon.php b/models/coupon.php index db14ac5..86be705 100644 --- a/models/coupon.php +++ b/models/coupon.php @@ -319,9 +319,19 @@ class glm_coupons_coupon 'supports' => array('title', 'editor', 'thumbnail', 'author'), 'has_archive' => true, 'menu_icon' => 'dashicons-products', - 'capability_type' => 'post', + 'capability_type' => 'glmcoupon', + 'capabilities' => array( + 'edit_post' => 'edit_glmcoupon', + 'edit_posts' => 'edit_glmcoupons', + 'edit_others_posts' => 'edit_others_glmcoupons', + 'publish_posts' => 'publish_glmcoupons', + 'read_private_posts' => 'read_private_glmcoupons', + 'delete_post' => 'delete_glmcoupon', + 'read_post' => 'read_glmcoupon' + ), + 'map_meta_cap' => true, 'hierarchical' => false, - 'rewrite' => array('slug' => 'coupons'), + 'rewrite' => array('slug' => 'glmcoupons'), 'taxonomies' => array(GLM_COUPON_TAX_CATEGORIES), 'show_in_menu' => true, 'show_ui' => true, @@ -412,7 +422,13 @@ class glm_coupons_coupon 'query_var' => GLM_COUPON_TAX_CATEGORIES, 'rewrite' => array('slug' => GLM_COUPON_TAX_CATEGORIES), 'show_admin_column' => true, - '_builtin' => true + '_builtin' => true, + 'capabilities' => array( + 'manage_terms' => 'manage_glmcouponterms', + 'edit_terms' => 'manage_glmcouponterms', + 'delete_terms' => 'manage_glmcouponterms', + 'assign_terms' => 'manage_glmcouponterms' + ) )); } diff --git a/views/front/couponList.php b/views/front/couponList.php index d599397..17bc2d1 100644 --- a/views/front/couponList.php +++ b/views/front/couponList.php @@ -1,6 +1,6 @@

List Coupons

-
+