LLMS_Abstract_User_Data::get_user_id( mixed $user )
Retrieve the User ID based on object
Parameters Parameters
- $user
-
(mixed) (Required) WP_User ID, instance of WP_User, or instance of any student class extending this class
Return Return
(mixed) int if a user id can be found, otherwise false
Source Source
File: includes/abstracts/llms.abstract.user.data.php
protected function get_user_id( $user ) { if ( ! $user && get_current_user_id() ) { return get_current_user_id(); } elseif ( is_numeric( $user ) ) { return $user; } elseif ( is_a( $user, 'WP_User' ) && isset( $user->ID ) ) { return $user->ID; } elseif ( $user instanceof LLMS_Abstract_User_Data ) { return $user->get_id(); } return false; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.9.0 | Introduced. |