From abd33ac8722c01ef42b6773ece38dbfc77486d6c Mon Sep 17 00:00:00 2001 From: Sabbir Ahmed Date: Thu, 26 Apr 2018 09:53:51 +0600 Subject: [PATCH] refactor(permission): Added capability label --- classes/installer.php | 2 +- includes/functions.php | 80 +++++++++++------------ includes/upgrades/dokan-upgrade-2.7.3.php | 2 +- webpack.config.js | 2 +- 4 files changed, 43 insertions(+), 43 deletions(-) diff --git a/classes/installer.php b/classes/installer.php index 6f7fadd041..f4bf93bd12 100755 --- a/classes/installer.php +++ b/classes/installer.php @@ -146,7 +146,7 @@ function user_roles() { $all_cap = dokan_get_all_caps(); foreach( $all_cap as $key=>$cap ) { - $capabilities = array_merge( $capabilities, $cap ); + $capabilities = array_merge( $capabilities, array_keys( $cap ) ); } $wp_roles->add_cap( 'shop_manager', 'dokandar' ); diff --git a/includes/functions.php b/includes/functions.php index 89b8f0531e..3d67ddf73a 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -2494,62 +2494,62 @@ function dokan_get_vendor( $vendor_id = null ) { function dokan_get_all_caps() { $capabilities = array( 'overview' => array( - 'dokan_view_sales_overview', - 'dokan_view_sales_report_chart', - 'dokan_view_announcement', - 'dokan_view_order_report', - 'dokan_view_review_reports', - 'dokan_view_product_status_report', + 'dokan_view_sales_overview' => __( 'View sales overview', 'dokan-lite' ), + 'dokan_view_sales_report_chart' => __( 'View sales report chart', 'dokan-lite' ), + 'dokan_view_announcement' => __( 'View announcement', 'dokan-lite' ), + 'dokan_view_order_report' => __( 'View order report', 'dokan-lite' ), + 'dokan_view_review_reports' => __( 'View review report', 'dokan-lite' ), + 'dokan_view_product_status_report' => __( 'View product status report', 'dokan-lite' ), ), 'report' => array( - 'dokan_view_overview_report', - 'dokan_view_daily_sale_report', - 'dokan_view_top_selling_report', - 'dokan_view_top_earning_report', - 'dokan_view_statement_report', + 'dokan_view_overview_report' => __( 'View overview report', 'dokan-lite' ), + 'dokan_view_daily_sale_report' => __( 'View daily sales report', 'dokan-lite' ), + 'dokan_view_top_selling_report' => __( 'View top selling report', 'dokan-lite' ), + 'dokan_view_top_earning_report' => __( 'View top earning report', 'dokan-lite' ), + 'dokan_view_statement_report' => __( 'View statement report', 'dokan-lite' ), ), 'order' => array( - 'dokan_view_order', - 'dokan_manage_order', - 'dokan_manage_order_note', - 'dokan_manage_refund', + 'dokan_view_order' => __( 'View order', 'dokan-lite' ), + 'dokan_manage_order' => __( 'Manage order', 'dokan-lite' ), + 'dokan_manage_order_note' => __( 'Manage order note', 'dokan-lite' ), + 'dokan_manage_refund' => __( 'Manage refund', 'dokan-lite' ), ), 'coupon' => array( - 'dokan_add_coupon', - 'dokan_edit_coupon', - 'dokan_delete_coupon', + 'dokan_add_coupon' => __( 'Add coupon', 'dokan-lite' ), + 'dokan_edit_coupon' => __( 'Edit coupon', 'dokan-lite' ), + 'dokan_delete_coupon' => __( 'Delete coupon', 'dokan-lite' ), ), 'review' => array( - 'dokan_view_reviews', - 'dokan_manage_reviews', + 'dokan_view_reviews' => __( 'View reviews', 'dokan-lite' ), + 'dokan_manage_reviews' => __( 'Manage reviews', 'dokan-lite' ), ), 'withdraw' => array( - 'dokan_manage_withdraw', + 'dokan_manage_withdraw' => __( 'Manage withdraw', 'dokan-lite' ), ), 'product' => array( - 'dokan_add_product', - 'dokan_edit_product', - 'dokan_delete_product', - 'dokan_view_product', - 'dokan_duplicate_product', - 'dokan_import_product', - 'dokan_export_product', + 'dokan_add_product' => __( 'Add product', 'dokan-lite' ), + 'dokan_edit_product' => __( 'Edit product', 'dokan-lite' ), + 'dokan_delete_product' => __( 'Delete product', 'dokan-lite' ), + 'dokan_view_product' => __( 'View product', 'dokan-lite' ), + 'dokan_duplicate_product' => __( 'Duplicate product', 'dokan-lite' ), + 'dokan_import_product' => __( 'Import product', 'dokan-lite' ), + 'dokan_export_product' => __( 'Export product', 'dokan-lite' ), ), 'menu' => array( - 'dokan_view_overview_menu', - 'dokan_view_product_menu', - 'dokan_view_order_menu', - 'dokan_view_coupon_menu', - 'dokan_view_report_menu', - 'dokan_view_review_menu', - 'dokan_view_withdraw_menu', - 'dokan_view_store_settings_menu', - 'dokan_view_store_payment_menu', - 'dokan_view_store_shipping_menu', - 'dokan_view_store_social_menu', - 'dokan_view_store_seo_menu', + 'dokan_view_overview_menu' => __( 'View overview menu', 'dokan-lite' ), + 'dokan_view_product_menu' => __( 'View product menu', 'dokan-lite' ), + 'dokan_view_order_menu' => __( 'View order menu', 'dokan-lite' ), + 'dokan_view_coupon_menu' => __( 'View coupon menu', 'dokan-lite' ), + 'dokan_view_report_menu' => __( 'View report menu', 'dokan-lite' ), + 'dokan_view_review_menu' => __( 'Vuew review menu', 'dokan-lite' ), + 'dokan_view_withdraw_menu' => __( 'View withdraw menu', 'dokan-lite' ), + 'dokan_view_store_settings_menu' => __( 'View store settings menu', 'dokan-lite' ), + 'dokan_view_store_payment_menu' => __( 'View payment settings menu', 'dokan-lite' ), + 'dokan_view_store_shipping_menu' => __( 'View shipping settings menu', 'dokan-lite' ), + 'dokan_view_store_social_menu' => __( 'View social settings menu', 'dokan-lite' ), + 'dokan_view_store_seo_menu' => __( 'View seo settings menu', 'dokan-lite' ), ) ); diff --git a/includes/upgrades/dokan-upgrade-2.7.3.php b/includes/upgrades/dokan-upgrade-2.7.3.php index 41cd8c30a5..0246214e42 100644 --- a/includes/upgrades/dokan-upgrade-2.7.3.php +++ b/includes/upgrades/dokan-upgrade-2.7.3.php @@ -64,7 +64,7 @@ function dokan_update_user_capabilities_273() { $all_cap = dokan_get_all_caps(); foreach( $all_cap as $key=>$cap ) { - $capabilities = array_merge( $capabilities, $cap ); + $capabilities = array_merge( $capabilities, array_keys( $cap ) ); } foreach ( $capabilities as $key => $capability ) { diff --git a/webpack.config.js b/webpack.config.js index fae82cb745..1daadf0331 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -6,7 +6,7 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin'); const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin'); const BrowserSyncPlugin = require( 'browser-sync-webpack-plugin' ); -const config = require( './config.json' ); +// const config = require( './config.json' ); // Naming and path settings var appName = 'app';