<?php $store_user = get_userdata(get_query_var('author')); $store_info = dokan_get_store_info($store_user->ID); $store_tabs = dokan_get_store_tabs($store_user->ID); $social_fields = dokan_get_social_profile_fields(); ?> <div class="profile-frame"> <?php if (isset($store_info['banner']) && !empty($store_info['banner'])) { ?> <style type="text/css"> .profile-frame { background-image: url('<?php echo wp_get_attachment_url($store_info['banner']); ?> '); } </style> <?php } ?> <div class="profile-info-box"> <div class="profile-img"> <?php echo get_avatar($store_user->ID, 80); ?> </div>
/** * Save user data * * @param int $user_id * * @return void */ function save_meta_fields($user_id) { if (!current_user_can('manage_woocommerce')) { return; } if (!isset($_POST['dokan_enable_selling'])) { return; } $selling = sanitize_text_field($_POST['dokan_enable_selling']); $publishing = sanitize_text_field($_POST['dokan_publish']); $percentage = floatval($_POST['dokan_seller_percentage']); $feature_seller = sanitize_text_field($_POST['dokan_feature']); $store_settings = dokan_get_store_info($user_id); $social = $_POST['dokan_social']; $social_fields = dokan_get_social_profile_fields(); $store_settings['banner'] = intval($_POST['dokan_banner']); $store_settings['store_name'] = sanitize_text_field($_POST['dokan_store_name']); $store_settings['address'] = isset($_POST['dokan_store_address']) ? $_POST['dokan_store_address'] : array(); $store_settings['phone'] = sanitize_text_field($_POST['dokan_store_phone']); // social settings if (is_array($social)) { foreach ($social as $key => $value) { if (isset($social_fields[$key])) { $store_settings['social'][$key] = filter_var($social[$key], FILTER_VALIDATE_URL); } } } update_user_meta($user_id, 'dokan_profile_settings', $store_settings); update_user_meta($user_id, 'dokan_enable_selling', $selling); update_user_meta($user_id, 'dokan_publishing', $publishing); update_user_meta($user_id, 'dokan_seller_percentage', $percentage); update_user_meta($user_id, 'dokan_feature_seller', $feature_seller); do_action('dokan_process_seller_meta_fields', $user_id); }
/** * Save store settings * * @return void */ function insert_settings_info() { $store_id = get_current_user_id(); $prev_dokan_settings = get_user_meta($store_id, 'dokan_profile_settings', true); if (wp_verify_nonce($_POST['_wpnonce'], 'dokan_profile_settings_nonce')) { // update profile settings info $social = $_POST['settings']['social']; $social_fields = dokan_get_social_profile_fields(); $dokan_settings = array('social' => array()); if (is_array($social)) { foreach ($social as $key => $value) { if (isset($social_fields[$key])) { $dokan_settings['social'][$key] = filter_var($social[$key], FILTER_VALIDATE_URL); } } } } elseif (wp_verify_nonce($_POST['_wpnonce'], 'dokan_store_settings_nonce')) { //update store setttings info $dokan_settings = array('store_name' => sanitize_text_field($_POST['dokan_store_name']), 'store_ppp' => absint($_POST['dokan_store_ppp']), 'address' => isset($_POST['dokan_address']) ? $_POST['dokan_address'] : $prev_dokan_settings['address'], 'location' => sanitize_text_field($_POST['location']), 'find_address' => sanitize_text_field($_POST['find_address']), 'banner' => absint($_POST['dokan_banner']), 'phone' => sanitize_text_field($_POST['setting_phone']), 'show_email' => sanitize_text_field($_POST['setting_show_email']), 'gravatar' => absint($_POST['dokan_gravatar']), 'enable_tnc' => isset($_POST['dokan_store_tnc_enable']) ? $_POST['dokan_store_tnc_enable'] : '', 'store_tnc' => isset($_POST['dokan_store_tnc']) ? $_POST['dokan_store_tnc'] : ''); } elseif (wp_verify_nonce($_POST['_wpnonce'], 'dokan_payment_settings_nonce')) { //update payment settings info $dokan_settings = array('payment' => array()); if (isset($_POST['settings']['bank'])) { $bank = $_POST['settings']['bank']; $dokan_settings['payment']['bank'] = array('ac_name' => sanitize_text_field($bank['ac_name']), 'ac_number' => sanitize_text_field($bank['ac_number']), 'bank_name' => sanitize_text_field($bank['bank_name']), 'bank_addr' => sanitize_text_field($bank['bank_addr']), 'swift' => sanitize_text_field($bank['swift'])); } if (isset($_POST['settings']['paypal'])) { $dokan_settings['payment']['paypal'] = array('email' => filter_var($_POST['settings']['paypal']['email'], FILTER_VALIDATE_EMAIL)); } if (isset($_POST['settings']['skrill'])) { $dokan_settings['payment']['skrill'] = array('email' => filter_var($_POST['settings']['skrill']['email'], FILTER_VALIDATE_EMAIL)); } } $dokan_settings = array_merge($prev_dokan_settings, $dokan_settings); $profile_completeness = $this->calculate_profile_completeness_value($dokan_settings); $dokan_settings['profile_completion'] = $profile_completeness; update_user_meta($store_id, 'dokan_profile_settings', $dokan_settings); do_action('dokan_store_profile_saved', $store_id, $dokan_settings); if (!defined('DOING_AJAX')) { $_GET['message'] = 'profile_saved'; } }
/** * Load Social Page Content * * @since 2.4 * * @return void */ public function load_social_content() { $social_fields = dokan_get_social_profile_fields(); dokan_get_template_part('settings/social', '', array('pro' => true, 'social_fields' => $social_fields, 'current_user' => $this->currentuser, 'profile_info' => $this->profile_info)); }