Products

Solutions

Resources

Partners

Community

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

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 
BEGIN
	SELECT  UserID,
			DisplayName,
			''   AS FirstName,
			''   AS PropertyName ,
			''   AS PropertyValue,
			0    AS Visibility,
			Null AS ExtendedVisibility,
			Convert (DateTime, 0) AS ModifiedTime
	FROM    {databaseOwner}[{objectQualifier}Users] 
	WHERE   userId = 0
END

Version for DNN 7.3.2 and above:

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

 (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...

Comments

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

I get ff. error message starting with "System.ArgumentException: Parameter '@PortalId' 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 7, 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
Matt,
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?

tx!
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?

Thanks

Ole J. / Copenhagen
Ole L. Jacobsen Sunday, September 4, 2016 8:20 AM (link)
Sebastian Leupold
Ole,
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 8, 2016 10:09 AM (link)

Comment Form

Only registered users may post comments.

NewsArchives


Aderson Oliveira (22)
Alec Whittington (11)
Alessandra Daniels (3)
Alex Shirley (10)
Andrew Hoefling (3)
Andrew Nurse (30)
Andy Tryba (1)
Anthony Glenwright (5)
Antonio Chagoury (28)
Ash Prasad (37)
Ben Schmidt (1)
Benjamin Hermann (25)
Benoit Sarton (9)
Beth Firebaugh (12)
Bill Walker (36)
Bob Kruger (5)
Bogdan Litescu (1)
Brian Dukes (2)
Brice Snow (1)
Bruce Chapman (20)
Bryan Andrews (1)
cathal connolly (55)
Charles Nurse (163)
Chris Hammond (213)
Chris Paterra (55)
Clint Patterson (108)
Cuong Dang (21)
Daniel Bartholomew (2)
Daniel Mettler (181)
Daniel Valadas (48)
Dave Buckner (2)
David Poindexter (12)
David Rodriguez (3)
Dennis Shiao (1)
Doug Howell (11)
Erik van Ballegoij (30)
Ernst Peter Tamminga (80)
Francisco Perez Andres (17)
Geoff Barlow (12)
George Alatrash (12)
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 (274)
John Mitchell (1)
Jon Henning (14)
Jonathan Sheely (4)
Jordan Coopersmith (1)
Joseph Craig (2)
Kan Ma (1)
Keivan Beigi (3)
Kelly Ford (4)
Ken Grierson (10)
Kevin Schreiner (6)
Leigh Pointer (31)
Lorraine Young (60)
Malik Khan (1)
Matt Rutledge (2)
Matthias Schlomann (16)
Mauricio Márquez (5)
Michael Doxsey (7)
Michael Tobisch (3)
Michael Washington (202)
Miguel Gatmaytan (3)
Mike Horton (19)
Mitchel Sellers (40)
Nathan Rover (3)
Navin V Nagiah (14)
Néstor Sánchez (31)
Nik Kalyani (14)
Oliver Hine (1)
Patricio F. Salinas (1)
Patrick Ryan (1)
Peter Donker (54)
Philip Beadle (135)
Philipp Becker (4)
Richard Dumas (22)
Robert J Collins (5)
Roger Selwyn (8)
Ruben Lopez (1)
Ryan Martinez (1)
Sacha Trauwaen (1)
Salar Golestanian (4)
Sanjay Mehrotra (9)
Scott McCulloch (1)
Scott Schlesier (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)
Steven Fisher (1)
Tony Henrich (3)
Torsten Weggen (3)
Tycho de Waard (4)
Vicenç Masanas (27)
Vincent Nguyen (3)
Vitaly Kozadayev (6)
Will Morgenweck (40)
Will Strohl (180)
William Severance (5)
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out