LLMS_Admin_Notices::output_notice( string $notice_id )
Output a single notice by ID
Parameters Parameters
- $notice_id
-
(string) (Required) Notice id.
Return Return
(void)
Source Source
File: includes/admin/class.llms.admin.notices.php
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | * @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> |
Expand full source code Collapse full source code View on GitHub
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. |