cogRemove users who are considered spam accounts
Developed by

Vincent Massol

Rating
Rate!
0 Votes
LicenseGNU Lesser General Public License 2.1

Description

Requires Programming Rights to execute

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}}
Going to delete $xwiki.countDocuments(", BaseObject as obj, StringProperty as fname, StringProperty as lname where obj.className='XWiki.XWikiUsers' and obj.name=doc.fullName and fname.id.id=obj.id and fname.name='first_name' and lname.id.id=obj.id and lname.name='last_name' and fname.value = lname.value and fname.value = doc.name") users#if ($xcontext.action != 'get'):

#foreach($result in $xwiki.search("select distinct doc.fullName, fname.value from XWikiDocument as doc, BaseObject as obj, StringProperty as fname, StringProperty as lname where obj.className='XWiki.XWikiUsers' and obj.name=doc.fullName and fname.id.id=obj.id and fname.name='first_name' and lname.id.id=obj.id and lname.name='last_name' and fname.value = lname.value and fname.value = doc.name"))
  #if ($request.confirm == "1")
    #set ($userDoc = $xwiki.getDocument($result.get(0)))
    $xwiki.getXWiki().deleteDocument($userDoc.getDocument(), false, $xcontext.context)
    #set ($extraText = "- Deleted!")
  #end
  * $result.get(0) - $result.get(1) $!extraText
#end
#end
{{/velocity}}

Prerequisites & Installation Instructions

Copy the code snippet to a page and save it.

Created by Vincent Massol on 2010/12/07 16:18
     

Get Connected