Настройка плагина Dokan

Я использую плагин dokan для мультивендорного сайта. Я хочу добавить дополнительное поле на странице настроек поставщика докана. Я использую это

add_filter( 'dokan_settings_form_bottom', 'extra_fields', 10, 2);


function extra_fields( $current_user, $profile_info ){


$seller_url= isset( $profile_info['seller_url'] ) ? 
$profile_info['seller_url'] : '';?>

    <label class="dokan-w3 dokan-control-label" for="setting_address">

        <?php _e( 'Website', 'dokan' ); ?>

    </label>

    <div class="dokan-w5">

        <input type="text" class="dokan-form-control input-md valid" name="seller_url" id="reg_seller_url" value="<?php echo $seller_url; ?>" />

    </div>

</div>



<?php }
//save the field value


add_action( 'dokan_store_profile_saved', 'save_extra_fields', 15 );

function save_extra_fields( $store_id ) {

if ( isset( $_POST['seller_url'] ) ) {

    $dokan_settings = dokan_get_store_info($store_id);

    $dokan_settings['seller_url'] = $_POST['seller_url'];

}

update_user_meta( $store_id, 'dokan_profile_settings', $dokan_settings 
 );

  }

But when i use this i am unable to update the payment method.please help me

Спасибо


person Achal Singh    schedule 06.06.2018    source источник


Ответы (2)


Вы можете попробовать этот способ сохранить значение поля, и это должно решить вашу проблему -

add_action( 'dokan_store_profile_saved', 'save_extra_fields', 15 );

function save_extra_fields( $store_id ) {
    $dokan_settings = dokan_get_store_info($store_id);
    if ( isset( $_POST['seller_url'] ) ) {
    $dokan_settings['seller_url'] = $_POST['seller_url'];
}
 update_user_meta( $store_id, 'dokan_profile_settings', $dokan_settings );

}

Если код работает, надеюсь, вы отметите эту тему как решенную!

person Nazmul Hassan    schedule 21.06.2018

Я пробовал этот код - https://gist.github.com/nayemDevs/b629d4b1c27c794bdfb729ce6927069e#file-extra-field-php, и это работает для меня. Тем не менее, я проверил тему Dokan и тему Hestia pro. Вы проверяли, есть ли конфликт тем?

person Nazmul Hassan    schedule 20.06.2018