LLMS_Controller_Certificates::maybe_handle_reporting_actions()

Handle certificate form actions


Description Description

Manages frontend actions to download and manage certificate sharing settings and reporting (admin) actions to download and delete.

The method name is a misnomer as this method handles actions on reporting screens as well as on the site’s frontend when actually viewing a certificate


Top ↑

Return Return

(void)


Top ↑

Source Source

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

	public function maybe_handle_reporting_actions() {
		if ( ! isset( $_REQUEST['_llms_cert_actions_nonce'] ) ) {
			return;
		}
		if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['_llms_cert_actions_nonce'] ) ), 'llms-cert-actions' ) ) {
			return;
		}

		$cert_id = absint( llms_filter_input( INPUT_POST, 'certificate_id', FILTER_SANITIZE_NUMBER_INT ) );
		if ( isset( $_POST['llms_generate_cert'] ) ) {
			$cert = new LLMS_User_Certificate( $cert_id );
			if ( ! $cert->can_user_manage() ) {
				return;
			}
			$this->download( $cert_id );
		} elseif ( isset( $_POST['llms_delete_cert'] ) ) {
			if ( ! current_user_can( 'manage_lifterlms' ) ) {
				return;
			}

			$this->delete( $cert_id );
		} elseif ( isset( $_POST['llms_enable_cert_sharing'] ) ) {
			$this->change_sharing_settings( $cert_id, (bool) $_POST['llms_enable_cert_sharing'] );
		}
	}


Top ↑

Changelog Changelog

Changelog
Version Description
5.9.0 Stop using deprecated FILTER_SANITIZE_STRING.
4.5.0 Add handler for changing certificate sharing settings.
3.35.0 Sanitize $_POST data.
3.18.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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