![]() | Remove users who are considered spam accounts |
Type | Snippet |
Category | |
Developed by | Unknown |
Rating | |
License | Unknown |
Table of contents
Description
Pass confirm=1 in the query string to the page to perform removal. Otherwise the snippet will simply list users that their first name equal to their last name.
{{velocity}}
#foreach($result in $xwiki.search("select distinct doc.fullName, prop.value from XWikiDocument as doc, BaseObject as obj, StringProperty as prop where obj.className='XWiki.XWikiUsers' and obj.name=doc.fullName and prop.id.id=obj.id and prop.name='first_name' and prop.value is not empty and prop.value in (select prop.value from StringProperty as prop2 where prop2.id.id=obj.id and prop2.name='last_name' and prop2.value=prop.value)"))
#if ($request.confirm == "1")
#set ($userDoc = $xwiki.getDocument($result.get(0)))
$userDoc.delete()
#set ($extraText = "- Deleted!")
#end
* $result.get(0) - $result.get(1) $!extraText
#end
{{/velocity}}
#foreach($result in $xwiki.search("select distinct doc.fullName, prop.value from XWikiDocument as doc, BaseObject as obj, StringProperty as prop where obj.className='XWiki.XWikiUsers' and obj.name=doc.fullName and prop.id.id=obj.id and prop.name='first_name' and prop.value is not empty and prop.value in (select prop.value from StringProperty as prop2 where prop2.id.id=obj.id and prop2.name='last_name' and prop2.value=prop.value)"))
#if ($request.confirm == "1")
#set ($userDoc = $xwiki.getDocument($result.get(0)))
$userDoc.delete()
#set ($extraText = "- Deleted!")
#end
* $result.get(0) - $result.get(1) $!extraText
#end
{{/velocity}}