Learn More





DNN Community Blog

The Community Blog is a personal opinion of community members and by no means the official standpoint of DNN Corp or DNN Platform. This is a place to express personal thoughts about DNNPlatform, the community and its ecosystem. Do you have useful information that you would like to share with the DNN Community in a featured article or blog? If so, please contact .

The use of the Community Blog is covered by our Community Blog Guidelines - please read before commenting or posting.

Exclude Users from Search in DNN 7.2

DNN 7.2.0 introduces a new feature, which includes user data in search (even for upgraded websites), i.e. entering "host" in search will provide you with a link to host user profile in default website.

While this might be a great feature for sites hosting communities, most of the websites of my clients just include a few admin users, who don't want to get exposed their data in website search. Other sites do provide user accounts for newsletter signup and don't want to expose this data via site search (in Germany, site owners may even get fined, if the user didn't consent to his data being published).

The easiest option to exclude all users from is disabling user data from being included in search results via UI:

  • Go to search results page (either in Admin > Pages or by entering a term into the search box
  • Switch to edit mode and enter module settings of search results
  • in tab "Search Results Settings", open drop down list for setting "Results Scope for Content Type(s)"
  • unselect "users"

Unfortunately, this will not stop users from being indexed (by an expensive stored procedure), i.e. their data copied from the database into the search index files. If you want to prevent this, run the following statement from Host > SQL:

ALTER PROCEDURE {databaseOwner}[{objectQualifier}GetAvailableUsersForIndex]
    @PortalId INT ,
    @StartDate DATETIME ,
	@startUserId INT = 0,
    @numberOfUsers INT = 500
			''   AS FirstName,
			''   AS PropertyName ,
			''   AS PropertyValue,
			0    AS Visibility,
			Null AS ExtendedVisibility,
			Convert (DateTime, 0) AS ModifiedTime
	FROM    {databaseOwner}[{objectQualifier}Users] 
	WHERE   userId = 0

Version for DNN 7.3.2 and above:

ALTER PROCEDURE {databaseOwner}[{objectQualifier}GetAvailableUsersForIndex]
    @PortalId INT ,
    @StartDate DATETIME ,
	@startUserId INT = 0,
    @numberOfUsers INT = 500
			Convert (DateTime, 0) AS LastModifiedOnDate,
			''   AS PropertyName,
			''   AS PropertyValue
	FROM    {databaseOwner}[{objectQualifier}Users] 
	WHERE   userId = 0

 (btw: thanks to Vicenç Masanas, for the great overhaul of this module).

If you now re-index your site (in Admin > Search Admin, by pressing "Re-Index Content", all user data will be excluded from the index.

PS: I am well aware that NSA might not appreciate this hint...


Greg Greensky
Isn't there something wrong with this script, Sebastian?

I get ff. error message starting with "System.ArgumentException: Parameter [email protected]' specified but none of the passed arguments have a property with this name (in 'ALTER PROCEDURE dbo.[dnn_GetAvailableUsersForIndex1]" .
Greg Greensky Tuesday, December 17, 2013 10:17 PM (link)
Sebastian Leupold
sorry, I forgot to remove the trailing "1" from name (I used for testing).
Sebastian Leupold Wednesday, December 18, 2013 11:39 AM (link)
Sebastian Leupold
I added a version of the script for upcoming DNN 7.3.2, you will need to re-run the script after the platform upgrade to DNN 7.3.2 or above, if you already applied it to a previous version.
Sebastian Leupold Thursday, August 07, 2014 4:40 AM (link)
Sherry Cui
Sebastian, I followed your article, and it worked perfectly on my dev machine. But when I repeated the same step on staging machine, it did not work. User profile is still picked up. I am not seeing any error anywhere. My dev and staging have the identical version and setup on everything. What is the best way of trouble shooting this? Appreciate your help!
Sherry Cui Thursday, December 11, 2014 1:00 PM (link)
Sebastian Leupold
did you clear the search index (content of folder /app_data/search) and re-index?
If there are still users indexed, you might need to re-run the SQL from above, this
applies to all recent upgrades, DNN 7.4.0 or 7.4.1 will finally introduce a setting
in Admin > Search Administration, to turn off user indexing.
Sebastian Leupold Friday, December 12, 2014 6:27 AM (link)
Sherry Cui
Sebastian, Clear the search index folder content and re-index DID help to resolve the problem. Thank you so much, you are the BEST!
Sherry Cui Monday, December 15, 2014 10:25 AM (link)
Sebastian Leupold
Sebastian Leupold Monday, December 15, 2014 3:41 PM (link)
Rutger Buijzen
Is there a similar "fix" for 7.4.0? (GetAvailableUsersForIndex seems to be a totally different pivot query?)
Apparently the setting is not included yet in 7.4.1?

Rutger Buijzen Thursday, June 18, 2015 4:11 AM (link)
Ole L. Jacobsen
Will the Version for DNN 7.3.2 Alter Stored Procedure work in version 8xx?


Ole J. / Copenhagen
Ole L. Jacobsen Sunday, September 04, 2016 8:20 AM (link)
Sebastian Leupold
the version for DNN 7.3.2 and above should still fit for DNN versions 7.4.x and 8.0.x
Sebastian Leupold Thursday, September 08, 2016 10:09 AM (link)

Comment Form

Only registered users may post comments.


2sic Daniel Mettler (124)
Aderson Oliveira (15)
Alec Whittington (11)
Alex Shirley (10)
Andrew Nurse (30)
Anthony Glenwright (5)
Antonio Chagoury (28)
Ash Prasad (21)
Ben Schmidt (1)
Benjamin Hermann (25)
Benoit Sarton (9)
Beth Firebaugh (12)
Bill Walker (36)
Bob Kruger (5)
Brian Dukes (2)
Brice Snow (1)
Bruce Chapman (20)
Bryan Andrews (1)
cathal connolly (55)
Charles Nurse (163)
Chris Hammond (203)
Chris Paterra (55)
Clinton Patterson (28)
Cuong Dang (21)
Daniel Bartholomew (2)
Dave Buckner (2)
David Poindexter (3)
David Rodriguez (2)
Doug Howell (11)
Erik van Ballegoij (30)
Ernst Peter Tamminga (74)
Geoff Barlow (6)
Gifford Watkins (3)
Gilles Le Pigocher (3)
Ian Robinson (7)
Israel Martinez (17)
Jan Blomquist (2)
Jan Jonas (3)
Jaspreet Bhatia (1)
Jenni Merrifield (6)
Joe Brinkman (269)
John Mitchell (1)
Jon Henning (14)
Jonathan Sheely (4)
Jordan Coopersmith (1)
Joseph Craig (2)
Kan Ma (1)
Keivan Beigi (3)
Ken Grierson (10)
Kevin Schreiner (6)
Leigh Pointer (31)
Lorraine Young (60)
Malik Khan (1)
Matthias Schlomann (15)
Mauricio Márquez (5)
Michael Doxsey (7)
Michael Tobisch (3)
Michael Washington (202)
Mike Horton (19)
Mitchel Sellers (28)
Nathan Rover (3)
Navin V Nagiah (14)
Néstor Sánchez (31)
Nik Kalyani (14)
Peter Donker (52)
Philip Beadle (135)
Philipp Becker (4)
Richard Dumas (22)
Robert J Collins (5)
Roger Selwyn (8)
Ruben Lopez (1)
Ryan Martinez (1)
Salar Golestanian (4)
Sanjay Mehrotra (9)
Scott McCulloch (1)
Scott S (11)
Scott Wilkinson (3)
Scott Willhite (97)
Sebastian Leupold (80)
Shaun Walker (237)
Shawn Mehaffie (17)
Stefan Cullmann (12)
Stefan Kamphuis (12)
Steve Fabian (31)
Timo Breumelhof (24)
Tony Henrich (3)
Torsten Weggen (2)
Vicenç Masanas (27)
Vincent Nguyen (3)
Vitaly Kozadayev (6)
Will Morgenweck (37)
Will Strohl (163)
William Severance (5)
Try Evoq
For Free
Start Free Trial
a Demo
See Evoq Live
Need More Information?