Last active
September 3, 2016 03:45
-
-
Save bentasm1/f68212e0e7c0d0e13b6818623182d21c to your computer and use it in GitHub Desktop.
WC Vendors Pro Bank & IBAN Details
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* WC Vendors Pro - My Custom Bank Fields */ | |
function store_bank_details( ){ | |
if ( class_exists( 'WCVendors_Pro' ) ){ | |
$key = '_wcv_custom_settings_bankname'; | |
$value = get_user_meta( get_current_user_id(), $key, true ); | |
// Bank Name | |
WCVendors_Pro_Form_Helper::input( array( | |
'id' => $key, | |
'label' => __( 'Banküberweisung als Auszahlungs Methode Ihres Provision verwenden', 'wcvendors-pro' ), | |
'placeholder' => __( 'Bank Name', 'wcvendors-pro' ), | |
'desc_tip' => 'true', | |
'description' => __( 'Bankinstitut', 'wcvendors-pro' ), | |
'type' => 'text', | |
'value' => $value, | |
) | |
); | |
} | |
} | |
function store_iban_details( ){ | |
if ( class_exists( 'WCVendors_Pro' ) ){ | |
$key = '_wcv_custom_settings_ibanname'; | |
$value = get_user_meta( get_current_user_id(), $key, true ); | |
// iban Name | |
WCVendors_Pro_Form_Helper::input( array( | |
'id' => $key, | |
'label' => __( 'IBAN Nummer bitte nicht vergessen', 'wcvendors-pro' ), | |
'placeholder' => __( 'IBAN NUMMER', 'wcvendors-pro' ), | |
'desc_tip' => 'true', | |
'description' => __( 'IBAN Nummer', 'wcvendors-pro' ), | |
'type' => 'text', | |
'value' => $value, | |
) | |
); | |
} | |
} | |
add_action( 'wcvendors_admin_after_commission_due', 'wcv_store_bank_details_admin' ); | |
function wcv_store_bank_details_admin( $user ) { | |
?> | |
<tr> | |
<th><label for="_wcv_custom_settings_bankname"><?php _e( 'Bank Name', 'wcvendors-pro' ); ?></label></th> | |
<td><input type="text" name="_wcv_custom_settings_bankname" id="_wcv_custom_settings_bankname" value="<?php echo get_user_meta( $user->ID, '_wcv_custom_settings_bankname', true ); ?>" class="regular-text"></td> | |
</tr> | |
<?php | |
} | |
add_action( 'wcvendors_admin_after_commission_due', 'wcv_store_iban_details_admin' ); | |
function wcv_store_iban_details_admin( $user ) { | |
?> | |
<tr> | |
<th><label for="_wcv_custom_settings_iban"><?php _e( 'IBAN NUMMER', 'wcvendors-pro' ); ?></label></th> | |
<td><input type="text" name="_wcv_custom_settings_iban" id="_wcv_custom_settings_iban" value="<?php echo get_user_meta( $user->ID, '_wcv_custom_settings_iban', true ); ?>" class="regular-text"></td> | |
</tr> | |
<?php | |
} | |
// This saves the _wcv_custom_settings_iban when on the wp-admin > users > edit user screen | |
add_action( 'wcvendors_update_admin_user', 'iban_details_save' ); | |
function iban_details_save( $user_id ) | |
{ | |
if ( isset( $_POST['_wcv_custom_settings_iban'] ) ) { | |
update_user_meta( $user_id, '_wcv_custom_settings_iban', $_POST['_wcv_custom_settings_iban'] ); | |
} | |
} | |
// And repeating this but with the next meta key | |
add_action( 'wcvendors_update_admin_user', 'bankname_details_save' ); | |
function bankname_details_save( $user_id ) | |
{ | |
if ( isset( $_POST['_wcv_custom_settings_bankname'] ) ) { | |
update_user_meta( $user_id, '_wcv_custom_settings_bankname', $_POST['_wcv_custom_settings_bankname'] ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment