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


Top ↑

Return Return

(mixed) int if a user id can be found, otherwise false


Top ↑

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;

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.9.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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