$submenu_items Associative array of submenu items.
+ * @param string $menu_key Key of the corresponding menu.
+ */
+ $submenu_items = apply_filters( 'dokan_dashboard_nav_submenu', $submenu_items, $nav_key );
+
+ if ( empty( $submenu_items ) ) {
+ continue;
+ }
+
+ foreach ( $submenu_items as $key => $submenu ) {
+ if ( ! isset( $submenu['pos'] ) ) {
+ $submenu['pos'] = 200;
+ }
+
+ $submenu_items[ $key ] = $submenu;
+ }
+
+ // Sort items according to positional value
+ uasort( $submenu_items, 'dokan_nav_sort_by_pos' );
+
+ // Filter items according to permissions
+ $submenu_items = array_filter( $submenu_items, 'dokan_check_menu_permission' );
+
+ // Manage a menu with submenus after permission check
+ if ( count( $submenu_items ) < 1 ) {
+ unset( $nav_menus[ $nav_key ] );
+ } else {
+ $nav_menus[ $nav_key ]['submenu'] = $submenu_items;
+ }
+ }
+
+ // Sort items according to positional value
+ uasort( $nav_menus, 'dokan_nav_sort_by_pos' );
+
+ // Filter the main menu according to permission
+ $nav_menus = array_filter( $nav_menus, 'dokan_check_menu_permission' );
+
+ return $nav_menus;
+}
+
+/**
+ * Checking menu permissions
+ *
+ * @since 2.7.3
+ * @since DOKAN_SINCE moved this method from includes/template-tags.php
+ *
+ * @return boolean
+ */
+function dokan_check_menu_permission( $menu ) {
+ if ( isset( $menu['permission'] ) && ! current_user_can( $menu['permission'] ) ) {
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Renders the Dokan dashboard menu
+ *
+ * For settings menu, the active menu format is `settings/menu_key_name`.
+ * The active menu will be split at `/` and the `menu_key_name` will be matched
+ * with a settings sub menu array. If it's a match, the settings menu will be shown
+ * only. Otherwise, the main navigation menu will be shown.
+ *
+ * @since DOKAN_SINCE moved this method from includes/template-tags.php
+ *
+ * @param string $active_menu
+ *
+ * @return string rendered menu HTML
+ */
+function dokan_dashboard_nav( $active_menu = '' ) {
+ $nav_menu = dokan_get_dashboard_nav();
+ $active_menu_parts = explode( '/', $active_menu );
+ $active_submenu = '';
+
+ if ( $active_menu && false !== strpos( $active_menu, '/' ) ) {
+ $active_menu = $active_menu_parts[0];
+ $active_submenu = $active_menu_parts[1];
+ }
+
+ $menu = '';
+ $hamburger_menu = apply_filters( 'dokan_load_hamburger_menu', true );
+
+ if ( $hamburger_menu ) {
+ $menu .= '';
+ $hamburger = apply_filters(
+ 'dokan_vendor_dashboard_menu_hamburger',
+ ''
+ );
+
+ $menu .= $hamburger;
+ }
+
+ $menu .= '';
+
+ if ( $hamburger_menu ) {
+ $menu .= '
';
+ }
+
+ return $menu;
+}
diff --git a/includes/functions.php b/includes/functions.php
index 42f0ff66f6..f68e2b465e 100755
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -1131,18 +1131,17 @@ function dokan_redirect_to_register() {
/**
* Check if the seller is enabled
*
+ * @since DOKAN_SINCE New filter added `dokan_is_seller_enabled`
+ *
* @param int $user_id
*
* @return bool
*/
-function dokan_is_seller_enabled( $user_id ) {
- $selling = get_user_meta( $user_id, 'dokan_enable_selling', true );
-
- if ( $selling === 'yes' ) {
- return true;
- }
-
- return false;
+function dokan_is_seller_enabled( $user_id ): bool {
+ return apply_filters(
+ 'dokan_is_seller_enabled',
+ 'yes' === get_user_meta( $user_id, 'dokan_enable_selling', 'no' )
+ );
}
/**
diff --git a/includes/template-tags.php b/includes/template-tags.php
index 4b8b595032..01fd7a62e2 100755
--- a/includes/template-tags.php
+++ b/includes/template-tags.php
@@ -384,275 +384,6 @@ function dokan_order_listing_status_filter() {
array(
- 'title' => __( 'Dashboard', 'dokan-lite' ),
- 'icon' => '',
- 'url' => dokan_get_navigation_url(),
- 'pos' => 10,
- 'permission' => 'dokan_view_overview_menu',
- ),
- 'products' => array(
- 'title' => __( 'Products', 'dokan-lite' ),
- 'icon' => '',
- 'url' => dokan_get_navigation_url( 'products' ),
- 'pos' => 30,
- 'permission' => 'dokan_view_product_menu',
- ),
- 'orders' => array(
- 'title' => __( 'Orders', 'dokan-lite' ),
- 'icon' => '',
- 'url' => dokan_get_navigation_url( 'orders' ),
- 'pos' => 50,
- 'permission' => 'dokan_view_order_menu',
- ),
- 'withdraw' => array(
- 'title' => __( 'Withdraw', 'dokan-lite' ),
- 'icon' => '',
- 'url' => dokan_get_navigation_url( 'withdraw' ),
- 'pos' => 70,
- 'permission' => 'dokan_view_withdraw_menu',
- ),
- 'settings' => array(
- 'title' => __( 'Settings', 'dokan-lite' ),
- 'icon' => '',
- 'url' => dokan_get_navigation_url( 'settings/store' ),
- 'pos' => 200,
- ),
- );
-
- $settings_sub = array(
- 'store' => array(
- 'title' => __( 'Store', 'dokan-lite' ),
- 'icon' => '',
- 'url' => dokan_get_navigation_url( 'settings/store' ),
- 'pos' => 30,
- 'permission' => 'dokan_view_store_settings_menu',
- ),
- 'payment' => array(
- 'title' => __( 'Payment', 'dokan-lite' ),
- 'icon' => '',
- 'url' => dokan_get_navigation_url( 'settings/payment' ),
- 'pos' => 50,
- 'permission' => 'dokan_view_store_payment_menu',
- ),
- );
-
- /**
- * Filter to get the seller dashboard settings navigation.
- *
- * @since 2.2
- *
- * @param array.
- */
- $menus['settings']['submenu'] = apply_filters( 'dokan_get_dashboard_settings_nav', $settings_sub );
-
- /**
- * Filters nav menu items.
- *
- * @param array $menus
- */
- $nav_menus = apply_filters( 'dokan_get_dashboard_nav', $menus );
-
- foreach ( $nav_menus as $nav_key => $menu ) {
- if ( ! isset( $menu['pos'] ) ) {
- $nav_menus[ $nav_key ]['pos'] = 190;
- }
-
- $submenu_items = empty( $menu['submenu'] ) ? [] : $menu['submenu'];
-
- /**
- * Filters the vendor dashboard submenu item for each menu.
- *
- * @since 3.7.7
- *
- * @param array $submenu_items Associative array of submenu items.
- * @param string $menu_key Key of the corresponding menu.
- */
- $submenu_items = apply_filters( 'dokan_dashboard_nav_submenu', $submenu_items, $nav_key );
-
- if ( empty( $submenu_items ) ) {
- continue;
- }
-
- foreach ( $submenu_items as $key => $submenu ) {
- if ( ! isset( $submenu['pos'] ) ) {
- $submenu['pos'] = 200;
- }
-
- $submenu_items[ $key ] = $submenu;
- }
-
- // Sort items according to positional value
- uasort( $submenu_items, 'dokan_nav_sort_by_pos' );
-
- // Filter items according to permissions
- $submenu_items = array_filter( $submenu_items, 'dokan_check_menu_permission' );
-
- // Manage menu with submenus after permission check
- if ( count( $submenu_items ) < 1 ) {
- unset( $nav_menus[ $nav_key ] );
- } else {
- $nav_menus[ $nav_key ]['submenu'] = $submenu_items;
- }
- }
-
- // Sort items according to positional value
- uasort( $nav_menus, 'dokan_nav_sort_by_pos' );
-
- // Filter main menu according to permission
- $nav_menus = array_filter( $nav_menus, 'dokan_check_menu_permission' );
-
- return $nav_menus;
-}
-
-/**
- * Checking menu permissions
- *
- * @since 2.7.3
- *
- * @return boolean
- */
-function dokan_check_menu_permission( $menu ) {
- if ( isset( $menu['permission'] ) && ! current_user_can( $menu['permission'] ) ) {
- return false;
- }
-
- return true;
-}
-
-/**
- * Renders the Dokan dashboard menu
- *
- * For settings menu, the active menu format is `settings/menu_key_name`.
- * The active menu will be splitted at `/` and the `menu_key_name` will be matched
- * with settings sub menu array. If it's a match, the settings menu will be shown
- * only. Otherwise the main navigation menu will be shown.
- *
- * @param string $active_menu
- *
- * @return string rendered menu HTML
- */
-function dokan_dashboard_nav( $active_menu = '' ) {
- $nav_menu = dokan_get_dashboard_nav();
- $active_menu_parts = explode( '/', $active_menu );
- $active_submenu = '';
-
- if ( $active_menu && false !== strpos( $active_menu, '/' ) ) {
- $active_menu = $active_menu_parts[0];
- $active_submenu = $active_menu_parts[1];
- }
-
- $menu = '';
- $hamburger_menu = apply_filters( 'dokan_load_hamburger_menu', true );
-
- if ( $hamburger_menu ) {
- $menu .= '';
- $hamburger = apply_filters(
- 'dokan_vendor_dashboard_menu_hamburger',
- ''
- );
-
- $menu .= $hamburger;
- }
-
- $menu .= '';
-
- if ( $hamburger_menu ) {
- $menu .= '
';
- }
-
- return $menu;
-}
-
-
if ( ! function_exists( 'dokan_store_category_menu' ) ) :
/**
diff --git a/package.json b/package.json
index b3d30ec331..e40adc7380 100644
--- a/package.json
+++ b/package.json
@@ -45,6 +45,7 @@
"vue-template-compiler": "^2.7.14",
"vue-wp-list-table": "^1.3.0",
"vue2-daterange-picker": "^0.6.8",
- "wp-readme-to-markdown": "^1.0.1"
+ "wp-readme-to-markdown": "^1.0.1",
+ "vuedraggable": "^2.24.3"
}
}
diff --git a/src/admin/components/Fields.vue b/src/admin/components/Fields.vue
index 7fa859e746..83c5a996a9 100644
--- a/src/admin/components/Fields.vue
+++ b/src/admin/components/Fields.vue
@@ -448,6 +448,7 @@
import FieldHeading from './FieldHeading.vue';
import SecretInput from './SecretInput.vue';
import WithdrawCharges from './Fields/WithdrawCharges.vue'
+
let Mapbox = dokan_get_lib('Mapbox');
let TextEditor = dokan_get_lib('TextEditor');
let GoogleMaps = dokan_get_lib('GoogleMaps');
@@ -501,6 +502,14 @@
});
},
+ watch: {
+ fieldValue: {
+ handler() {
+ },
+ deep: true,
+ }
+ },
+
computed: {
shouldShow(e) {
let shouldShow = true;
diff --git a/src/admin/pages/Settings.vue b/src/admin/pages/Settings.vue
index 0b08be66f2..b6da8af607 100644
--- a/src/admin/pages/Settings.vue
+++ b/src/admin/pages/Settings.vue
@@ -72,7 +72,17 @@
:dokanAssetsUrl="dokanAssetsUrl" />
-
+
+
+
@@ -134,6 +144,7 @@
disbursementSchedule: {},
isSaveConfirm: false,
dokanAssetsUrl: dokan.urls.assetsUrl,
+ disableSubmit: false,
}
},
@@ -576,6 +587,11 @@
this.settingFields = dokan.settings_fields;
window.addEventListener( 'scroll', this.handleScroll );
},
+ mounted() {
+ this.$root.$on('setting-submit-status', ( status ) => {
+ this.disableSubmit = status;
+ } );
+ },
};
diff --git a/src/utils/Bootstrap.js b/src/utils/Bootstrap.js
index b409984750..5a5c20dc95 100644
--- a/src/utils/Bootstrap.js
+++ b/src/utils/Bootstrap.js
@@ -53,6 +53,7 @@ import AdminNotice from "../admin/components/AdminNotice.vue";
import CardFunFact from "../admin/components/CardFunFact.vue";
import "vue-multiselect/dist/vue-multiselect.min.css"
+import Vuedraggable from "vuedraggable/src/vuedraggable";
Vue.use(Notifications)
@@ -121,6 +122,7 @@ window.dokan.libs['RefreshSettingOptions'] = RefreshSettingOptions;
window.dokan.libs['AdminNotice'] = AdminNotice;
window.dokan.libs['CardFunFact'] = CardFunFact;
window.dokan.libs['papaparse'] = parse;
+window.dokan.libs['Vuedraggable'] = Vuedraggable;
window.dokan.libs['ContentLoading'] = {
VclCode,