acf_pro::maybe_show_license_status_error
Checks for a license status error and renders it if necessary.
Method of the class: acf_pro{}
No Hooks.
Returns
null. Nothing (null).
Usage
$acf_pro = new acf_pro(); $acf_pro->maybe_show_license_status_error();
Changelog
| Since 6.2.1 | Introduced. |
acf_pro::maybe_show_license_status_error() acf pro::maybe show license status error code ACF 6.8.8
public function maybe_show_license_status_error() {
$license_status = acf_pro_get_license_status();
$defined_license_errors = acf_pro_get_activation_failure_transient();
$manage_url = false;
if ( ! acf_pro_get_license_key( true ) && ! defined( 'ACF_PRO_LICENSE' ) ) {
$error_msg = __( 'Activate your license to enable access to updates, support & PRO features.', 'acf' );
$manage_url = admin_url( 'edit.php?post_type=acf-field-group&page=acf-settings-updates#acf_pro_license' );
} elseif ( acf_pro_is_license_expired( $license_status ) ) {
$error_msg = __( 'Your license has expired. Please renew to continue to have access to updates, support & PRO features.', 'acf' );
$manage_url = admin_url( 'edit.php?post_type=acf-field-group&page=acf-settings-updates' );
} elseif ( acf_pro_was_license_refunded( $license_status ) ) {
$error_msg = __( 'Your ACF PRO license is no longer active. Please renew to continue to have access to updates, support, & PRO features.', 'acf' );
$manage_url = admin_url( 'edit.php?post_type=acf-field-group&page=acf-settings-updates' );
} elseif ( ! empty( $defined_license_errors ) ) {
$error_msg = $defined_license_errors['error'];
} elseif ( ! empty( $license_status['error_msg'] ) ) {
$error_msg = $license_status['error_msg'];
} else {
// No errors to show.
return;
}
if ( acf_pro_is_updates_page_visible() && ! empty( $manage_url ) && 'acf-settings-updates' !== acf_request_arg( 'page' ) ) {
$manage_link = sprintf(
'<a href="%1$s">%2$s</a>',
esc_url( $manage_url ),
__( 'Manage License', 'acf' )
);
$error_msg .= ' ' . $manage_link;
}
acf_add_admin_notice( $error_msg, 'warning', false );
}