LLMS_Admin_Notices::output_notice( string $notice_id )

Output a single notice by ID


Parameters Parameters

$notice_id

(string) (Required) Notice id.


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/admin/class.llms.admin.notices.php

	 * @since 3.7.4 Unknown.
	 * @since 5.2.0 Ensure `template_path` and `default_path` are properly passed to `llms_get_template()`.
	 * @since 5.3.1 Delete empty notices and do not display them.
	 *
	 * @param string $notice_id Notice id.
	 * @return void
	 */
	public static function output_notice( $notice_id ) {

		if ( current_user_can( 'manage_options' ) ) {

			$notice = self::get_notice( $notice_id );

			// Don't output those rogue empty notices I can't find.
			// @todo find the source.
			if ( empty( $notice ) || ( empty( $notice['template'] ) && empty( $notice['html'] ) ) ) {
				self::delete_notice( $notice_id );

				return;
			}
			?>
			<div class="notice notice-<?php echo $notice['type']; ?> llms-admin-notice" id="llms-notice<?php echo $notice_id; ?>" style="position:relative;">
				<div class="llms-admin-notice-icon"></div>
				<div class="llms-admin-notice-content">
					<?php if ( $notice['dismissible'] ) : ?>
						<a class="notice-dismiss" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'llms-hide-notice', $notice_id ), 'llms_hide_notices_nonce', '_llms_notice_nonce' ) ); ?>">
							<span class="screen-reader-text"><?php _e( 'Dismiss', 'lifterlms' ); ?></span>
						</a>
					<?php endif; ?>
					<?php if ( ! empty( $notice['template'] ) ) : ?>

						<?php llms_get_template( $notice['template'], array(), $notice['template_path'], $notice['default_path'] ); ?>

					<?php elseif ( ! empty( $notice['html'] ) ) : ?>

						<?php echo wpautop( wp_kses_post( $notice['html'] ) ); ?>

					<?php endif; ?>

					<?php if ( $notice['remindable'] ) : ?>
						<p style="text-align:right;"><a class="button" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'llms-remind-notice', $notice_id ), 'llms_hide_notices_nonce', '_llms_notice_nonce' ) ); ?>"><?php _e( 'Remind me later', 'lifterlms' ); ?></a></p>
					<?php endif; ?>
				</div>


Top ↑

Changelog Changelog

Changelog
Version Description
5.3.1 Delete empty notices and do not display them.
5.2.0 Ensure template_path and default_path are properly passed to llms_get_template().
3.7.4 Unknown.
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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