1. Home
  2. Jobster
  3. Payment Gateways API
  4. save_gateway()

save_gateway()

public function save_gateway() {
	if ( isset( $_POST['wpjobster_save_' . $this->unique_slug] ) ) {

		// _enable and _button_caption are mandatory
		update_option( 'wpjobster_' . $this->unique_slug . '_enable',         trim( $_POST['wpjobster_' . $this->unique_slug . '_enable'] ) );
		update_option( 'wpjobster_' . $this->unique_slug . '_button_caption', trim( $_POST['wpjobster_' . $this->unique_slug . '_button_caption'] ) );

		// you can add here any other information that you need from the user
		update_option( 'wpjobster_sample_enablesandbox',                      trim( $_POST['wpjobster_sample_enablesandbox'] ) );
		update_option( 'wpjobster_sample_id',                                 trim( $_POST['wpjobster_sample_id'] ) );
		update_option( 'wpjobster_sample_key',                                trim( $_POST['wpjobster_sample_key'] ) );

		update_option( 'wpjobster_sample_success_page',                       trim( $_POST['wpjobster_sample_success_page'] ) );
		update_option( 'wpjobster_sample_failure_page',                       trim( $_POST['wpjobster_sample_failure_page'] ) );

		echo '<div class="updated fade"><p>' . __( 'Settings saved!', 'wpjobster-sample' ) . '</p></div>';
	}
}

Save the information filled by the admin, with show_gateways(). You need to populate this with all the input names that you have added on the show_gateways() function.

Was this article helpful to you? Yes No