Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ajira86

    (@ajira86)

    This issue belongs to “User Meta Manager” plugin. See here if you need more information http://ww.wp.xz.cn/support/topic/conflict-with-woocommerce?replies=2#post-4476379

    Thread Starter ajira86

    (@ajira86)

    If found a way where function umm_update_profile_fields rewrite metadata value even if no form called.

    I add condition to check if umm_nonce exists before rewriting data like this :

    function umm_update_profile_fields(){
        global $current_user;
        $saved_profile_fields = (!umm_get_option('profile_fields')) ? array() : umm_get_option('profile_fields');
        $the_user = ((isset($_REQUEST['user_id']) && !empty($_REQUEST['user_id'])) && current_user_can('add_users')) ? $_REQUEST['user_id'] : $current_user->ID;
    
        if(isset($_REQUEST['umm_nonce'])) {
    		foreach($saved_profile_fields as $field_name => $field_settings):
    			$field_value = (isset($_REQUEST[$field_name])) ? addslashes(htmlspecialchars(trim($_REQUEST[$field_name]))) : '';
    			update_user_meta($the_user, $field_name, $field_value);
    		endforeach;
        }
    }

    Woocommerce call this function (indirectly) for its metadata update (billing & shipping informations) at end of checkout.

    Can someone check if this fix is relevant ?

Viewing 2 replies - 1 through 2 (of 2 total)