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_Helper_Admin_Add_Ons::handle_activations()

Activate license keys with LifterLMS.com api


Description Description

Output errors / successes & saves successful keys to the db.


Top ↑

Return Return

(void)


Top ↑

Source Source

File: libraries/lifterlms-helper/includes/class-llms-helper-admin-add-ons.php

	 */
	private function handle_activations() {

		$res = LLMS_Helper_Keys::activate_keys( llms_filter_input( INPUT_POST, 'llms_add_keys', FILTER_SANITIZE_STRING ), true );

		if ( is_wp_error( $res ) ) {
			LLMS_Admin_Notices::flash_notice( $res->get_error_message(), 'error' );
			return;
		}

		$data = $res['data'];
		if ( isset( $data['errors'] ) ) {
			foreach ( $data['errors'] as $error ) {
				LLMS_Admin_Notices::flash_notice( make_clickable( $error ), 'error' );
			}
		}

		if ( isset( $data['activations'] ) ) {
			foreach ( $data['activations'] as $activation ) {
				LLMS_Helper_Keys::add_license_key( $activation );
				// Translators: %s = License key.
				LLMS_Admin_Notices::flash_notice( sprintf( __( '"%s" has been saved!', 'lifterlms' ), $activation['license_key'] ), 'success' );
			}
		}



Top ↑

Changelog Changelog

Changelog
Version Description
3.4.0 Use core textdomain.
3.2.0 Don't access $_POST directly.
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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