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.
Return Return
(bool)
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;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 1.0.0-beta.1 | Introduced. |