May 31, 2015 at 10:21 pm 45765 |
June 2, 2015 at 11:34 am 45938 |
June 2, 2015 at 4:02 pm 45961 |
Anas Basalamah
| Ok , I customized this function from includes/ template-tags.php now i can control this function from my child theme
i created a file child-theme/includes/template-tags.php and i post the function inside it
also i post this inside child theme function.php
require_once( get_stylesheet_directory() . ‘/includes/template-tags.php’ );
the function code
if ( !function_exists( 'dokan_header_user_menu' ) ) :
/**
* User top navigation menu
*
* @return void
*/
function dokan_header_user_menu() {
?>
<ul class="nav navbar-nav navbar-right">
<?php if ( is_user_logged_in() ) { ?>
<li><?php wp_loginout( home_url() ); ?></li>
<?php } ?>
<li>
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php printf( __( 'Cart %s', 'dokan' ), '<span class="dokan-cart-amount-top">(' . WC()->cart->get_cart_total() . ')</span>' ); ?> <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>
<div class="widget_shopping_cart_content"></div>
</li>
</ul>
</li>
<?php if ( is_user_logged_in() ) { ?>
<?php
global $current_user;
$user_id = $current_user->ID;
if ( dokan_is_user_seller( $user_id ) ) {
?>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php _e( 'Seller Dashboard', 'dokan' ); ?> <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="<?php echo dokan_get_store_url( $user_id ); ?>" target="_blank"><?php _e( 'Visit your store', 'dokan' ); ?> <i class="fa fa-external-link"></i></a></li>
<li class="divider"></li>
<?php
$nav_urls = dokan_get_dashboard_nav();
foreach ($nav_urls as $key => $item) {
printf( '<li><a href="%s">%s %s</a></li>', $item['url'], $item['icon'], $item['title'] );
}
?>
</ul>
</li>
<?php } ?>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo esc_html( $current_user->display_name ); ?> <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="<?php echo dokan_get_page_url( 'my_orders' ); ?>"><?php _e( 'My Orders', 'dokan' ); ?></a></li>
<li><a href="<?php echo dokan_get_page_url( 'myaccount', 'woocommerce' ); ?>"><?php _e( 'My Account', 'dokan' ); ?></a></li>
<li><a href="<?php echo wc_customer_edit_account_url(); ?>"><?php _e( 'Edit Account', 'dokan' ); ?></a></li>
<li class="divider"></li>
<li><a href="<?php echo wc_get_endpoint_url( 'edit-address', 'billing', get_permalink( wc_get_page_id( 'myaccount' ) ) ); ?>"><?php _e( 'Billing Address', 'dokan' ); ?></a></li>
<li><a href="<?php echo wc_get_endpoint_url( 'edit-address', 'shipping', get_permalink( wc_get_page_id( 'myaccount' ) ) ); ?>"><?php _e( 'Shipping Address', 'dokan' ); ?></a></li>
</ul>
</li>
<?php } else { ?>
<li><a href="<?php echo dokan_get_page_url( 'myaccount', 'woocommerce' ); ?>"><?php _e( 'Log in', 'dokan' ); ?></a></li>
<li><a href="<?php echo dokan_get_page_url( 'myaccount', 'woocommerce' ); ?>"><?php _e( 'Sign Up', 'dokan' ); ?></a></li>
<?php } ?>
</ul>
<?php
}
endif;
now i want to customize function insert_settings_info() in plugin/dokan/classes/template-settings.php
i tried to do it the same way as the function above but its not working
is there another way ?
thanks
|
June 4, 2015 at 4:24 pm 46121 |
June 4, 2015 at 4:37 pm 46124 |
towhid
| Hello Anas,
Sorry for my late reply.
Here is the solution:
Please open plugins/dokan/classes/template-settings.php
and find function insert_settings_info() {
now, replace total function code of function insert_settings_info() { with below code and let me know the result.
if ( !function_exists( 'insert_settings_info' ) ):
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'] ),
'address' => strip_tags( $_POST['setting_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'] ),
);
} 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';
}
}
endif;
Thanks
|
June 4, 2015 at 4:49 pm 46126 |
June 4, 2015 at 5:02 pm 46132 |