LLMS_Meta_Box_Order_Details::save( int $post_id )

Save method


Parameters Parameters

$post_id

(int) (Required) Post ID of the Order.


Top ↑

Return Return

(int) Returns -1 on invalid or missing nonce, 0 when an order cannot be found, and 1 otherwise.


Top ↑

Source Source

File: includes/admin/post-types/meta-boxes/class.llms.meta.box.order.details.php

	public function save( $post_id ) {

		if ( ! llms_verify_nonce( 'lifterlms_meta_nonce', 'lifterlms_save_data' ) ) {
			return -1;
		}

		$order = llms_get_post( $post_id );
		if ( ! $order || ! is_a( $order, 'LLMS_Order' ) ) {
			return 0;
		}

		$fields = array(
			'payment_gateway',
			'gateway_customer_id',
			'gateway_subscription_id',
			'gateway_source_id',
		);

		foreach ( $fields as $key ) {

			if ( isset( $_POST[ $key ] ) ) {
				$order->set( $key, llms_filter_input_sanitize_string( INPUT_POST, $key ) );
			}
		}

		$this->save_remaining_payments( $order );

		return 1;

	}


Top ↑

Changelog Changelog

Changelog
Version Description
5.9.0 Stop using deprecated FILTER_SANITIZE_STRING.
5.3.0 Update return value from void to int (for testing conditions) and include update remaining payment data when necessary.
3.35.0 Verify nonces and sanitize $_POST data.
3.10.0 Unknown.
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.