LLMS_User_Certificate::can_user_manage( int|null $user_id = null )

Can user manage and make some actions on the certificate


Parameters Parameters

$user_id

(int|null) (Optional) WP User ID (will use get_current_user_id() if none supplied). Default null.

Default value: null


Top ↑

Return Return

(bool)


Top ↑

Source Source

File: includes/models/model.llms.user.certificate.php

	public function can_user_manage( $user_id = null ) {

		$user_id = $user_id ? $user_id : get_current_user_id();
		$result  = ( $user_id && ( $user_id === $this->get_user_id() || llms_can_user_bypass_restrictions( $user_id ) ) );

		/**
		 * Filter whether or not a user can manage a given certificate.
		 *
		 * @since 4.5.0
		 *
		 * @param boolean               $result      Whether or not the user can manage certificate.
		 * @param int                   $user_id     WP_User ID of the user viewing the certificate.
		 * @param LLMS_User_Certificate $certificate Certificate class instance.
		 */
		return apply_filters( 'llms_certificate_can_user_manage', $result, $user_id, $this );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
6.0.0 Prevent logged out users from managing certificates not assigned to a user.
4.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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