LLMS_Order::set_user_data( array|LLMS_Student|WP_User|integer $user_or_data )

Sets user-related metadata for the order.


Parameters Parameters

$user_or_data

(array|LLMS_Student|WP_User|integer) (Required) Accepts a raw array user meta-data or an input string accepted by llms_get_student(). When passing an existing user the data will be pulled from the user metadata and saved to the order.


Top ↑

Return Return

(array) Returns an associative array representing the user metadata that was stored on the order.

  • 'user_id'
    (integer) User's WP_User id.
  • 'user_ip_address'
    (string) User's ip address.
  • 'billing_email'
    (string) User's email.
  • 'billing_first_name'
    (string) User's first name.
  • 'billing_last_name'
    (string) User's last name.
  • 'billing_address_1'
    (string) User's address line 1.
  • 'billing_address_2'
    (string) User's address line 2.
  • 'billing_city'
    (string) User's city.
  • 'billing_state'
    (string) User's state.
  • 'billing_zip'
    (string) User's zip.
  • 'billing_country'
    (string) User's country.
  • 'billing_phone'
    (string) User's phone.


Top ↑

Source Source

File: includes/models/model.llms.order.php

	 * @since 3.10.0 Unknown.
	 * @since 5.2.0 Prefer `array_key_exists( $key, $keys )` over `in_array( $key, array_keys( $assoc_array ) )`.
	 *
	 * @param string $status Status name, accepts unprefixed statuses.
	 * @return void
	 */
	public function set_status( $status ) {

		if ( false === strpos( $status, 'llms-' ) ) {
			$status = 'llms-' . $status;
		}

		if ( array_key_exists( $status, llms_get_order_statuses( $this->get( 'order_type' ) ) ) ) {
			$this->set( 'status', $status );
		}

	}

	/**
	 * Sets user-related metadata for the order.
	 *
	 * @since 7.0.0
	 *
	 * @param array|LLMS_Student|WP_User|integer $user_or_data Accepts a raw array user meta-data or
	 *                                                         an input string accepted by `llms_get_student()`.
	 *                                                         When passing an existing user the data will be pulled
	 *                                                         from the user metadata and saved to the order.
	 * @return array {
	 *     Returns an associative array representing the user metadata that was stored on the order.
	 *
	 *     @type integer $user_id            User's WP_User id.
	 *     @type string  $user_ip_address    User's ip address.
	 *     @type string  $billing_email      User's email.
	 *     @type string  $billing_first_name User's first name.
	 *     @type string  $billing_last_name  User's last name.
	 *     @type string  $billing_address_1  User's address line 1.
	 *     @type string  $billing_address_2  User's address line 2.
	 *     @type string  $billing_city       User's city.
	 *     @type string  $billing_state      User's state.
	 *     @type string  $billing_zip        User's zip.
	 *     @type string  $billing_country    User's country.
	 *     @type string  $billing_phone      User's phone.
	 * }
	 */
	public function set_user_data( $user_or_data ) {

		$to_set = array(


Top ↑

Changelog Changelog

Changelog
Version Description
7.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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