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.
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.
Source Source
File: includes/models/model.llms.order.php
1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 | * @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 ( |
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
7.0.0 | Introduced. |