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

(int|WP_Error) WP_User ID on success, error object on failure.


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'] );

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

	}


Top ↑

Changelog Changelog

Changelog
Version Description
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.