LLMS_REST_Webhook::is_valid_user_action( int $user_id )

Determine if the current user-related action is valid for the webhook


Parameters Parameters

$user_id

(int) (Required) WP User ID.


Top ↑

Return Return

(bool)


Top ↑

Source Source

File: libraries/lifterlms-rest/includes/models/class-llms-rest-webhook.php

	protected function is_valid_user_action( $user_id ) {

		$user = get_userdata( $user_id );

		if ( ! $user ) {
			return false;
		}

		$resource = $this->get_resource();
		if ( 'student' === $resource && ! in_array( 'student', (array) $user->roles, true ) ) {
			return false;
		} elseif ( 'instructor' === $resource && ! user_can( $user_id, 'lifterlms_instructor' ) ) {
			return false;
		}

		return true;

	}


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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