Skip to content

Commit fbb70f9

Browse files
committed
Prevent adding one message multiple times
1 parent 57b31e6 commit fbb70f9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/output.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ trait Hm_List {
7474
* @return void
7575
*/
7676
public static function add($string, $type = 'success') {
77-
self::$msgs[] = ['type' => $type, 'text' => self::str($string, false)];
77+
$string = self::str($string, false);
78+
$texts = self::get();
79+
if (! in_array($string, $texts, true)) {
80+
self::$msgs[] = ['type' => $type, 'text' => $string];
81+
}
7882
}
7983

8084
/**

0 commit comments

Comments
 (0)