IV. Front

addGatewayToPaymentsWithdrawalList( $default_gateways )

public function addGatewayToPaymentsWithdrawalList( $default_gateways ) {
	$uid = get_current_user_id();

	if ( ! empty ( wpj_get_option( 'wpjobster_sample_withdrawal_enable' ) ) && wpj_get_option( 'wpjobster_sample_withdrawal_enable' ) != 'disabled' ) {
		if ( get_user_meta( $uid, 'sample_email', true ) || get_user_meta( $uid, 'sample_automatic_payee_id', true ) ) $meta = true;
		else $meta = false;

		$default_gateways['sample'] = array(
			'name'  => 'sample',
			'label' => __( 'Sample Withdrawal', 'wpjobster-sample' ),
			'meta'  => $meta
		);
	}

	return $default_gateways;
}

This function adds the gateway to the list of available gateways for withdrawal and makes it visible in Payments > Withdrawal.


addGatewayDetailsInputToPaymentsWithdrawalList( $gateway )

public function addGatewayDetailsInputToPaymentsWithdrawalList( $gateway ) {
	if ( $gateway['name'] == 'sample' ) {

		$uid = get_current_user_id();

		if ( ! empty( get_user_meta( $uid, 'sample_email', true ) ) ) { ?>

			<input value="<?php echo __( 'Sample Email', 'wpjobster-sample' ) . ': ' . get_user_meta( $uid, 'sample_payment_email', true ); ?>" type="hidden" size="30" name="details" />

		<?php } elseif ( ! empty( get_user_meta( $uid, 'sample_automatic_payee_id', true ) ) ) { ?>

			<input value="<?php echo __( 'Sample Payee ID','wpjobster-sample' ) . ': ' . get_user_meta( $uid, 'sample_automatic_payee_id', true ); ?>" type="hidden" size="30" name="details" />

		<?php }

	}
}

This function adds the user's information related to the gateway, on the withdrawal page, so that it can be sent further for processing.


addGatewayDetailsInputToSettingsPaymentsList

public function addGatewayDetailsInputToSettingsPaymentsList() {
	ob_start(); ?>

	<div id="sample-payments" class="field">
		<label><?php _e( 'Sample Payment', 'wpjobster' ); ?></label>
		<div class="two fields">
			<div class="field">
				<input type="text" name="sample_payment_email" placeholder="<?php _e( 'Sample Email', 'wpjobster' ); ?>" value="<?php echo wpj_user( $uid, 'sample_payment_email' ); ?>" />
			</div>

			<div class="field">
				<input type="text" name="sample_automatic_payee_id" placeholder="<?php _e( 'Sample Payee ID', 'wpjobster' ); ?>" value="<?php echo wpj_user( $uid, 'sample_automatic_payee_id' ); ?>" />
			</div>
		</div>
	</div>

	<?php return ob_get_clean();
}

This function will help you to create a shortcode that you need to add in Admin > Pages > Settings to allow the user to add their information related to the gateway, in the site user settings page.