Withdrawal::save_withdraw_account()
Save Withdraw Method Data
Source
File: classes/Withdrawal.php
public function save_withdraw_account() { //Checking nonce dozent_checking_nonce(); $user_id = get_current_user_id(); $method = dozent_input_text( 'dozent_selected_withdraw_method' ); if ( ! $method ) { dozent_redirect(); } $method_data = dozent_input_array_field( "withdraw_method_field." . $method ); $available_withdraw_method = dozent_withdrawal_methods(); if ( dozent_count( $method_data ) ) { $saved_data = []; $saved_data['withdraw_method_key'] = $method; $saved_data['withdraw_method_name'] = dozent_array_get( $method . ".method_name", $available_withdraw_method ); foreach ( $method_data as $input_name => $value ) { $saved_data[ $input_name ]['value'] = sanitize_text_field( $value ); $saved_data[ $input_name ]['label'] = dozent_array_get( $method . ".form_fields.{$input_name}.label", $available_withdraw_method ); } update_user_meta( $user_id, '_dozent_withdraw_method_data', $saved_data ); } dozent_set_flash_message( __( 'Withdraw preference has been saved', 'dozent' ) ); dozent_redirect(); }
Changelog
Version | Description |
---|---|
v.1.0.0 | Introduced. |