Disable Allow Comments
Is there a way to easily disable the allow comments checkbox (leaving it unchecked) so that my contributors will not accidentally leave this checked when they add news or events?
SF 5.0
Hi,
You can control where the AllowComments custom filed appears, so it'll be very easy to hide it from the edit/create item screen - just go to Content -> News/Blogs and click on Custom fields for News (or Blog Posts) located in the lower right part of the screen. Select the Allow Comments field, and in Appearance set it to be hidden (or alternatively to appear only on edit.create). Save the changes and observe the field will no longer be visible for editing.
Regards,
Boyan Barnev
the Telerik team
That didn't work for me - I think because it is checked by default so even though we don't see it, it is being saved checked as yes.
Hi Elizabeth,
We have answered you in the support ticket. Please, continue the communication there. Feel free to share the solution with the community after that.
Regards,
Nikola Zagorchev
Telerik
Could you please post the solution to this? I'm having the same issue. I want the allow comments just to be unchecked by default, but still leave it displayed so that it can be checked if preferred.
Hello
We have answered you in the support ticket. Feel free to share the solution provided there for changing the default value of the AllowComments checkbox.
Regards,
Nikola Zagorchev
Telerik
Hi I would like to see the solution also, I want to leave open the option to comment, but to be un- checked by default.
Hello,
In order to uncheck the checkbox for AllowComments, you need to plug in the DetailsFormView of the module for which you will change the fields loaded. This way you can modify the fields loaded and change their values. In order to uncheck the AllowComments, please use the bellow extension script:
function OnDetailViewLoaded(sender, args)
// the sender here is DetailFormView
var currentForm = sender;
uncheckAllowComments(currentForm.get_fieldControlIds());
;
function uncheckAllowComments(fieldControlsIds)
var allowCommentsCheckBox =
null
;
for
(var i = 0; i < fieldControlsIds.length; i++)
var id = fieldControlsIds[i];
if
(id.indexOf(
'allowComments'
) != -1)
allowCommentsCheckBox = $find(id);
break
;
if
(allowCommentsCheckBox !=
null
)
var handlerDataBound =
this
.createDelegate(allowCommentsCheckBox, uncheckCheckBox);
allowCommentsCheckBox.add_dataBound(handlerDataBound);
else
throw
Error(
"AllowComments checkbox cannot be found!"
);
;
function uncheckCheckBox()
this
.set_value(
false
);
;
// From Microsoft.Ajax - Function.createDelegate
function createDelegate(a, b)
return
function ()
return
b.apply(a, arguments)
;
In order to set the extensions script, go to News -> Controls -> Newsbackend -> NewsBackendInsert -> Scripts -> create new.
Script Location: set the location of the script, for instance ~/NewsDetailsExtensionScript.js
For loading method set OnDetailViewLoaded.
Regards,
Nikola Zagorchev
Telerik
In Sitefinity 5.4 you can disable comments by default for new news items through the advanced settings:
News > Comments Settings > AllowComments = False
I don't know if this applies to earlier versions too.
Hello
You can still do that in newer versions, but it disables the comment globally not per item.
Regards,
Nikola Zagorchev
Telerik