Untitled
unknown
plain_text
2 years ago
1.1 kB
2
Indexable
add_action('woocommerce_account_dashboard', function(){
// if user is subaccount
$user_id = get_current_user_id();
$account_type = get_user_meta($user_id, 'b2bking_account_type', true);
if ($account_type === 'subaccount'){
$account_parent = get_user_meta($user_id, 'b2bking_account_parent', true);
?>
<button class="b2bking_subaccounts_account_button b2bking_subaccounts_account_button_login" type="button" value="<?php echo esc_html($account_parent);?>" style="width: 210px !important;">
<svg class="b2bking_subaccounts_account_button_icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24">
<path fill="#fff" d="M12 21v-2h7V5h-7V3h7c.55 0 1.021.196 1.413.588.392.392.588.863.587 1.412v14c0 .55-.196 1.021-.588 1.413A1.922 1.922 0 0 1 19 21h-7Zm-2-4-1.375-1.45 2.55-2.55H3v-2h8.175l-2.55-2.55L10 7l5 5-5 5Z"/>
</svg>
<?php esc_html_e('Log in as parent account','b2bking'); ?>
</button>
<?php
}
});
add_filter('b2bking_allow_switchagent_login', function($val){
return 'yes';
}, 10, 1);
add_filter('b2bking_allow_subaccount_login', function($val){
return 'yes';
}, 10, 1);Editor is loading...
Leave a Comment