Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Controller_Certificates::change_sharing_settings( int $cert_id, bool $is_allowed )

Change shareable settings of a certificate.

Parameters Parameters


(int) (Required) WP Post ID of the llms_my_certificate.


(bool) (Required) Allow share the certificate or not.

Top ↑

Return Return

(WP_Error|boolean) Returns true on success and false on failure or an error object when the user does not have sufficient privileges.

Top ↑

Source Source

File: includes/controllers/class.llms.controller.certificates.php

	private function change_sharing_settings( $cert_id, $is_allowed ) {

		$cert = new LLMS_User_Certificate( $cert_id );

		if ( ! $cert->can_user_manage() ) {
			return new WP_Error( 'insufficient-permissions', __( 'You are not allowed to manage this certificate.', 'lifterlms' ) );

		return $cert->set( 'allow_sharing', $is_allowed ? 'yes' : 'no' );


Top ↑

Changelog Changelog

Version Description
4.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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