LLMS_Form_Handler::submit( array $posted_data, string $location, array $args = array() )

Form submission handler.


Parameters Parameters

$posted_data

(array) (Required) User-submitted form data.

$location

(string) (Required) Form location ID.

$args

(array) (Optional) Additional arguments passed to the short-circuit filter.

Default value: array()


Top ↑

Return Return

(integer|boolean|WP_Error) On success returns the WP_User ID. If the validate_only argument is passed returns true on success. Returns an error object if any validation or processing errors are encountered.


Top ↑

Source Source

File: includes/forms/class-llms-form-handler.php

	public function submit( $posted_data, $location, $args = array() ) {

		// Determine the user action to perform.
		$action = get_current_user_id() ? 'update' : 'registration';

		// Load the form, filtering out invisible fields, only for checkout form.
		if ( 'checkout' === $location ) {
			add_filter( 'llms_forms_remove_invisible_field', '__return_true', 999 );
		}
		$fields = $this->get_fields( $action, $location, $args );
		if ( 'checkout' === $location ) {
			remove_filter( 'llms_forms_remove_invisible_field', '__return_true', 999 );
		}

		if ( is_wp_error( $fields ) ) {
			return $this->submit_error( $fields, $posted_data, $action );
		}

		// Make sure the user id cannot be forced by user submission.
		unset( $posted_data['user_id'] );

		if ( ! empty( $args['validate_only'] ) ) {
			return $this->validate_fields( $posted_data, $location, $fields, $action );
		}

		return $this->submit_fields( $posted_data, $location, $fields, $action );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
7.0.0 Allow submission validation only (without actually submitting the fields) using the validate_only flag in the $args array.
5.1.0 Remove invisible fields from when loading the checkout form.
5.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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