Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
958 B
2
Indexable
Never
add_action( 'user_new_form', 'b2bking_show_user_meta_profile2', 1000, 1 );
add_action( 'show_user_profile', 'b2bking_show_user_meta_profile2', 1000, 1 );
add_action( 'edit_user_profile', 'b2bking_show_user_meta_profile2', 1000, 1 );
function b2bking_show_user_meta_profile2($user){
    if (get_user_meta($user->ID,'b2bking_b2buser',true) !== 'yes'){
        do_action('b2bking_after_user_registration_data', $user->ID);
    }
}
add_filter( 'woocommerce_account_menu_items', 'add_to_my_account2', 10000, 1 );
function add_to_my_account2($items){
    if (get_user_meta(get_current_user_id(), 'b2bking_b2buser', true) !== 'yes'){
        $items = array_slice($items, 0, 7, true) +
            array(get_option('b2bking_credit_endpoint_setting', 'company-credit') => apply_filters('b2bking_credit_my_account_display_name',esc_html__( 'Company credit', 'b2bkingcredit' ))) + 
            array_slice($items, 7, count($items)-7, true);  
    }
    return $items;
}
Leave a Comment