首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Dokan插件定制

Dokan插件定制
EN

Stack Overflow用户
提问于 2018-06-06 13:56:51
回答 2查看 889关注 0票数 1

我正在使用多供应商网站的多看插件。我想在多坎供应商设置页面中添加一些额外的字段。我用这个

代码语言:javascript
复制
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'] : '';?>

代码语言:javascript
复制
    <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 
 );

  }

但是当我使用这个时,我无法更新payment method.please帮助我

谢谢

EN

回答 2

Stack Overflow用户

发布于 2018-06-21 14:27:30

您可以尝试使用此方法保存字段值,它应该可以解决您的问题-

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

代码语言:javascript
复制
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 );

}

如果代码运行正常,我希望您将此主题标记为已解决!

票数 5
EN

Stack Overflow用户

发布于 2018-06-21 00:09:28

我已经尝试过这个代码- https://gist.github.com/nayemDevs/b629d4b1c27c794bdfb729ce6927069e#file-extra-field-php,它对我来说是有效的。但是,我已经检查了Dokan主题和Hestia pro主题。你有没有检查过是否有主题冲突?

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50713107

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档