3 <html lang=
"en" class=
"no-js">
7 <meta name=
"viewport" content=
"width=device-width,initial-scale=1">
12 <link rel=
"canonical" href=
"https://docs.woltlab.com/5.4/php/api/user_notifications/">
14 <link rel=
"icon" href=
"../../../assets/default.favicon.ico">
15 <meta name=
"generator" content=
"mkdocs-1.1.2, mkdocs-material-7.1.2">
19 <title>User Notifications - WoltLab Suite Documentation
</title>
23 <link rel=
"stylesheet" href=
"../../../assets/stylesheets/main.6f955dcd.min.css">
26 <link rel=
"stylesheet" href=
"../../../assets/stylesheets/palette.ef6f36e2.min.css">
30 <meta name=
"theme-color" content=
"#009485">
40 <link rel=
"stylesheet" href=
"../../../stylesheets/extra.css">
54 <body dir=
"ltr" data-md-color-scheme=
"" data-md-color-primary=
"teal" data-md-color-accent=
"">
57 <script>function __prefix(e){return new URL(
"../../..",location).pathname+
"."+e}function __get(e,t=localStorage){return JSON.parse(t.getItem(__prefix(e)))}
</script>
59 <input class=
"md-toggle" data-md-toggle=
"drawer" type=
"checkbox" id=
"__drawer" autocomplete=
"off">
60 <input class=
"md-toggle" data-md-toggle=
"search" type=
"checkbox" id=
"__search" autocomplete=
"off">
61 <label class=
"md-overlay" for=
"__drawer"></label>
62 <div data-md-component=
"skip">
65 <a href=
"#user-notifications" class=
"md-skip">
70 <div data-md-component=
"announce">
72 <aside class=
"md-announce">
73 <div class=
"md-announce__inner md-grid md-typeset">
75 <a href=
"https://www.woltlab.com">Back to
<strong>woltlab.com
</strong></a>
82 <header class=
"md-header" data-md-component=
"header">
83 <nav class=
"md-header__inner md-grid" aria-label=
"Header">
84 <a href=
"../../.." title=
"WoltLab Suite Documentation" class=
"md-header__button md-logo" aria-label=
"WoltLab Suite Documentation" data-md-component=
"logo">
86 <img src=
"../../../assets/logo.png" alt=
"logo">
89 <label class=
"md-header__button md-icon" for=
"__drawer">
90 <svg xmlns=
"http://www.w3.org/2000/svg" viewBox=
"0 0 24 24"><path d=
"M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2z"/></svg>
92 <div class=
"md-header__title" data-md-component=
"header-title">
93 <div class=
"md-header__ellipsis">
94 <div class=
"md-header__topic">
95 <span class=
"md-ellipsis">
96 WoltLab Suite Documentation
99 <div class=
"md-header__topic" data-md-component=
"header-topic">
100 <span class=
"md-ellipsis">
111 <label class=
"md-header__button md-icon" for=
"__search">
112 <svg xmlns=
"http://www.w3.org/2000/svg" viewBox=
"0 0 24 24"><path d=
"M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
115 <div class=
"md-search" data-md-component=
"search" role=
"dialog">
116 <label class=
"md-search__overlay" for=
"__search"></label>
117 <div class=
"md-search__inner" role=
"search">
118 <form class=
"md-search__form" name=
"search">
119 <input type=
"text" class=
"md-search__input" name=
"query" aria-label=
"Search" placeholder=
"Search" autocapitalize=
"off" autocorrect=
"off" autocomplete=
"off" spellcheck=
"false" data-md-component=
"search-query" data-md-state=
"active" required
>
120 <label class=
"md-search__icon md-icon" for=
"__search">
121 <svg xmlns=
"http://www.w3.org/2000/svg" viewBox=
"0 0 24 24"><path d=
"M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
122 <svg xmlns=
"http://www.w3.org/2000/svg" viewBox=
"0 0 24 24"><path d=
"M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
124 <button type=
"reset" class=
"md-search__icon md-icon" aria-label=
"Clear" tabindex=
"-1">
125 <svg xmlns=
"http://www.w3.org/2000/svg" viewBox=
"0 0 24 24"><path d=
"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg>
128 <div class=
"md-search__output">
129 <div class=
"md-search__scrollwrap" data-md-scrollfix
>
130 <div class=
"md-search-result" data-md-component=
"search-result">
131 <div class=
"md-search-result__meta">
134 <ol class=
"md-search-result__list"></ol>
142 <div class=
"md-header__source">
144 <a href=
"https://github.com/WoltLab/docs.woltlab.com/" title=
"Go to repository" class=
"md-source" data-md-component=
"source">
145 <div class=
"md-source__icon md-icon">
147 <svg xmlns=
"http://www.w3.org/2000/svg" viewBox=
"0 0 448 512"><path d=
"M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
149 <div class=
"md-source__repository">
158 <div class=
"md-container" data-md-component=
"container">
163 <main class=
"md-main" data-md-component=
"main">
164 <div class=
"md-main__inner md-grid">
168 <div class=
"md-sidebar md-sidebar--primary" data-md-component=
"sidebar" data-md-type=
"navigation" >
169 <div class=
"md-sidebar__scrollwrap">
170 <div class=
"md-sidebar__inner">
174 <nav class=
"md-nav md-nav--primary" aria-label=
"Navigation" data-md-level=
"0">
175 <label class=
"md-nav__title" for=
"__drawer">
176 <a href=
"../../.." title=
"WoltLab Suite Documentation" class=
"md-nav__button md-logo" aria-label=
"WoltLab Suite Documentation" data-md-component=
"logo">
178 <img src=
"../../../assets/logo.png" alt=
"logo">
181 WoltLab Suite Documentation
184 <div class=
"md-nav__source">
186 <a href=
"https://github.com/WoltLab/docs.woltlab.com/" title=
"Go to repository" class=
"md-source" data-md-component=
"source">
187 <div class=
"md-source__icon md-icon">
189 <svg xmlns=
"http://www.w3.org/2000/svg" viewBox=
"0 0 448 512"><path d=
"M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
191 <div class=
"md-source__repository">
197 <ul class=
"md-nav__list" data-md-scrollfix
>
206 <li class=
"md-nav__item">
207 <a href=
"../../../getting-started/" class=
"md-nav__link">
224 <li class=
"md-nav__item md-nav__item--active md-nav__item--nested">
227 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_2" type=
"checkbox" id=
"__nav_2" checked
>
229 <label class=
"md-nav__link" for=
"__nav_2">
231 <span class=
"md-nav__icon md-icon"></span>
233 <nav class=
"md-nav" aria-label=
"PHP API" data-md-level=
"1">
234 <label class=
"md-nav__title" for=
"__nav_2">
235 <span class=
"md-nav__icon md-icon"></span>
238 <ul class=
"md-nav__list" data-md-scrollfix
>
244 <li class=
"md-nav__item">
245 <a href=
"../../pages/" class=
"md-nav__link">
256 <li class=
"md-nav__item">
257 <a href=
"../../database-objects/" class=
"md-nav__link">
268 <li class=
"md-nav__item">
269 <a href=
"../../database-access/" class=
"md-nav__link">
280 <li class=
"md-nav__item">
281 <a href=
"../../exceptions/" class=
"md-nav__link">
295 <li class=
"md-nav__item md-nav__item--active md-nav__item--nested">
298 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_2_5" type=
"checkbox" id=
"__nav_2_5" checked
>
300 <label class=
"md-nav__link" for=
"__nav_2_5">
302 <span class=
"md-nav__icon md-icon"></span>
304 <nav class=
"md-nav" aria-label=
"API" data-md-level=
"2">
305 <label class=
"md-nav__title" for=
"__nav_2_5">
306 <span class=
"md-nav__icon md-icon"></span>
309 <ul class=
"md-nav__list" data-md-scrollfix
>
316 <li class=
"md-nav__item md-nav__item--nested">
319 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_2_5_1" type=
"checkbox" id=
"__nav_2_5_1" >
321 <label class=
"md-nav__link" for=
"__nav_2_5_1">
323 <span class=
"md-nav__icon md-icon"></span>
325 <nav class=
"md-nav" aria-label=
"Caches" data-md-level=
"3">
326 <label class=
"md-nav__title" for=
"__nav_2_5_1">
327 <span class=
"md-nav__icon md-icon"></span>
330 <ul class=
"md-nav__list" data-md-scrollfix
>
336 <li class=
"md-nav__item">
337 <a href=
"../caches/" class=
"md-nav__link">
348 <li class=
"md-nav__item">
349 <a href=
"../caches_persistent-caches/" class=
"md-nav__link">
360 <li class=
"md-nav__item">
361 <a href=
"../caches_runtime-caches/" class=
"md-nav__link">
378 <li class=
"md-nav__item">
379 <a href=
"../comments/" class=
"md-nav__link">
390 <li class=
"md-nav__item">
391 <a href=
"../cronjobs/" class=
"md-nav__link">
402 <li class=
"md-nav__item">
403 <a href=
"../events/" class=
"md-nav__link">
415 <li class=
"md-nav__item md-nav__item--nested">
418 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_2_5_5" type=
"checkbox" id=
"__nav_2_5_5" >
420 <label class=
"md-nav__link" for=
"__nav_2_5_5">
422 <span class=
"md-nav__icon md-icon"></span>
424 <nav class=
"md-nav" aria-label=
"Form Builder" data-md-level=
"3">
425 <label class=
"md-nav__title" for=
"__nav_2_5_5">
426 <span class=
"md-nav__icon md-icon"></span>
429 <ul class=
"md-nav__list" data-md-scrollfix
>
435 <li class=
"md-nav__item">
436 <a href=
"../form_builder/overview/" class=
"md-nav__link">
447 <li class=
"md-nav__item">
448 <a href=
"../form_builder/structure/" class=
"md-nav__link">
459 <li class=
"md-nav__item">
460 <a href=
"../form_builder/form_fields/" class=
"md-nav__link">
471 <li class=
"md-nav__item">
472 <a href=
"../form_builder/validation_data/" class=
"md-nav__link">
483 <li class=
"md-nav__item">
484 <a href=
"../form_builder/dependencies/" class=
"md-nav__link">
501 <li class=
"md-nav__item">
502 <a href=
"../package_installation_plugins/" class=
"md-nav__link">
503 Package Installation Plugins
513 <li class=
"md-nav__item">
514 <a href=
"../user_activity_points/" class=
"md-nav__link">
527 <li class=
"md-nav__item md-nav__item--active">
529 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"toc" type=
"checkbox" id=
"__toc">
535 <label class=
"md-nav__link md-nav__link--active" for=
"__toc">
537 <span class=
"md-nav__icon md-icon"></span>
540 <a href=
"./" class=
"md-nav__link md-nav__link--active">
545 <nav class=
"md-nav md-nav--secondary" aria-label=
"Table of contents">
552 <label class=
"md-nav__title" for=
"__toc">
553 <span class=
"md-nav__icon md-icon"></span>
556 <ul class=
"md-nav__list" data-md-component=
"toc" data-md-scrollfix
>
558 <li class=
"md-nav__item">
559 <a href=
"#objecttypexml" class=
"md-nav__link">
565 <li class=
"md-nav__item">
566 <a href=
"#usernotificationeventxml" class=
"md-nav__link">
567 userNotificationEvent.xml
572 <li class=
"md-nav__item">
573 <a href=
"#firing-events" class=
"md-nav__link">
579 <li class=
"md-nav__item">
580 <a href=
"#marking-notifications-as-confirmed" class=
"md-nav__link">
581 Marking Notifications as Confirmed
598 <li class=
"md-nav__item">
599 <a href=
"../sitemaps/" class=
"md-nav__link">
616 <li class=
"md-nav__item">
617 <a href=
"../../code-style/" class=
"md-nav__link">
628 <li class=
"md-nav__item">
629 <a href=
"../../apps/" class=
"md-nav__link">
640 <li class=
"md-nav__item">
641 <a href=
"../../gdpr/" class=
"md-nav__link">
662 <li class=
"md-nav__item md-nav__item--nested">
665 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_3" type=
"checkbox" id=
"__nav_3" >
667 <label class=
"md-nav__link" for=
"__nav_3">
668 Languages, Templates & CSS
669 <span class=
"md-nav__icon md-icon"></span>
671 <nav class=
"md-nav" aria-label=
"Languages, Templates & CSS" data-md-level=
"1">
672 <label class=
"md-nav__title" for=
"__nav_3">
673 <span class=
"md-nav__icon md-icon"></span>
674 Languages, Templates & CSS
676 <ul class=
"md-nav__list" data-md-scrollfix
>
682 <li class=
"md-nav__item">
683 <a href=
"../../../view/languages/" class=
"md-nav__link">
694 <li class=
"md-nav__item">
695 <a href=
"../../../view/templates/" class=
"md-nav__link">
706 <li class=
"md-nav__item">
707 <a href=
"../../../view/template-plugins/" class=
"md-nav__link">
718 <li class=
"md-nav__item">
719 <a href=
"../../../view/css/" class=
"md-nav__link">
740 <li class=
"md-nav__item md-nav__item--nested">
743 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_4" type=
"checkbox" id=
"__nav_4" >
745 <label class=
"md-nav__link" for=
"__nav_4">
746 TypeScript and JavaScript API
747 <span class=
"md-nav__icon md-icon"></span>
749 <nav class=
"md-nav" aria-label=
"TypeScript and JavaScript API" data-md-level=
"1">
750 <label class=
"md-nav__title" for=
"__nav_4">
751 <span class=
"md-nav__icon md-icon"></span>
752 TypeScript and JavaScript API
754 <ul class=
"md-nav__list" data-md-scrollfix
>
760 <li class=
"md-nav__item">
761 <a href=
"../../../javascript/general-usage/" class=
"md-nav__link">
772 <li class=
"md-nav__item">
773 <a href=
"../../../javascript/typescript/" class=
"md-nav__link">
785 <li class=
"md-nav__item md-nav__item--nested">
788 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_4_3" type=
"checkbox" id=
"__nav_4_3" >
790 <label class=
"md-nav__link" for=
"__nav_4_3">
792 <span class=
"md-nav__icon md-icon"></span>
794 <nav class=
"md-nav" aria-label=
"New API" data-md-level=
"2">
795 <label class=
"md-nav__title" for=
"__nav_4_3">
796 <span class=
"md-nav__icon md-icon"></span>
799 <ul class=
"md-nav__list" data-md-scrollfix
>
805 <li class=
"md-nav__item">
806 <a href=
"../../../javascript/new-api_writing-a-module/" class=
"md-nav__link">
817 <li class=
"md-nav__item">
818 <a href=
"../../../javascript/new-api_data-structures/" class=
"md-nav__link">
829 <li class=
"md-nav__item">
830 <a href=
"../../../javascript/new-api_core/" class=
"md-nav__link">
841 <li class=
"md-nav__item">
842 <a href=
"../../../javascript/new-api_dom/" class=
"md-nav__link">
853 <li class=
"md-nav__item">
854 <a href=
"../../../javascript/new-api_events/" class=
"md-nav__link">
865 <li class=
"md-nav__item">
866 <a href=
"../../../javascript/new-api_ajax/" class=
"md-nav__link">
877 <li class=
"md-nav__item">
878 <a href=
"../../../javascript/new-api_dialogs/" class=
"md-nav__link">
889 <li class=
"md-nav__item">
890 <a href=
"../../../javascript/new-api_browser/" class=
"md-nav__link">
891 Browser and Screen Sizes
901 <li class=
"md-nav__item">
902 <a href=
"../../../javascript/new-api_ui/" class=
"md-nav__link">
919 <li class=
"md-nav__item">
920 <a href=
"../../../javascript/legacy-api/" class=
"md-nav__link">
931 <li class=
"md-nav__item">
932 <a href=
"../../../javascript/helper-functions/" class=
"md-nav__link">
943 <li class=
"md-nav__item">
944 <a href=
"../../../javascript/code-snippets/" class=
"md-nav__link">
965 <li class=
"md-nav__item md-nav__item--nested">
968 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_5" type=
"checkbox" id=
"__nav_5" >
970 <label class=
"md-nav__link" for=
"__nav_5">
972 <span class=
"md-nav__icon md-icon"></span>
974 <nav class=
"md-nav" aria-label=
"Package Components" data-md-level=
"1">
975 <label class=
"md-nav__title" for=
"__nav_5">
976 <span class=
"md-nav__icon md-icon"></span>
979 <ul class=
"md-nav__list" data-md-scrollfix
>
985 <li class=
"md-nav__item">
986 <a href=
"../../../package/package-xml/" class=
"md-nav__link">
998 <li class=
"md-nav__item md-nav__item--nested">
1001 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_5_2" type=
"checkbox" id=
"__nav_5_2" >
1003 <label class=
"md-nav__link" for=
"__nav_5_2">
1005 <span class=
"md-nav__icon md-icon"></span>
1007 <nav class=
"md-nav" aria-label=
"PIPs" data-md-level=
"2">
1008 <label class=
"md-nav__title" for=
"__nav_5_2">
1009 <span class=
"md-nav__icon md-icon"></span>
1012 <ul class=
"md-nav__list" data-md-scrollfix
>
1018 <li class=
"md-nav__item">
1019 <a href=
"../../../package/pip/" class=
"md-nav__link">
1030 <li class=
"md-nav__item">
1031 <a href=
"../../../package/pip/acl-option/" class=
"md-nav__link">
1042 <li class=
"md-nav__item">
1043 <a href=
"../../../package/pip/acp-menu/" class=
"md-nav__link">
1054 <li class=
"md-nav__item">
1055 <a href=
"../../../package/pip/acp-search-provider/" class=
"md-nav__link">
1066 <li class=
"md-nav__item">
1067 <a href=
"../../../package/pip/acp-template/" class=
"md-nav__link">
1078 <li class=
"md-nav__item">
1079 <a href=
"../../../package/pip/bbcode/" class=
"md-nav__link">
1090 <li class=
"md-nav__item">
1091 <a href=
"../../../package/pip/box/" class=
"md-nav__link">
1102 <li class=
"md-nav__item">
1103 <a href=
"../../../package/pip/clipboard-action/" class=
"md-nav__link">
1114 <li class=
"md-nav__item">
1115 <a href=
"../../../package/pip/core-object/" class=
"md-nav__link">
1126 <li class=
"md-nav__item">
1127 <a href=
"../../../package/pip/cronjob/" class=
"md-nav__link">
1138 <li class=
"md-nav__item">
1139 <a href=
"../../../package/pip/database/" class=
"md-nav__link">
1150 <li class=
"md-nav__item">
1151 <a href=
"../../../package/pip/event-listener/" class=
"md-nav__link">
1162 <li class=
"md-nav__item">
1163 <a href=
"../../../package/pip/file/" class=
"md-nav__link">
1174 <li class=
"md-nav__item">
1175 <a href=
"../../../package/pip/language/" class=
"md-nav__link">
1186 <li class=
"md-nav__item">
1187 <a href=
"../../../package/pip/media-provider/" class=
"md-nav__link">
1198 <li class=
"md-nav__item">
1199 <a href=
"../../../package/pip/menu/" class=
"md-nav__link">
1210 <li class=
"md-nav__item">
1211 <a href=
"../../../package/pip/menu-item/" class=
"md-nav__link">
1222 <li class=
"md-nav__item">
1223 <a href=
"../../../package/pip/object-type/" class=
"md-nav__link">
1234 <li class=
"md-nav__item">
1235 <a href=
"../../../package/pip/object-type-definition/" class=
"md-nav__link">
1236 objectTypeDefinition
1246 <li class=
"md-nav__item">
1247 <a href=
"../../../package/pip/option/" class=
"md-nav__link">
1258 <li class=
"md-nav__item">
1259 <a href=
"../../../package/pip/page/" class=
"md-nav__link">
1270 <li class=
"md-nav__item">
1271 <a href=
"../../../package/pip/pip/" class=
"md-nav__link">
1282 <li class=
"md-nav__item">
1283 <a href=
"../../../package/pip/script/" class=
"md-nav__link">
1294 <li class=
"md-nav__item">
1295 <a href=
"../../../package/pip/smiley/" class=
"md-nav__link">
1306 <li class=
"md-nav__item">
1307 <a href=
"../../../package/pip/sql/" class=
"md-nav__link">
1318 <li class=
"md-nav__item">
1319 <a href=
"../../../package/pip/style/" class=
"md-nav__link">
1330 <li class=
"md-nav__item">
1331 <a href=
"../../../package/pip/template/" class=
"md-nav__link">
1342 <li class=
"md-nav__item">
1343 <a href=
"../../../package/pip/template-listener/" class=
"md-nav__link">
1354 <li class=
"md-nav__item">
1355 <a href=
"../../../package/pip/user-group-option/" class=
"md-nav__link">
1366 <li class=
"md-nav__item">
1367 <a href=
"../../../package/pip/user-menu/" class=
"md-nav__link">
1378 <li class=
"md-nav__item">
1379 <a href=
"../../../package/pip/user-notification-event/" class=
"md-nav__link">
1380 userNotificationEvent
1390 <li class=
"md-nav__item">
1391 <a href=
"../../../package/pip/user-option/" class=
"md-nav__link">
1402 <li class=
"md-nav__item">
1403 <a href=
"../../../package/pip/user-profile-menu/" class=
"md-nav__link">
1420 <li class=
"md-nav__item">
1421 <a href=
"../../../package/database-php-api/" class=
"md-nav__link">
1442 <li class=
"md-nav__item md-nav__item--nested">
1445 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_6" type=
"checkbox" id=
"__nav_6" >
1447 <label class=
"md-nav__link" for=
"__nav_6">
1449 <span class=
"md-nav__icon md-icon"></span>
1451 <nav class=
"md-nav" aria-label=
"Migration" data-md-level=
"1">
1452 <label class=
"md-nav__title" for=
"__nav_6">
1453 <span class=
"md-nav__icon md-icon"></span>
1456 <ul class=
"md-nav__list" data-md-scrollfix
>
1463 <li class=
"md-nav__item md-nav__item--nested">
1466 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_6_1" type=
"checkbox" id=
"__nav_6_1" >
1468 <label class=
"md-nav__link" for=
"__nav_6_1">
1469 Migrating from WSC
5.3
1470 <span class=
"md-nav__icon md-icon"></span>
1472 <nav class=
"md-nav" aria-label=
"Migrating from WSC 5.3" data-md-level=
"2">
1473 <label class=
"md-nav__title" for=
"__nav_6_1">
1474 <span class=
"md-nav__icon md-icon"></span>
1475 Migrating from WSC
5.3
1477 <ul class=
"md-nav__list" data-md-scrollfix
>
1483 <li class=
"md-nav__item">
1484 <a href=
"../../../migration/wsc53/php/" class=
"md-nav__link">
1495 <li class=
"md-nav__item">
1496 <a href=
"../../../migration/wsc53/session/" class=
"md-nav__link">
1497 Session Handling and Authentication
1507 <li class=
"md-nav__item">
1508 <a href=
"../../../migration/wsc53/javascript/" class=
"md-nav__link">
1509 TypeScript and JavaScript
1519 <li class=
"md-nav__item">
1520 <a href=
"../../../migration/wsc53/templates/" class=
"md-nav__link">
1531 <li class=
"md-nav__item">
1532 <a href=
"../../../migration/wsc53/libraries/" class=
"md-nav__link">
1533 Third Party Libraries
1550 <li class=
"md-nav__item md-nav__item--nested">
1553 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_6_2" type=
"checkbox" id=
"__nav_6_2" >
1555 <label class=
"md-nav__link" for=
"__nav_6_2">
1556 Migrating from WSC
5.2
1557 <span class=
"md-nav__icon md-icon"></span>
1559 <nav class=
"md-nav" aria-label=
"Migrating from WSC 5.2" data-md-level=
"2">
1560 <label class=
"md-nav__title" for=
"__nav_6_2">
1561 <span class=
"md-nav__icon md-icon"></span>
1562 Migrating from WSC
5.2
1564 <ul class=
"md-nav__list" data-md-scrollfix
>
1570 <li class=
"md-nav__item">
1571 <a href=
"../../../migration/wsc52/php/" class=
"md-nav__link">
1582 <li class=
"md-nav__item">
1583 <a href=
"../../../migration/wsc52/templates/" class=
"md-nav__link">
1584 Templates and Languages
1594 <li class=
"md-nav__item">
1595 <a href=
"../../../migration/wsc52/libraries/" class=
"md-nav__link">
1596 Third Party Libraries
1613 <li class=
"md-nav__item md-nav__item--nested">
1616 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_6_3" type=
"checkbox" id=
"__nav_6_3" >
1618 <label class=
"md-nav__link" for=
"__nav_6_3">
1619 Migrating from WSC
3.1
1620 <span class=
"md-nav__icon md-icon"></span>
1622 <nav class=
"md-nav" aria-label=
"Migrating from WSC 3.1" data-md-level=
"2">
1623 <label class=
"md-nav__title" for=
"__nav_6_3">
1624 <span class=
"md-nav__icon md-icon"></span>
1625 Migrating from WSC
3.1
1627 <ul class=
"md-nav__list" data-md-scrollfix
>
1633 <li class=
"md-nav__item">
1634 <a href=
"../../../migration/wsc31/php/" class=
"md-nav__link">
1652 <li class=
"md-nav__item md-nav__item--nested">
1655 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_6_4" type=
"checkbox" id=
"__nav_6_4" >
1657 <label class=
"md-nav__link" for=
"__nav_6_4">
1658 Migrating from WSC
3.0
1659 <span class=
"md-nav__icon md-icon"></span>
1661 <nav class=
"md-nav" aria-label=
"Migrating from WSC 3.0" data-md-level=
"2">
1662 <label class=
"md-nav__title" for=
"__nav_6_4">
1663 <span class=
"md-nav__icon md-icon"></span>
1664 Migrating from WSC
3.0
1666 <ul class=
"md-nav__list" data-md-scrollfix
>
1672 <li class=
"md-nav__item">
1673 <a href=
"../../../migration/wsc30/php/" class=
"md-nav__link">
1684 <li class=
"md-nav__item">
1685 <a href=
"../../../migration/wsc30/javascript/" class=
"md-nav__link">
1696 <li class=
"md-nav__item">
1697 <a href=
"../../../migration/wsc30/templates/" class=
"md-nav__link">
1708 <li class=
"md-nav__item">
1709 <a href=
"../../../migration/wsc30/css/" class=
"md-nav__link">
1720 <li class=
"md-nav__item">
1721 <a href=
"../../../migration/wsc30/package/" class=
"md-nav__link">
1739 <li class=
"md-nav__item md-nav__item--nested">
1742 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_6_5" type=
"checkbox" id=
"__nav_6_5" >
1744 <label class=
"md-nav__link" for=
"__nav_6_5">
1745 Migrating from WCF
2.1
1746 <span class=
"md-nav__icon md-icon"></span>
1748 <nav class=
"md-nav" aria-label=
"Migrating from WCF 2.1" data-md-level=
"2">
1749 <label class=
"md-nav__title" for=
"__nav_6_5">
1750 <span class=
"md-nav__icon md-icon"></span>
1751 Migrating from WCF
2.1
1753 <ul class=
"md-nav__list" data-md-scrollfix
>
1759 <li class=
"md-nav__item">
1760 <a href=
"../../../migration/wcf21/php/" class=
"md-nav__link">
1771 <li class=
"md-nav__item">
1772 <a href=
"../../../migration/wcf21/templates/" class=
"md-nav__link">
1783 <li class=
"md-nav__item">
1784 <a href=
"../../../migration/wcf21/css/" class=
"md-nav__link">
1795 <li class=
"md-nav__item">
1796 <a href=
"../../../migration/wcf21/package/" class=
"md-nav__link">
1823 <li class=
"md-nav__item md-nav__item--nested">
1826 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_7" type=
"checkbox" id=
"__nav_7" >
1828 <label class=
"md-nav__link" for=
"__nav_7">
1830 <span class=
"md-nav__icon md-icon"></span>
1832 <nav class=
"md-nav" aria-label=
"Tutorials" data-md-level=
"1">
1833 <label class=
"md-nav__title" for=
"__nav_7">
1834 <span class=
"md-nav__icon md-icon"></span>
1837 <ul class=
"md-nav__list" data-md-scrollfix
>
1844 <li class=
"md-nav__item md-nav__item--nested">
1847 <input class=
"md-nav__toggle md-toggle" data-md-toggle=
"__nav_7_1" type=
"checkbox" id=
"__nav_7_1" >
1849 <label class=
"md-nav__link" for=
"__nav_7_1">
1851 <span class=
"md-nav__icon md-icon"></span>
1853 <nav class=
"md-nav" aria-label=
"Tutorial Series" data-md-level=
"2">
1854 <label class=
"md-nav__title" for=
"__nav_7_1">
1855 <span class=
"md-nav__icon md-icon"></span>
1858 <ul class=
"md-nav__list" data-md-scrollfix
>
1864 <li class=
"md-nav__item">
1865 <a href=
"../../../tutorial/series/overview/" class=
"md-nav__link">
1876 <li class=
"md-nav__item">
1877 <a href=
"../../../tutorial/series/part_1/" class=
"md-nav__link">
1888 <li class=
"md-nav__item">
1889 <a href=
"../../../tutorial/series/part_2/" class=
"md-nav__link">
1900 <li class=
"md-nav__item">
1901 <a href=
"../../../tutorial/series/part_3/" class=
"md-nav__link">
1912 <li class=
"md-nav__item">
1913 <a href=
"../../../tutorial/series/part_4/" class=
"md-nav__link">
1924 <li class=
"md-nav__item">
1925 <a href=
"../../../tutorial/series/part_5/" class=
"md-nav__link">
1952 <div class=
"md-sidebar md-sidebar--secondary" data-md-component=
"sidebar" data-md-type=
"toc" >
1953 <div class=
"md-sidebar__scrollwrap">
1954 <div class=
"md-sidebar__inner">
1956 <nav class=
"md-nav md-nav--secondary" aria-label=
"Table of contents">
1963 <label class=
"md-nav__title" for=
"__toc">
1964 <span class=
"md-nav__icon md-icon"></span>
1967 <ul class=
"md-nav__list" data-md-component=
"toc" data-md-scrollfix
>
1969 <li class=
"md-nav__item">
1970 <a href=
"#objecttypexml" class=
"md-nav__link">
1976 <li class=
"md-nav__item">
1977 <a href=
"#usernotificationeventxml" class=
"md-nav__link">
1978 userNotificationEvent.xml
1983 <li class=
"md-nav__item">
1984 <a href=
"#firing-events" class=
"md-nav__link">
1990 <li class=
"md-nav__item">
1991 <a href=
"#marking-notifications-as-confirmed" class=
"md-nav__link">
1992 Marking Notifications as Confirmed
2005 <div class=
"md-content" data-md-component=
"content">
2006 <article class=
"md-content__inner md-typeset">
2009 <a href=
"https://github.com/WoltLab/docs.woltlab.com/edit/5.4/docs/php/api/user_notifications.md" title=
"Edit this page" class=
"md-content__button md-icon">
2010 <svg xmlns=
"http://www.w3.org/2000/svg" viewBox=
"0 0 24 24"><path d=
"M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25z"/></svg>
2014 <h1 id=
"user-notifications">User Notifications
<a class=
"headerlink" href=
"#user-notifications" title=
"Permanent link">#
</a></h1>
2015 <p>WoltLab Suite includes a powerful user notification system that supports notifications directly shown on the website and emails sent immediately or on a daily basis.
</p>
2016 <h2 id=
"objecttypexml"><code>objectType.xml
</code><a class=
"headerlink" href=
"#objecttypexml" title=
"Permanent link">#
</a></h2>
2017 <p>For any type of object related to events, you have to define an object type for the object type definition
<code>com.woltlab.wcf.notification.objectType
</code>:
</p>
2018 <div class=
"titledCodeBox">
2019 <div class=
"codeBoxTitle">
2021 <a class=
"codeBoxTitleGitHubLink" href=
"https://github.com/WoltLab/docs.woltlab.com/tree/5.4/snippets/objectType.xml" title=
"View on GitHub"><span class=
"twemoji"><svg xmlns=
"http://www.w3.org/2000/svg" viewBox=
"0 0 24 24"><path d=
"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7a5 5 0 0 0-5 5 5 5 0 0 0 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1M8 13h8v-2H8v2m9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1 0 1.71-1.39 3.1-3.1 3.1h-4V17h4a5 5 0 0 0 5-5 5 5 0 0 0-5-5z"/></svg></span></a>
2023 ```php/api/user_notifications/objectType.xml
2027 <p>The referenced class
<code>FooUserNotificationObjectType
</code> has to implement the
<a href=
"https://github.com/WoltLab/WCF/blob/master/wcfsetup/install/files/lib/system/user/notification/object/type/IUserNotificationObjectType.class.php">IUserNotificationObjectType
</a> interface, which should be done by extending
<a href=
"https://github.com/WoltLab/WCF/blob/master/wcfsetup/install/files/lib/system/user/notification/object/type/AbstractUserNotificationObjectType.class.php">AbstractUserNotificationObjectType
</a>.
</p>
2028 <div class=
"titledCodeBox">
2029 <div class=
"codeBoxTitle">
2031 <a class=
"codeBoxTitleGitHubLink" href=
"https://github.com/WoltLab/docs.woltlab.com/tree/5.4/snippets/files/lib/system/user/notification/object/type/FooUserNotificationObjectType.class.php" title=
"View on GitHub"><span class=
"twemoji"><svg xmlns=
"http://www.w3.org/2000/svg" viewBox=
"0 0 24 24"><path d=
"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7a5 5 0 0 0-5 5 5 5 0 0 0 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1M8 13h8v-2H8v2m9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1 0 1.71-1.39 3.1-3.1 3.1h-4V17h4a5 5 0 0 0 5-5 5 5 0 0 0-5-5z"/></svg></span></a>
2033 ```php/api/user_notifications/FooUserNotificationObjectType.class.php
2037 <p>You have to set the class names of the database object (
<code>$objectClassName
</code>) and the related list (
<code>$objectListClassName
</code>).
2038 Additionally, you have to create a class that implements the
<a href=
"https://github.com/WoltLab/WCF/blob/master/wcfsetup/install/files/lib/system/user/notification/object/IUserNotificationObject.class.php">IUserNotificationObject
</a> whose name you have to set as the value of the
<code>$decoratorClassName
</code> property.
</p>
2039 <div class=
"titledCodeBox">
2040 <div class=
"codeBoxTitle">
2042 <a class=
"codeBoxTitleGitHubLink" href=
"https://github.com/WoltLab/docs.woltlab.com/tree/5.4/snippets/files/lib/system/user/notification/object/FooUserNotificationObject.class.php" title=
"View on GitHub"><span class=
"twemoji"><svg xmlns=
"http://www.w3.org/2000/svg" viewBox=
"0 0 24 24"><path d=
"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7a5 5 0 0 0-5 5 5 5 0 0 0 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1M8 13h8v-2H8v2m9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1 0 1.71-1.39 3.1-3.1 3.1h-4V17h4a5 5 0 0 0 5-5 5 5 0 0 0-5-5z"/></svg></span></a>
2044 ```php/api/user_notifications/FooUserNotificationObject.class.php
2049 <li>The
<code>getTitle()
</code> method returns the title of the object.
2050 In this case, we assume that the
<code>Foo
</code> class has implemented the
<a href=
"https://github.com/WoltLab/WCF/blob/master/wcfsetup/install/files/lib/data/ITitledObject.class.php">ITitledObject
</a> interface so that the decorated
<code>Foo
</code> can handle this method call itself.
</li>
2051 <li>The
<code>getURL()
</code> method returns the link to the object.
2052 As for the
<code>getTitle()
</code>, we assume that the
<code>Foo
</code> class has implemented the
<a href=
"https://github.com/WoltLab/WCF/blob/master/wcfsetup/install/files/lib/data/ILinkableObject.class.php">ILinkableObject
</a> interface so that the decorated
<code>Foo
</code> can also handle this method call itself.
</li>
2053 <li>The
<code>getAuthorID()
</code> method returns the id of the user who created the decorated
<code>Foo
</code> object.
2054 We assume that
<code>Foo
</code> objects have a
<code>userID
</code> property that contains this id.
</li>
2056 <h2 id=
"usernotificationeventxml"><code>userNotificationEvent.xml
</code><a class=
"headerlink" href=
"#usernotificationeventxml" title=
"Permanent link">#
</a></h2>
2057 <p>Each event that you fire in your package needs to be registered using the
<a href=
"../../../package/pip/user-notification-event/">user notification event package installation plugin
</a>.
2058 An example file might look like this:
</p>
2059 <div class=
"titledCodeBox">
2060 <div class=
"codeBoxTitle">
2062 <a class=
"codeBoxTitleGitHubLink" href=
"https://github.com/WoltLab/docs.woltlab.com/tree/5.4/snippets/userNotificationEvent.xml" title=
"View on GitHub"><span class=
"twemoji"><svg xmlns=
"http://www.w3.org/2000/svg" viewBox=
"0 0 24 24"><path d=
"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7a5 5 0 0 0-5 5 5 5 0 0 0 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1M8 13h8v-2H8v2m9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1 0 1.71-1.39 3.1-3.1 3.1h-4V17h4a5 5 0 0 0 5-5 5 5 0 0 0-5-5z"/></svg></span></a>
2064 ```php/api/user_notifications/userNotificationEvent.xml
2068 <p>Here, you reference the user notification object type created via
<code>objectType.xml
</code>.
2069 The referenced class in the
<code><classname
></code> element has to implement the
<a href=
"https://github.com/WoltLab/WCF/blob/master/wcfsetup/install/files/lib/system/user/notification/event/IUserNotificationEvent.class.php">IUserNotificationEvent
</a> interface by extending the
<a href=
"https://github.com/WoltLab/WCF/blob/master/wcfsetup/install/files/lib/system/user/notification/event/AbstractUserNotificationEvent.class.php">AbstractUserNotificationEvent
</a> class or the
<a href=
"https://github.com/WoltLab/WCF/blob/master/wcfsetup/install/files/lib/system/user/notification/event/AbstractSharedUserNotificationEvent.class.php">AbstractSharedUserNotificationEvent
</a> class if you want to pre-load additional data before processing notifications.
2070 In
<code>AbstractSharedUserNotificationEvent::prepare()
</code>, you can, for example, tell runtime caches to prepare to load certain objects which then are loaded all at once when the objects are needed.
</p>
2071 <div class=
"titledCodeBox">
2072 <div class=
"codeBoxTitle">
2074 <a class=
"codeBoxTitleGitHubLink" href=
"https://github.com/WoltLab/docs.woltlab.com/tree/5.4/snippets/files/lib/system/user/notification/event/FooUserNotificationEvent.class.php" title=
"View on GitHub"><span class=
"twemoji"><svg xmlns=
"http://www.w3.org/2000/svg" viewBox=
"0 0 24 24"><path d=
"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7a5 5 0 0 0-5 5 5 5 0 0 0 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1M8 13h8v-2H8v2m9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1 0 1.71-1.39 3.1-3.1 3.1h-4V17h4a5 5 0 0 0 5-5 5 5 0 0 0-5-5z"/></svg></span></a>
2076 ```php/api/user_notifications/FooUserNotificationEvent.class.php
2081 <li>The
<code>$stackable
</code> property is
<code>false
</code> by default and has to be explicitly set to
<code>true
</code> if stacking of notifications should be enabled.
2082 Stacking of notification does not create new notifications for the same event for a certain object if the related action as been triggered by different users.
2083 For example, if something is liked by one user and then liked again by another user before the recipient of the notification has confirmed it, the existing notification will be amended to include both users who liked the content.
2084 Stacking can thus be used to avoid cluttering the notification list of users.
</li>
2085 <li>The
<code>checkAccess()
</code> method makes sure that the active user still has access to the object related to the notification.
2086 If that is not the case, the user notification system will automatically deleted the user notification based on the return value of the method.
2087 If you have any cached values related to notifications, you should also reset these values here.
</li>
2088 <li>The
<code>getEmailMessage()
</code> method return data to create the instant email or the daily summary email.
2089 For instant emails (
<code>$notificationType = 'instant'
</code>), you have to return an array like the one shown in the code above with the following components:
</li>
2090 <li><code>application
</code>:
2091 abbreviation of application
</li>
2092 <li><code>in-reply-to
</code> (optional):
2093 message id of the notification for the parent item and used to improve the ordering in threaded email clients
</li>
2094 <li><code>message-id
</code> (optional):
2095 message id of the notification mail and has to be used in
<code>in-reply-to
</code> and
<code>references
</code> for follow up mails
</li>
2096 <li><code>references
</code> (optional):
2097 all of the message ids of parent items (i.e. recursive in-reply-to)
</li>
2098 <li><code>template
</code>:
2099 name of the template used to render the email body, should start with
<code>email_
</code></li>
2100 <li><code>variables
</code> (optional):
2101 template variables passed to the email template where they can be accessed via
<code>$notificationContent[variables]
</code></li>
2103 <p>For daily emails (
<code>$notificationType = 'daily'
</code>), only
<code>application
</code>,
<code>template
</code>, and
<code>variables
</code> are supported.
2104 - The
<code>getEmailTitle()
</code> returns the title of the instant email sent to the user.
2105 By default,
<code>getEmailTitle()
</code> simply calls
<code>getTitle()
</code>.
2106 - The
<code>getEventHash()
</code> method returns a hash by which user notifications are grouped.
2107 Here, we want to group them not by the actual
<code>Foo
</code> object but by its parent
<code>Baz
</code> object and thus overwrite the default implementation provided by
<code>AbstractUserNotificationEvent
</code>.
2108 - The
<code>getLink()
</code> returns the link to the
<code>Foo
</code> object the notification belongs to.
2109 - The
<code>getMessage()
</code> method and the
<code>getTitle()
</code> return the message and the title of the user notification respectively.
2110 By checking the value of
<code>count($this-
>getAuthors())
</code>, we check if the notification is stacked, thus if the event has been triggered for multiple users so that different languages items are used.
2111 If your notification event does not support stacking, this distinction is not necessary.
2112 - The
<code>prepare()
</code> method is called for each user notification before all user notifications are rendered.
2113 This allows to tell runtime caches to prepare to load objects later on (see
<a href=
"../caches_runtime-caches/">Runtime Caches
</a>).
</p>
2114 <h2 id=
"firing-events">Firing Events
<a class=
"headerlink" href=
"#firing-events" title=
"Permanent link">#
</a></h2>
2115 <p>When the action related to a user notification is executed, you can use
<code>UserNotificationHandler::fireEvent()
</code> to create the notifications:
</p>
2116 <table class=
"highlighttable"><tr><td class=
"linenos"><div class=
"linenodiv"><pre><span></span><span class=
"normal">1</span>
2117 <span class=
"normal">2</span>
2118 <span class=
"normal">3</span>
2119 <span class=
"normal">4</span>
2120 <span class=
"normal">5</span>
2121 <span class=
"normal">6</span>
2122 <span class=
"normal">7</span></pre></div></td><td class=
"code"><div class=
"highlight"><pre><span></span><code><span class=
"nv">$recipientIDs
</span> <span class=
"o">=
</span> <span class=
"p">[];
</span> <span class=
"c1">// fill with user ids of the recipients of the notification
</span>
2123 <span class=
"nx">UserNotificationHandler
</span><span class=
"o">::
</span><span class=
"na">getInstance
</span><span class=
"p">()
</span><span class=
"o">-
></span><span class=
"na">fireEvent
</span><span class=
"p">(
</span>
2124 <span class=
"s1">'bar
'</span><span class=
"p">,
</span> <span class=
"c1">// event name
</span>
2125 <span class=
"s1">'com.woltlab.example.foo
'</span><span class=
"p">,
</span> <span class=
"c1">// event object type name
</span>
2126 <span class=
"k">new
</span> <span class=
"nx">FooUserNotificationObject
</span><span class=
"p">(
</span><span class=
"k">new
</span> <span class=
"nx">Foo
</span><span class=
"p">(
</span><span class=
"nv">$fooID
</span><span class=
"p">)),
</span> <span class=
"c1">// object related to the event
</span>
2127 <span class=
"nv">$recipientIDs
</span>
2128 <span class=
"p">);
</span>
2131 <h2 id=
"marking-notifications-as-confirmed">Marking Notifications as Confirmed
<a class=
"headerlink" href=
"#marking-notifications-as-confirmed" title=
"Permanent link">#
</a></h2>
2132 <p>In some instances, you might want to manually mark user notifications as confirmed without the user manually confirming them, for example when they visit the page that is related to the user notification.
2133 In this case, you can use
<code>UserNotificationHandler::markAsConfirmed()
</code>:
</p>
2134 <table class=
"highlighttable"><tr><td class=
"linenos"><div class=
"linenodiv"><pre><span></span><span class=
"normal">1</span>
2135 <span class=
"normal">2</span>
2136 <span class=
"normal">3</span>
2137 <span class=
"normal">4</span>
2138 <span class=
"normal">5</span>
2139 <span class=
"normal">6</span>
2140 <span class=
"normal">7</span>
2141 <span class=
"normal">8</span></pre></div></td><td class=
"code"><div class=
"highlight"><pre><span></span><code><span class=
"nv">$recipientIDs
</span> <span class=
"o">=
</span> <span class=
"p">[];
</span> <span class=
"c1">// fill with user ids of the recipients of the notification
</span>
2142 <span class=
"nv">$fooIDs
</span> <span class=
"o">=
</span> <span class=
"p">[];
</span> <span class=
"c1">// fill with ids of related foo objects
</span>
2143 <span class=
"nx">UserNotificationHandler
</span><span class=
"o">::
</span><span class=
"na">getInstance
</span><span class=
"p">()
</span><span class=
"o">-
></span><span class=
"na">markAsConfirmed
</span><span class=
"p">(
</span>
2144 <span class=
"s1">'bar
'</span><span class=
"p">,
</span> <span class=
"c1">// event name
</span>
2145 <span class=
"s1">'com.woltlab.example.foo
'</span><span class=
"p">,
</span> <span class=
"c1">// event object type name
</span>
2146 <span class=
"nv">$recipientIDs
</span><span class=
"p">,
</span>
2147 <span class=
"nv">$fooIDs
</span>
2148 <span class=
"p">);
</span>
2156 <div class=
"md-source-date">
2159 Last update:
2021-
04-
23
2178 <footer class=
"md-footer">
2180 <nav class=
"md-footer__inner md-grid" aria-label=
"Footer">
2182 <a href=
"../user_activity_points/" class=
"md-footer__link md-footer__link--prev" rel=
"prev">
2183 <div class=
"md-footer__button md-icon">
2184 <svg xmlns=
"http://www.w3.org/2000/svg" viewBox=
"0 0 24 24"><path d=
"M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
2186 <div class=
"md-footer__title">
2187 <div class=
"md-ellipsis">
2188 <span class=
"md-footer__direction">
2191 User Activity Points
2197 <a href=
"../sitemaps/" class=
"md-footer__link md-footer__link--next" rel=
"next">
2198 <div class=
"md-footer__title">
2199 <div class=
"md-ellipsis">
2200 <span class=
"md-footer__direction">
2206 <div class=
"md-footer__button md-icon">
2207 <svg xmlns=
"http://www.w3.org/2000/svg" viewBox=
"0 0 24 24"><path d=
"M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4z"/></svg>
2213 <div class=
"md-footer-meta md-typeset">
2214 <div class=
"md-footer-meta__inner md-grid">
2215 <div class=
"md-footer-copyright">
2217 <div class=
"md-footer-copyright__highlight">
2218 Copyright ©
2020 WoltLab GmbH
2222 <a href=
"https://squidfunk.github.io/mkdocs-material/" target=
"_blank" rel=
"noopener">
2227 <div class=
"md-footer-copyright">
2228 <a href=
"https://www.woltlab.com/legal-notice/">Legal Notice
</a>
2229 <a href=
"https://www.woltlab.com/privacy-policy/">Privacy Policy
</a>
2236 <div class=
"md-dialog" data-md-component=
"dialog">
2237 <div class=
"md-dialog__inner md-typeset"></div>
2239 <script id=
"__config" type=
"application/json">{
"base":
"../../..",
"features": [],
"translations": {
"clipboard.copy":
"Copy to clipboard",
"clipboard.copied":
"Copied to clipboard",
"search.config.lang":
"en",
"search.config.pipeline":
"trimmer, stopWordFilter",
"search.config.separator":
"[\\s\\-]+",
"search.placeholder":
"Search",
"search.result.placeholder":
"Type to start searching",
"search.result.none":
"No matching documents",
"search.result.one":
"1 matching document",
"search.result.other":
"# matching documents",
"search.result.more.one":
"1 more on this page",
"search.result.more.other":
"# more on this page",
"search.result.term.missing":
"Missing"},
"search":
"../../../assets/javascripts/workers/search.fe42c31b.min.js",
"version": {
"provider":
"mike"}}
</script>
2242 <script src=
"../../../assets/javascripts/bundle.4ea5477f.min.js"></script>