Overview
You have a site collection that you want to use for sharing information, but don't want to allow post engagement (comments, likes, etc.). You have set your SharePoint site collection to be read-only to prevent users from interacting with the page, however, you noticed that the Newsgator Stream web parts on the page do not have the same restrictions. You want to disable this post engagement functionality.
Information
While Aurea Social does allow you to set your Community to read-only to prevent new posts or questions from non-Admins, this does not prevent users from engaging with the content in the form of Likes or Comments. This functionality is directly built into the Stream Web Parts and SharePoint does not provide a method for marking Web Parts as read-only.
As an alternative, you can request that your DBA explore using SQL Triggers or similar on the backend to prevent inserts into the Tables that store these details for the specific community.
Note: The use or configuration of the Triggers is outside of the Aurea Social Support Team scope and these details are provided as a reference for your Database Admin to investigate further.
It is suggested that you first verify the impact of these triggers within a Test Environment and a full backup be created prior to implementing them.
The following tables and their associated databases contain the relevant Social Engagement content:
- NewsGator_Social.ActivityEvent.
- WSS_Content.AllUserData
Note: The exact name of the Databases and Tables may be different within your environment. Your DBA can verify the appropriate names to be used when building a trigger using the examples below as a reference. See external article Different ways to make a table read-only in a SQL Server database for further details on configuring SQL Triggers.
Sample Trigger Examples
The ActivityEvent table does not have an identifier of the site that is using it or posting from it. Every post that comes from a specific community is stored in the table like this: @[CommunityName]: Text
You can use a trigger similar to this example to prevent inserts for the specific community, adjusting the CommunityName:
CREATE TRIGGER [dbo].[trReadOnly_ActivityEvent] ON [dbo].[ActivityEvent]
AFTER INSERT
AS
BEGIN
DECLARE @check int
SELECT @check = CHARINDEX('[CommunityName]',EntryText) FROM inserted
IF @check <> 0
BEGIN
RAISERROR('Error Message that for this WebPart, SP will ask the user to login endlessly', 16, 1)
ROLLBACK TRANSACTION
END
END
GO
The AllUserData table contains the SiteID identifier directly that can be used within a trigger.
You can use a trigger similar to this example to prevent inserts for the specific community by replacing [SiteID] with your community SiteID:
CREATE TRIGGER [dbo].[trReadOnly_AllUserData] ON [dbo].[AllUserData]
AFTER INSERT
AS
BEGIN
DECLARE @check varchar
SELECT @check = tp_SiteId FROM inserted
IF @check = '[SiteID]'
BEGIN
RAISERROR('Error Message here although SP won't display it', 16, 1)
ROLLBACK TRANSACTION
END
END
GO