LLMS_Admin_User_Custom_Fields::add_errors( $errors, bool $update, obj $user )

Validate custom fields During updates will save data Creation is saved during a different action


Description Description


Parameters Parameters

(obj) (Required) &$errors Instance of WP_Error

$update

(bool) (Required) true if updating a profile, false if a new user

$user

(obj) (Required) Instance of WP_User for the user being updated


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/admin/class.llms.admin.user.custom.fields.php

	public function add_errors( &$errors, $update, $user ) {

		$this->get_fields();

		$error = $this->validate_fields( $user );

		if ( $error ) {

			$errors->add( '', $error, '' );

			if ( $update ) {
				$this->save();
			}

			// don't save
			remove_action( 'edit_user_created_user', array( $this, 'save' ) );

			return;

		}

		// if updating, save here since there's no other save specific admin action (that I could find)
		if ( $update ) {
			$this->save( $user );
		}

	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.7.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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