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()
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.
Source Source
File: includes/forms/class-llms-form-handler.php
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | 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 ); } |
Expand full source code Collapse full source code View on GitHub
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. |