/** * Load Settings Menu for Pro * * @since 2.4 * * @param array $sub_settins * * @return array */ public function load_settings_menu($sub_settins) { $dokan_shipping_option = get_option('woocommerce_dokan_product_shipping_settings'); $enable_shipping = isset($dokan_shipping_option['enabled']) ? $dokan_shipping_option['enabled'] : 'yes'; if ($enable_shipping == 'yes') { $sub_settins['shipping'] = array('title' => __('Shipping', 'dokan'), 'icon' => '<i class="fa fa-truck"></i>', 'url' => dokan_get_navigation_url('settings/shipping'), 'pos' => 70); } $sub_settins['social'] = array('title' => __('Social Profile', 'dokan'), 'icon' => '<i class="fa fa-share-alt-square"></i>', 'url' => dokan_get_navigation_url('settings/social'), 'pos' => 90); if (dokan_get_option('store_seo', 'dokan_general', 'on') === 'on') { $sub_settins['seo'] = array('title' => __('Store SEO', 'dokan'), 'icon' => '<i class="fa fa-globe"></i>', 'url' => dokan_get_navigation_url('settings/seo'), 'pos' => 110); } return $sub_settins; }
function tokopress_dokan_quicknav_account() { if (!is_user_logged_in()) { return; } global $current_user; $user_id = $current_user->ID; if (!dokan_is_user_seller($user_id)) { return; } // $nav_urls = dokan_get_dashboard_nav(); // foreach ($nav_urls as $key => $item) { // printf( '<li><a href="%s">%s %s</a></li>', $item['url'], $item['title'], $item['icon'] ); // } $title = __('Dashboard', 'dokan'); $icon = '<i class="fa fa-tachometer"></i>'; $url = dokan_get_navigation_url(); printf('<li><a href="%s">%s %s</a></li>', $url, $title, $icon); }
/** * Get edit product url * * @param type $product_id * @return type */ function dokan_edit_product_url($product_id) { if (get_post_field('post_status', $product_id) == 'publish') { return trailingslashit(get_permalink($product_id)) . 'edit/'; } if (dokan_get_option('product_style', 'dokan_selling', 'old') == 'old') { $new_product_url = dokan_get_navigation_url('products'); } elseif (dokan_get_option('product_style', 'dokan_selling', 'old') == 'new') { $new_product_url = dokan_get_navigation_url('new-product'); } return add_query_arg(array('product_id' => $product_id, 'action' => 'edit'), $new_product_url); }
/** * Render Review Content * * @return [type] [description] */ public function render_review_content() { global $woocommerce; require_once DOKAN_PRO_INC . '/reports.php'; $charts = dokan_get_reports_charts(); $link = dokan_get_navigation_url('reports'); $current = isset($_GET['chart']) ? $_GET['chart'] : 'overview'; dokan_get_template_part('report/content', '', array('pro' => true, 'charts' => $charts, 'link' => $link, 'current' => $current)); }
function dokan_get_dashboard_nav() { $urls = array('dashboard' => array('title' => __('Dashboard', 'dokan'), 'icon' => '<i class="fa fa-tachometer"></i>', 'url' => dokan_get_navigation_url()), 'product' => array('title' => __('Products', 'dokan'), 'icon' => '<i class="fa fa-briefcase"></i>', 'url' => dokan_get_navigation_url('products')), 'order' => array('title' => __('Orders', 'dokan'), 'icon' => '<i class="fa fa-shopping-cart"></i>', 'url' => dokan_get_navigation_url('orders')), 'withdraw' => array('title' => __('Withdraw', 'dokan'), 'icon' => '<i class="fa fa-upload"></i>', 'url' => dokan_get_navigation_url('withdraw')), 'settings' => array('title' => __('Settings', 'dokan'), 'icon' => '<i class="fa fa-cog"></i>', 'url' => dokan_get_navigation_url('settings'))); return apply_filters('dokan_get_dashboard_nav', $urls); }
_e('Special Offer', 'dokan'); ?> <?php if ($is_edit_page) { printf('<small> - %s</small>', __('Edit Special Offer', 'dokan')); } ?> </h1> </span> <?php if (!$is_edit_page) { ?> <span class="left-header-content dokan-right"> <a href="<?php echo add_query_arg(array('view' => 'add_coupons'), dokan_get_navigation_url('coupons')); ?> " class="dokan-btn dokan-btn-theme dokan-right"><i class="fa fa-gift"> </i> <?php _e('Add new Coupon', 'dokan'); ?> </a> </span> <?php } ?> </header><!-- .entry-header --> <?php if (!dokan_is_seller_enabled(get_current_user_id())) { dokan_seller_not_enabled_notice(); } else {
<?php /** * dokan_before_edit_product_inside_content_area hook * * @since 2.4 */ do_action('dokan_before_edit_product_inside_content_area'); ?> <div class="dokan-product-edit-area"> <header class="dokan-pro-edit-breadcrumb"> <h1 class="dokan-header-crumb"> <span class="dokan-breadcrumb"><a href="<?php echo dokan_get_navigation_url('products'); ?> "><?php _e('Products', 'dokan'); ?> </a> → </span> <?php echo $post->post_title; ?> <?php if ($_visibility == 'hidden') { ?> <span class="dokan-label dokan-label-default"><?php _e('Hidden', 'dokan'); ?>
<header class="dokan-dashboard-header dokan-clearfix"> <span class="left-header-content"> <h1 class="entry-title"><?php echo $notice_data->post_title; ?> </h1> </span> </header> <span class="dokan-single-announcement-date"><i class="fa fa-calendar"></i> <?php echo date('F j, Y ', strtotime($notice_data->post_date)); ?> </span> <div class="entry-content"> <?php echo wpautop($notice_data->post_content); ?> </div> <div class="dokan-announcement-link"> <a href="<?php echo dokan_get_navigation_url('announcement'); ?> " class="dokan-btn dokan-btn-theme"><?php _e('Back to all Notice', 'dokan'); ?> </a> </div> </article>
</div> <div class="content-half-part"> <canvas id="order-stats"></canvas> </div> </div> <!-- .orders --> <div class="dashboard-widget products"> <div class="widget-title"> <i class="icon-briefcase"></i> <?php _e('Products', 'dokan'); ?> <span class="pull-right"> <a href="<?php echo dokan_get_navigation_url('new-product'); ?> " class="btn btn-theme btn-sm"><?php _e('+ Add new product', 'dokan'); ?> </a> </span> </div> <ul class="list-unstyled list-count"> <li> <a href="<?php echo $products_url; ?> "> <span class="title"><?php
/** * List withdraw request for a user * * @param int $user_id * * @return void */ function withdraw_requests($user_id) { $withdraw_requests = $this->get_withdraw_requests($user_id); if ($withdraw_requests) { ?> <table class="table table-striped"> <tr> <th><?php _e('Amount', 'dokan'); ?> </th> <th><?php _e('Method', 'dokan'); ?> </th> <th><?php _e('Date', 'dokan'); ?> </th> <th><?php _e('Cancel', 'dokan'); ?> </th> <th><?php _e('Status', 'dokan'); ?> </th> </tr> <?php foreach ($withdraw_requests as $request) { ?> <tr> <td><?php echo wc_price($request->amount); ?> </td> <td><?php echo dokan_withdraw_get_method_title($request->method); ?> </td> <td><?php echo dokan_format_time($request->date); ?> </td> <td> <?php $url = add_query_arg(array('action' => 'dokan_cancel_withdrow', 'id' => $request->id), dokan_get_navigation_url('withdraw')); ?> <a href="<?php echo wp_nonce_url($url, 'dokan_cancel_withdrow'); ?> "> <?php _e('Cancel', 'dokan'); ?> </a> </td> <td><?php echo $this->request_status($request->status); ?> </td> </tr> <?php } ?> </table> <?php } }
echo '<abbr title="' . esc_attr($t_time) . '">' . esc_html(apply_filters('post_date_column_time', $h_time, $the_order->id)) . '</abbr>'; ?> </td> <td class="dokan-order-action" width="17%"> <?php do_action('woocommerce_admin_order_actions_start', $the_order); $actions = array(); if (dokan_get_option('order_status_change', 'dokan_selling', 'on') == 'on') { if (in_array($the_order->post_status, array('wc-pending', 'wc-on-hold'))) { $actions['processing'] = array('url' => wp_nonce_url(admin_url('admin-ajax.php?action=dokan-mark-order-processing&order_id=' . $the_order->id), 'dokan-mark-order-processing'), 'name' => __('Processing', 'dokan'), 'action' => "processing", 'icon' => '<i class="fa fa-clock-o"> </i>'); } if (in_array($the_order->post_status, array('wc-pending', 'wc-on-hold', 'wc-processing'))) { $actions['complete'] = array('url' => wp_nonce_url(admin_url('admin-ajax.php?action=dokan-mark-order-complete&order_id=' . $the_order->id), 'dokan-mark-order-complete'), 'name' => __('Complete', 'dokan'), 'action' => "complete", 'icon' => '<i class="fa fa-check"> </i>'); } } $actions['view'] = array('url' => wp_nonce_url(add_query_arg(array('order_id' => $the_order->id), dokan_get_navigation_url('orders')), 'dokan_view_order'), 'name' => __('View', 'dokan'), 'action' => "view", 'icon' => '<i class="fa fa-eye"> </i>'); $actions = apply_filters('woocommerce_admin_order_actions', $actions, $the_order); foreach ($actions as $action) { $icon = isset($action['icon']) ? $action['icon'] : ''; printf('<a class="dokan-btn dokan-btn-default dokan-btn-sm tips" href="%s" data-toggle="tooltip" data-placement="top" title="%s">%s</a> ', esc_url($action['url']), esc_attr($action['name']), $icon); } do_action('woocommerce_admin_order_actions_end', $the_order); ?> </td> </tr> <?php } ?> </tbody>
/** * Show menu * * @param string $post_type */ function wpuf_comments_menu($post_type) { $url = dokan_get_navigation_url('reviews'); $pending = isset($this->pending) ? $this->pending : 0; $spam = isset($this->spam) ? $this->spam : 0; $trash = isset($this->trash) ? $this->trash : 0; ?> <div id="dokan-comments_menu"> <ul class="subsubsub list-inline"> <li><a href="<?php echo $url; ?> "><?php _e('All', 'dokan'); ?> </a></li> <li> <a href="<?php echo add_query_arg(array('comment_status' => 'hold'), $url); ?> "><?php _e('Pending (', 'dokan'); ?> <span class="comments-menu-pending"><?php echo $pending; ?> </span><?php _e(')', 'dokan'); ?> </a> </li> <li> <a href="<?php echo add_query_arg(array('comment_status' => 'spam'), $url); ?> "><?php _e('Spam (', 'dokan'); ?> <span class="comments-menu-spam"><?php echo $spam; ?> </span><?php _e(')', 'dokan'); ?> </a> </li> <li> <a href="<?php echo add_query_arg(array('comment_status' => 'trash'), $url); ?> "><?php _e('Trash (', 'dokan'); ?> <span class="comments-menu-trash"><?php echo $trash; ?> </span><?php _e(')', 'dokan'); ?> </a> </li> </ul> </div> <?php }
<?php /** * Dokan No Announcement Found Template * * @since 2.4 * * @package dokan */ ?> <article class="dokan-notice-single-notice-area"> <header class="dokan-dashboard-header dokan-clearfix"> <span class="left-header-content"> <h1 class="entry-title"><?php _e('Notice', 'dokan'); ?> </h1> </span> </header> <div class="dokan-error"> <?php echo sprintf("<p>%s <a href='%s'>%s</a></p", __('No Notice found; ', 'dokan'), dokan_get_navigation_url('announcement'), __('Back to all Notice', 'dokan')); ?> </div> </article>
/** * Get announcement widget * * @return void */ public function get_announcement_widget() { $template_notice = Dokan_Pro_Notice::init(); $query = $template_notice->get_announcement_by_users(apply_filters('dokan_announcement_list_number', 3)); dokan_get_template_part('dashboard/announcement-widget', '', array('pro' => true, 'notices' => $query->posts, 'announcement_url' => dokan_get_navigation_url('announcement'))); }
function list_user_coupons() { //click add coupon then hide this function if (isset($_GET['view']) && $_GET['view'] == 'add_coupons') { return; } if (isset($_GET['post']) && $_GET['action'] == 'edit') { return; } $perpage = $this->perpage; $pagenum = isset($_GET['pagenum']) ? absint($_GET['pagenum']) : 1; $offset = ($pagenum - 1) * $perpage; $paged = get_query_var('paged') ? get_query_var('paged') : 1; $args = array('post_type' => 'shop_coupon', 'post_status' => array('publish'), 'posts_per_page' => $this->perpage, 'offset' => $offset, 'author' => get_current_user_id(), 'paged' => $paged); $coupon_query = new WP_Query($args); $all_coupons = $coupon_query->get_posts(); if ($all_coupons) { //pagination total $this->total_query_result = $coupon_query->found_posts; //message save, update, delte $this->message(); ?> <table class="dokan-table"> <thead> <tr> <th><?php _e('Code', 'dokan'); ?> </th> <th><?php _e('Coupon type', 'dokan'); ?> </th> <th><?php _e('Coupon amount', 'dokan'); ?> </th> <th><?php _e('Product IDs', 'dokan'); ?> </th> <th><?php _e('Usage / Limit', 'dokan'); ?> </th> <th><?php _e('Expiry date', 'dokan'); ?> </th> </tr> </thead> <?php foreach ($coupon_query->posts as $key => $post) { ?> <tr> <td class="coupon-code"> <?php $edit_url = wp_nonce_url(add_query_arg(array('post' => $post->ID, 'action' => 'edit', 'view' => 'add_coupons'), dokan_get_navigation_url('coupons')), '_coupon_nonce', 'coupon_nonce_url'); ?> <div class="code"> <a href="<?php echo $edit_url; ?> "><span><?php echo esc_attr($post->post_title); ?> </span></a> </div> <div class="row-actions"> <?php $del_url = wp_nonce_url(add_query_arg(array('post' => $post->ID, 'action' => 'delete'), get_permalink()), '_coupon_del_nonce', 'coupon_del_nonce'); ?> <span class="edit"><a href="<?php echo $edit_url; ?> "><?php _e('Edit', 'dokan'); ?> </a> | </span> <span class="delete"><a href="<?php echo $del_url; ?> " onclick="return confirm('<?php esc_attr_e('Are you sure want to delete', 'dokan'); ?> ');"><?php _e('delete', 'dokan'); ?> </a></span> </div> </td> <td> <?php $discount_type = get_post_meta($post->ID, 'discount_type', true); $type = ''; if ($discount_type == 'fixed_product') { $type = __('Fixed Amount', 'dokan'); } elseif ($discount_type == 'percent_product') { $type = __('Percent', 'dokan'); } echo $type; ?> </td> <td> <?php echo esc_attr(get_post_meta($post->ID, 'coupon_amount', true)); ?> </td> <td> <?php $product_ids = get_post_meta($post->ID, 'product_ids', true); $product_ids = $product_ids ? array_map('absint', explode(',', $product_ids)) : array(); if (sizeof($product_ids) > 0) { echo esc_html(implode(', ', $product_ids)); } else { echo '–'; } ?> </td> <td> <?php $usage_count = absint(get_post_meta($post->ID, 'usage_count', true)); $usage_limit = esc_html(get_post_meta($post->ID, 'usage_limit', true)); if ($usage_limit) { printf(__('%s / %s', 'dokan'), $usage_count, $usage_limit); } else { printf(__('%s / ∞', 'dokan'), $usage_count); } ?> </td> <td> <?php $expiry_date = get_post_meta($post->ID, 'expiry_date', true); if ($expiry_date) { echo esc_html(date_i18n('F j, Y', strtotime($expiry_date))); } else { echo '–'; } ?> </td> </tr> <?php } echo '</table>'; echo $this->pagination(); } else { ?> <p class="dokan-message"><?php _e('No coupons found!', 'dokan'); ?> </p> <?php } }
_e('No product found', 'dokan'); ?> </td> </tr> <?php } ?> </tbody> </table> <?php wp_reset_postdata(); $pagenum = isset($_GET['pagenum']) ? absint($_GET['pagenum']) : 1; $base_url = dokan_get_navigation_url('products'); if ($product_query->max_num_pages > 1) { echo '<div class="pagination-wrap">'; $page_links = paginate_links(array('current' => $pagenum, 'total' => $product_query->max_num_pages, 'base' => $base_url . '%_%', 'format' => '?pagenum=%#%', 'add_args' => false, 'type' => 'array', 'prev_text' => __('« Previous', 'dokan'), 'next_text' => __('Next »', 'dokan'))); echo '<ul class="pagination"><li>'; echo join("</li>\n\t<li>", $page_links); echo "</li>\n</ul>\n"; echo '</div>'; } ?> </article> <?php do_action('dokan_after_listing_product'); ?> </div><!-- #primary .content-area -->
/** * Show Comment filter menu * * @since 2.4 * * @param string $post_type * * @return void */ function review_comments_menu($post_type, $counts) { $url = dokan_get_navigation_url('reviews'); $pending = isset($counts->moderated) ? $counts->moderated : 0; $spam = isset($counts->spam) ? $counts->spam : 0; $trash = isset($counts->trash) ? $counts->trash : 0; dokan_get_template_part('review/status-filter', '', array('pro' => true, 'url' => $url, 'pending' => $pending, 'spam' => $spam, 'trash' => $trash)); }
<?php /** * Dokan Dahsboard Template * * Dokan Dashboard order status filter template * * @since 2.4 * * @package dokan */ if (isset($_GET['order_id'])) { ?> <a href="<?php echo dokan_get_navigation_url('orders'); ?> " class="dokan-btn"><?php _e('← Orders', 'dokan'); ?> </a> <?php } else { dokan_order_listing_status_filter(); }
?> </td> </tr> <?php } ?> </tbody> </table> <?php $order_count = dokan_get_seller_orders_number($seller_id, $order_status); $num_of_pages = ceil($order_count / $limit); $base_url = dokan_get_navigation_url('orders'); if ($num_of_pages > 1) { echo '<div class="pagination-wrap">'; $page_links = paginate_links(array('current' => $paged, 'total' => $num_of_pages, 'base' => $base_url . '%_%', 'format' => '?pagenum=%#%', 'add_args' => false, 'type' => 'array')); echo "<ul class='pagination'>\n\t<li>"; echo join("</li>\n\t<li>", $page_links); echo "</li>\n</ul>\n"; echo '</div>'; } ?> <?php } else { ?> <div class="dokan-error">
/** * Coupon Pagination * * @return [type] [description] */ function pagination() { $pagenum = isset($_GET['pagenum']) ? absint($_GET['pagenum']) : 1; $num_of_pages = ceil($this->total_query_result / $this->perpage); $base_url = dokan_get_navigation_url('coupons'); $page_links = paginate_links(array('base' => $base_url . '%_%', 'format' => '?pagenum=%#%', 'add_args' => false, 'prev_text' => __('«', 'aag'), 'next_text' => __('»', 'aag'), 'total' => $num_of_pages, 'current' => $pagenum, 'type' => 'array')); if ($page_links) { echo "<ul class='pagination'>\n\t<li>"; echo join("</li>\n\t<li>", $page_links); echo "</li>\n</ul>\n"; echo '</div>'; } }
* @since 2.4 * * @package dokan */ ?> <ul class="list-inline subsubsub"> <li<?php echo $current == 'pending' ? ' class="active"' : ''; ?> > <a href="<?php echo dokan_get_navigation_url('withdraw'); ?> "><?php _e('Withdraw Request', 'dokan'); ?> </a> </li> <li<?php echo $current == 'approved' ? ' class="active"' : ''; ?> > <a href="<?php echo add_query_arg(array('type' => 'approved'), dokan_get_navigation_url('withdraw')); ?> "><?php _e('Approved Requests', 'dokan'); ?> </a> </li> </ul>
<div class="dokan-dashboard-content dokan-reports-content"> <article class="dokan-reports-area"> <header class="dokan-dashboard-header"> <h1 class="entry-title"><?php _e('Reports', 'dokan'); ?> </h1> </header><!-- .dokan-dashboard-header --> <div class="dokan-report-wrap"> <?php global $woocommerce; require_once dirname(dirname(__FILE__)) . '/includes/reports.php'; $charts = dokan_get_reports_charts(); $link = dokan_get_navigation_url('reports'); $current = isset($_GET['chart']) ? $_GET['chart'] : 'overview'; echo '<ul class="dokan_tabs">'; foreach ($charts['charts'] as $key => $value) { $class = $current == $key ? ' class="active"' : ''; printf('<li%s><a href="%s">%s</a></li>', $class, add_query_arg(array('chart' => $key), $link), $value['title']); } echo '</ul>'; ?> <?php if (isset($charts['charts'][$current])) { ?> <div id="dokan_tabs_container"> <div class="tab-pane active" id="home"> <?php
/** * Insert withdraw info * * @return void */ function insert_withdraw_info() { global $current_user, $wpdb; $amount = floatval($_POST['witdraw_amount']); $method = $_POST['withdraw_method']; $data_info = array('user_id' => $current_user->ID, 'amount' => $amount, 'status' => 0, 'method' => $method, 'ip' => dokan_get_client_ip(), 'notes' => ''); $update = $this->insert_withdraw($data_info); Dokan_Email::init()->new_withdraw_request($current_user, $amount, $method); wp_redirect(add_query_arg(array('message' => 'request_success'), dokan_get_navigation_url('withdraw'))); }
/** * Dashboard Navigation menus * * @return array */ function dokan_get_dashboard_nav() { $urls = array('dashboard' => array('title' => __('Dashboard', 'dokan'), 'icon' => '<i class="fa fa-tachometer"></i>', 'url' => dokan_get_navigation_url()), 'product' => array('title' => __('Products', 'dokan'), 'icon' => '<i class="fa fa-briefcase"></i>', 'url' => dokan_get_navigation_url('products')), 'order' => array('title' => __('Orders', 'dokan'), 'icon' => '<i class="fa fa-shopping-cart"></i>', 'url' => dokan_get_navigation_url('orders')), 'coupon' => array('title' => __('Coupons', 'dokan'), 'icon' => '<i class="fa fa-gift"></i>', 'url' => dokan_get_navigation_url('coupons')), 'report' => array('title' => __('Reports', 'dokan'), 'icon' => '<i class="fa fa-line-chart"></i>', 'url' => dokan_get_navigation_url('reports')), 'reviews' => array('title' => __('Reviews', 'dokan'), 'icon' => '<i class="fa fa-comments-o"></i>', 'url' => dokan_get_navigation_url('reviews')), 'withdraw' => array('title' => __('Withdraw', 'dokan'), 'icon' => '<i class="fa fa-upload"></i>', 'url' => dokan_get_navigation_url('withdraw'))); $urls = apply_filters('dokan_get_dashboard_nav', $urls); $settings = array('title' => __('Settings <i class="fa fa-angle-right pull-right"></i>', 'dokan'), 'icon' => '<i class="fa fa-cog"></i>', 'url' => dokan_get_navigation_url('settings/store')); $settings_sub = array('back' => array('title' => __('Back to Dashboard', 'dokan'), 'icon' => '<i class="fa fa-long-arrow-left"></i>', 'url' => dokan_get_navigation_url()), 'store' => array('title' => __('Store', 'dokan'), 'icon' => '<i class="fa fa-university"></i>', 'url' => dokan_get_navigation_url('settings/store')), 'payment' => array('title' => __('Payment', 'dokan'), 'icon' => '<i class="fa fa-credit-card"></i>', 'url' => dokan_get_navigation_url('settings/payment'))); $dokan_shipping_option = get_option('woocommerce_dokan_product_shipping_settings'); $enable_shipping = isset($dokan_shipping_option['enabled']) ? $dokan_shipping_option['enabled'] : 'yes'; if ($enable_shipping == 'yes') { $settings_sub['shipping'] = array('title' => __('Shipping', 'dokan'), 'icon' => '<i class="fa fa-truck"></i>', 'url' => dokan_get_navigation_url('settings/shipping')); } $settings_sub['social'] = array('title' => __('Social Profile', 'dokan'), 'icon' => '<i class="fa fa-share-alt-square"></i>', 'url' => dokan_get_navigation_url('settings/social')); if (dokan_get_option('store_seo', 'dokan_general', 'on') === 'on') { $settings_sub['seo'] = array('title' => __('Store SEO', 'dokan'), 'icon' => '<i class="fa fa-globe"></i>', 'url' => dokan_get_navigation_url('settings/seo')); } /** * Filter to get the seller dashboard settings navigation. * * @since 2.2 * * @param array. */ $settings['sub'] = apply_filters('dokan_get_dashboard_settings_nav', $settings_sub); $urls['settings'] = $settings; /** * Filter to get the final seller dashboard navigation. * * @since 2.2 * * @param array $urls. */ return apply_filters('dokan_get_seller_dashboard_nav', $urls); }
/** * Dashboard Navigation menus * * @return array */ function dokan_get_dashboard_nav() { $urls = array('dashboard' => array('title' => __('Dashboard', 'dokan'), 'icon' => '<i class="fa fa-tachometer"></i>', 'url' => dokan_get_navigation_url(), 'pos' => 10), 'products' => array('title' => __('Products', 'dokan'), 'icon' => '<i class="fa fa-briefcase"></i>', 'url' => dokan_get_navigation_url('products'), 'pos' => 30), 'orders' => array('title' => __('Orders', 'dokan'), 'icon' => '<i class="fa fa-shopping-cart"></i>', 'url' => dokan_get_navigation_url('orders'), 'pos' => 50), 'withdraw' => array('title' => __('Withdraw', 'dokan'), 'icon' => '<i class="fa fa-upload"></i>', 'url' => dokan_get_navigation_url('withdraw'), 'pos' => 70)); $settings = array('title' => __('Settings <i class="fa fa-angle-right pull-right"></i>', 'dokan'), 'icon' => '<i class="fa fa-cog"></i>', 'url' => dokan_get_navigation_url('settings/store'), 'pos' => 200); $settings_sub = array('back' => array('title' => __('Back to Dashboard', 'dokan'), 'icon' => '<i class="fa fa-long-arrow-left"></i>', 'url' => dokan_get_navigation_url(), 'pos' => 10), 'store' => array('title' => __('Store', 'dokan'), 'icon' => '<i class="fa fa-university"></i>', 'url' => dokan_get_navigation_url('settings/store'), 'pos' => 30), 'payment' => array('title' => __('Payment', 'dokan'), 'icon' => '<i class="fa fa-credit-card"></i>', 'url' => dokan_get_navigation_url('settings/payment'), 'pos' => 50)); /** * Filter to get the seller dashboard settings navigation. * * @since 2.2 * * @param array. */ $settings['sub'] = apply_filters('dokan_get_dashboard_settings_nav', $settings_sub); uasort($settings['sub'], 'dokan_nav_sort_by_pos'); $urls['settings'] = $settings; $nav_urls = apply_filters('dokan_get_dashboard_nav', $urls); uasort($nav_urls, 'dokan_nav_sort_by_pos'); /** * Filter to get the final seller dashboard navigation. * * @since 2.2 * * @param array $urls. */ return $nav_urls; }
/** * Get edit product url * * @param type $product_id * @return type */ function dokan_edit_product_url($product_id) { if (get_post_field('post_status', $product_id) == 'publish') { return trailingslashit(get_permalink($product_id)) . 'edit/'; } return add_query_arg(array('product_id' => $product_id, 'action' => 'edit'), dokan_get_navigation_url('products')); }
function dokan_get_dashboard_nav() { $urls = array('dashboard' => array('title' => __('Dashboard', 'dokan'), 'icon' => '<i class="fa fa-tachometer"></i>', 'url' => dokan_get_navigation_url()), 'product' => array('title' => __('Products', 'dokan'), 'icon' => '<i class="fa fa-briefcase"></i>', 'url' => dokan_get_navigation_url('products')), 'order' => array('title' => __('Orders', 'dokan'), 'icon' => '<i class="fa fa-shopping-cart"></i>', 'url' => dokan_get_navigation_url('orders')), 'coupon' => array('title' => __('Coupons', 'dokan'), 'icon' => '<i class="fa fa-gift"></i>', 'url' => dokan_get_navigation_url('coupons')), 'report' => array('title' => __('Reports', 'dokan'), 'icon' => '<i class="fa fa-line-chart"></i>', 'url' => dokan_get_navigation_url('reports')), 'reviews' => array('title' => __('Reviews', 'dokan'), 'icon' => '<i class="fa fa-comments-o"></i>', 'url' => dokan_get_navigation_url('reviews')), 'withdraw' => array('title' => __('Withdraw', 'dokan'), 'icon' => '<i class="fa fa-upload"></i>', 'url' => dokan_get_navigation_url('withdraw'))); $dokan_shipping_option = get_option('woocommerce_dokan_product_shipping_settings'); $enable_shipping = isset($dokan_shipping_option['enabled']) ? $dokan_shipping_option['enabled'] : 'yes'; if ($enable_shipping == 'yes') { $urls['shipping'] = array('title' => __('Shipping', 'dokan'), 'icon' => '<i class="fa fa-truck"></i>', 'url' => dokan_get_navigation_url('shipping')); } $urls = apply_filters('dokan_get_dashboard_nav', $urls); $urls['settings'] = array('title' => __('Settings', 'dokan'), 'icon' => '<i class="fa fa-cog"></i>', 'url' => dokan_get_navigation_url('settings')); return $urls; }
/** * Handle Shipping post submit * * @since 2.0 * @return void */ function handle_shipping() { if (!is_user_logged_in()) { return; } if (!dokan_is_user_seller(get_current_user_id())) { return; } if (isset($_POST['dokan_update_shipping_options']) && wp_verify_nonce($_POST['dokan_shipping_form_field_nonce'], 'dokan_shipping_form_field')) { $user_id = get_current_user_id(); $s_rates = array(); $rates = array(); if (isset($_POST['dps_enable_shipping'])) { update_user_meta($user_id, '_dps_shipping_enable', $_POST['dps_enable_shipping']); } if (isset($_POST['dokan_shipping_type'])) { update_user_meta($user_id, '_dokan_shipping_type', $_POST['dokan_shipping_type']); } if (isset($_POST['dps_shipping_type_price'])) { update_user_meta($user_id, '_dps_shipping_type_price', $_POST['dps_shipping_type_price']); } if (isset($_POST['dps_additional_product'])) { update_user_meta($user_id, '_dps_additional_product', $_POST['dps_additional_product']); } if (isset($_POST['dps_additional_qty'])) { update_user_meta($user_id, '_dps_additional_qty', $_POST['dps_additional_qty']); } if (isset($_POST['dps_pt'])) { update_user_meta($user_id, '_dps_pt', $_POST['dps_pt']); } if (isset($_POST['dps_ship_policy'])) { update_user_meta($user_id, '_dps_ship_policy', $_POST['dps_ship_policy']); } if (isset($_POST['dps_refund_policy'])) { update_user_meta($user_id, '_dps_refund_policy', $_POST['dps_refund_policy']); } if (isset($_POST['dps_form_location'])) { update_user_meta($user_id, '_dps_form_location', $_POST['dps_form_location']); } if (isset($_POST['dps_country_to'])) { foreach ($_POST['dps_country_to'] as $key => $value) { $country = $value; $c_price = floatval($_POST['dps_country_to_price'][$key]); if (!$c_price && empty($c_price)) { $c_price = 0; } if (!empty($value)) { $rates[$country] = $c_price; } } } update_user_meta($user_id, '_dps_country_rates', $rates); if (isset($_POST['dps_state_to'])) { foreach ($_POST['dps_state_to'] as $country_code => $states) { foreach ($states as $key_val => $name) { $country_c = $country_code; $state_code = $name; $s_price = floatval($_POST['dps_state_to_price'][$country_c][$key_val]); if (!$s_price || empty($s_price)) { $s_price = 0; } if (!empty($name)) { $s_rates[$country_c][$state_code] = $s_price; } } } } update_user_meta($user_id, '_dps_state_rates', $s_rates); $shipping_url = dokan_get_navigation_url('settings/shipping'); wp_redirect(add_query_arg(array('message' => 'shipping_saved'), $shipping_url)); exit; } }
</a> </span> </div> <?php $template_notice = Dokan_Template_Notice::init(); $query = $template_notice->get_announcement_by_users(3); ?> <?php if ($query->posts) { ?> <ul class="list-unstyled"> <?php foreach ($query->posts as $notice) { ?> <?php $notice_url = trailingslashit(dokan_get_navigation_url('single-announcement') . '' . $notice->ID); ?> <li> <div class="dokan-dashboard-announce-content dokan-left"> <a href="<?php echo $notice_url; ?> "><h3><?php echo $notice->post_title; ?> </h3></a> <?php echo wp_trim_words($notice->post_content, 6, '...'); ?> </div> <div class="dokan-dashboard-announce-date dokan-right <?php
/** * Prevents non-stripe connected users from creating new product posts * * @param array $errors * * @return array */ function can_seller_add_product($errors) { $user_id = get_current_user_id(); $stripe_id = get_user_meta($user_id, '_stripe_connect_access_key', true); if (empty($stripe_id)) { $errors[] = sprintf('%s <a href="%s">%s</a>', __('Your Stripe account isn\'t active yet. Please connect to stripe first!', 'dokan-stripe'), dokan_get_navigation_url('settings'), __('Connect to Stripe', 'dokan-stripe')); } return $errors; }