Commit cd45366d authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Add site setting to allow anonymous comments


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent f55c218e
......@@ -263,6 +263,12 @@ $siteoptionform = array(
'description' => get_string('userscanhiderealnamesdescription', 'admin'),
'defaultvalue' => get_config('userscanhiderealnames'),
),
'anonymouscomments' => array(
'type' => 'checkbox',
'title' => get_string('anonymouscomments', 'admin'),
'description' => get_string('anonymouscommentsdescription', 'admin'),
'defaultvalue' => get_config('anonymouscomments'),
),
)
);
......@@ -288,7 +294,7 @@ function siteoptions_submit(Pieform $form, $values) {
'registration_sendweeklyupdates', 'institutionexpirynotification', 'institutionautosuspend',
'captchaonregisterform', 'captchaoncontactform', 'showselfsearchsideblock', 'showtagssideblock',
'tagssideblockmaxtags', 'country', 'viewmicroheaders', 'userscanchooseviewthemes',
'remoteavatars', 'userscanhiderealnames'
'remoteavatars', 'userscanhiderealnames', 'anonymouscomments',
);
$oldlanguage = get_config('lang');
$oldtheme = get_config('theme');
......
......@@ -148,6 +148,8 @@ $string['allowpublicviews'] = 'Allow public views';
$string['allowpublicviewsdescription'] = 'If set to yes, users will be able to create portfolio Views that are accessable to the public rather than only to logged in users';
$string['allowpublicprofiles'] = 'Allow public profiles';
$string['allowpublicprofilesdescription'] = 'If set to yes, users will be able to set their profile Views to be accessable to the public rather than only to logged in users';
$string['anonymouscomments'] = 'Anonymous Comments';
$string['anonymouscommentsdescription'] = 'If checked, logged-out users can leave comments on public Views or Views they can access by secret URL.';
$string['captchaonregisterform'] = 'Captcha required for registration';
$string['captchaonregisterformdescription'] = 'Require users to type letters from a captcha image when submitting the registration form';
$string['captchaoncontactform'] = 'Captcha required for contact us';
......
......@@ -1487,6 +1487,9 @@ function xmldb_core_upgrade($oldversion=0) {
SET plugintype = 'artefact', pluginname = 'comment'
WHERE name = 'feedback'
");
// Add site setting for anonymous comments
set_config('anonymouscomments', 1);
}
return $status;
......
......@@ -678,6 +678,7 @@ function core_install_firstcoredata_defaults() {
set_config('usersallowedmultipleinstitutions', 1);
set_config('viewmicroheaders', 1);
set_config('userscanchooseviewthemes', 1);
set_config('anonymouscomments', 1);
// install the applications
$app = new StdClass;
......
......@@ -136,9 +136,7 @@ function releaseview_submit() {
// If the view has comments turned off, tutors can still leave
// comments if the view is submitted to their group.
// @todo: site setting for public comments
if ($view->get('allowcomments') || !empty($releaseform)) {
if (($USER->is_logged_in() || get_config('anonymouscomments')) && ($view->get('allowcomments') || !empty($releaseform))) {
$defaultprivate = !empty($releaseform);
$addfeedbackform = pieform(ArtefactTypeComment::add_comment_form($defaultprivate));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment