Skip to content

Commit

Permalink
Fix for notifications not disappearing (#2773)
Browse files Browse the repository at this point in the history
* Fix data attributes like data-auto-dismiss in the notifications.
  • Loading branch information
brianhogg authored Oct 24, 2024
1 parent 301d0fa commit 53b9f5c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .changelogs/fix_notifications-not-disappearing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
significance: patch
type: fixed
links:
- "#2772"
entry: Fix for notifications no longer auto-dismissing.
13 changes: 1 addition & 12 deletions includes/abstracts/llms.abstract.notification.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ public function __construct( $notification ) {
$this->basic_options = apply_filters( $this->get_filter( 'basic_options' ), $this->basic_options, $this );

add_filter( 'llms_user_info_shortcode_user_id', array( $this, 'set_shortcode_user' ) );

}

/**
Expand Down Expand Up @@ -274,6 +273,7 @@ private function get_basic_html() {
'notifications/basic.php',
array(
'atts' => $atts,
'attributes' => $attributes,
'body' => $body,
'classes' => implode( ' ', $classes ),
'date' => $this->get_date_display( 5 ),
Expand All @@ -288,7 +288,6 @@ private function get_basic_html() {
$html = trim( preg_replace( '/\s+/S', ' ', ob_get_clean() ) );

return apply_filters( $this->get_filter( 'get_basic_html' ), $html, $this );

}

/**
Expand Down Expand Up @@ -322,7 +321,6 @@ public function get_date( $date = 'created', $format = null ) {
}

return date_i18n( $format, strtotime( $this->notification->get( $date ) ) );

}

/**
Expand All @@ -348,7 +346,6 @@ public function get_date_display( $max_days = 5 ) {
}

return $this->get_date( 'created' );

}

/**
Expand Down Expand Up @@ -491,7 +488,6 @@ public function get_html() {
}

return apply_filters( $this->get_filter( 'get_html' ), $html, $this );

}

/**
Expand Down Expand Up @@ -566,7 +562,6 @@ public function get_merge_codes() {
}

return apply_filters( $this->get_filter( 'get_merge_codes' ), $this->merge_codes, $this );

}

/**
Expand All @@ -591,7 +586,6 @@ protected function get_merge_code_defaults() {
}

return $codes;

}

/**
Expand Down Expand Up @@ -631,7 +625,6 @@ private function get_merged_string( $string ) {
}

return apply_filters( $this->get_filter( 'get_merged_string' ), $this->sentence_case( $string ), $this );

}

/**
Expand All @@ -653,7 +646,6 @@ function ( $code ) use ( $string ) {
ARRAY_FILTER_USE_KEY
)
);

}

/**
Expand Down Expand Up @@ -773,7 +765,6 @@ private function sentence_case( $string ) {
}

return trim( $new_string );

}

/**
Expand All @@ -797,7 +788,6 @@ protected function set_merge_data_default( $code ) {
}

return $code;

}

/**
Expand All @@ -824,5 +814,4 @@ protected function set_supported_fields() {
),
);
}

}
6 changes: 5 additions & 1 deletion templates/notifications/basic.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@

defined( 'ABSPATH' ) || exit;
?>
<div class="<?php echo esc_attr( $classes ); ?>"<?php echo esc_attr( $atts ); ?> id="llms-notification-<?php echo esc_attr( $id ); ?>">
<div class="<?php echo esc_attr( $classes ); ?>"
<?php foreach ( (array) $attributes as $att => $val ) : ?>
<?php echo esc_attr( 'data-' . $att ); ?>="<?php echo esc_attr( $val ); ?>"
<?php endforeach; ?>
id="<?php echo esc_attr( 'llms-notification-' . $id ); ?>">

<?php do_action( 'llms_before_basic_notification', $id ); ?>

Expand Down

0 comments on commit 53b9f5c

Please sign in to comment.