Notification filter preferences remover

Last modified by slauriere on 2019/07/05 11:05

cogRemoves the page only notification filter preferences for a given user
Developed by


0 Votes
LicenseGNU Lesser General Public License 2.1


This snippet removes all the notification filters of a given user whose scope is "page only". It can be handy when a user has many page notification filters, which can slow down the wiki in some cases.

def notificationFilterPreferenceService = services.component.componentManager.getInstance(org.xwiki.notifications.filters.NotificationFilterPreferenceManager.class)
def userReference = services.model.createDocumentReference("xwiki", "XWiki", "jdoe")
def filters = notificationFilterPreferenceService.getFilterPreferences(userReference)
filters.eachWithIndex() {
 it, index ->
 if (it.pageOnly != null) {
   println "* #${index}: ${}"
   notificationFilterPreferenceService.deleteFilterPreference(userReference, it.getId())

Prerequisites & Installation Instructions

Copy the code snippet to a page and save it.

Created by slauriere on 2019/07/05 11:05

Get Connected