wordpress - Dokan插件定制

标签 wordpress dokan

我正在为多供应商网站使用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 
 );

  }

但是当我使用此功能时,我无法更新付款方式。请帮助我

谢谢

最佳答案

您可以尝试通过这种方式保存字段值,它应该可以解决您的问题-
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 );
}
如果该代码有效,那么我希望您将此主题标记为已解决!

关于wordpress - Dokan插件定制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50713107/

相关文章:

wordpress - 将 WordPress URL 重定向到父页面而不更改 URL

php - 避免 WooCommerce Dokan 中父订单的订单完成通知

c - 如何在文件夹中挂载虚拟文件系统?

php - 在 Dokan 中设置每个供应商的最低订单量

wordpress - Woocommerce - 购物车页面不显示

php - 如何修复 Wordpress 博客中主题的语法错误

mysql - WordPress 自定义订单按帖子标题中的姓氏过滤

javascript - MailChimp JS 验证不起作用