diff --git a/mod/bigbluebuttonbn/classes/instance.php b/mod/bigbluebuttonbn/classes/instance.php
index da1dad53af7..b0069f37c36 100644
--- a/mod/bigbluebuttonbn/classes/instance.php
+++ b/mod/bigbluebuttonbn/classes/instance.php
@@ -797,6 +797,9 @@ EOF;
*/
public function get_welcome_message(): string {
$welcomestring = $this->get_instance_var('welcome');
+ if (!config::get('welcome_editable') || empty($welcomestring)) {
+ $welcomestring = config::get('welcome_default');
+ }
if (empty($welcomestring)) {
$welcomestring = get_string('mod_form_field_welcome_default', 'bigbluebuttonbn');
}
diff --git a/mod/bigbluebuttonbn/classes/local/config.php b/mod/bigbluebuttonbn/classes/local/config.php
index ae4dfba9dfb..f85819ea3b4 100644
--- a/mod/bigbluebuttonbn/classes/local/config.php
+++ b/mod/bigbluebuttonbn/classes/local/config.php
@@ -224,6 +224,7 @@ class config {
'lockonjoinconfigurable_editable' => self::get('lockonjoinconfigurable_editable'),
'lockonjoinconfigurable_default' => self::get('lockonjoinconfigurable_default'),
'welcome_default' => self::get('welcome_default'),
+ 'welcome_editable' => self::get('welcome_editable'),
];
}
diff --git a/mod/bigbluebuttonbn/classes/settings.php b/mod/bigbluebuttonbn/classes/settings.php
index b5f81b22379..1d863f4db7b 100644
--- a/mod/bigbluebuttonbn/classes/settings.php
+++ b/mod/bigbluebuttonbn/classes/settings.php
@@ -193,6 +193,18 @@ class settings {
$item,
$settingsgeneral
);
+ $settingsgeneral->add($item);
+ $item = new admin_setting_configcheckbox(
+ 'bigbluebuttonbn_welcome_editable',
+ get_string('config_welcome_editable', 'bigbluebuttonbn'),
+ get_string('config_welcome_editable_description', 'bigbluebuttonbn'),
+ 1,
+ );
+ $this->add_conditional_element(
+ 'welcome_editable',
+ $item,
+ $settingsgeneral
+ );
}
return $settingsgeneral;
}
diff --git a/mod/bigbluebuttonbn/lang/en/bigbluebuttonbn.php b/mod/bigbluebuttonbn/lang/en/bigbluebuttonbn.php
index 988914de4fc..6fa8a8ca150 100644
--- a/mod/bigbluebuttonbn/lang/en/bigbluebuttonbn.php
+++ b/mod/bigbluebuttonbn/lang/en/bigbluebuttonbn.php
@@ -239,6 +239,8 @@ $string['config_muteonstart_editable'] = 'Mute on start can be edited';
$string['config_muteonstart_editable_description'] = 'Mute on start by default can be edited when the instance is added or updated.';
$string['config_welcome_default'] = 'Default welcome message';
$string['config_welcome_default_description'] = 'Replaces the default message setted up for the BigBlueButton server. The message can includes keywords (%%CONFNAME%%, %%DIALNUM%%, %%CONFNUM%%) which will be substituted automatically, and also html tags like ... or ';
+$string['config_welcome_editable'] = 'Default welcome message is editable by teachers';
+$string['config_welcome_editable_description'] = 'Welcome message can be edited when the instance is added or updated';
$string['config_default_messages'] = 'Default messages';
$string['config_default_messages_description'] = 'Set message defaults for activities';
diff --git a/mod/bigbluebuttonbn/mod_form.php b/mod/bigbluebuttonbn/mod_form.php
index cff94b2be79..4d74bb01b04 100644
--- a/mod/bigbluebuttonbn/mod_form.php
+++ b/mod/bigbluebuttonbn/mod_form.php
@@ -317,10 +317,15 @@ class mod_bigbluebuttonbn_mod_form extends moodleform_mod {
* @return void
*/
private function bigbluebuttonbn_mform_add_block_room_room(MoodleQuickForm &$mform, array $cfg): void {
- $field = ['type' => 'textarea', 'name' => 'welcome', 'data_type' => PARAM_CLEANHTML,
- 'description_key' => 'mod_form_field_welcome'];
- $this->bigbluebuttonbn_mform_add_element($mform, $field['type'], $field['name'], $field['data_type'],
- $field['description_key'], $cfg['welcome_default'], ['wrap' => 'virtual', 'rows' => 5, 'cols' => '60']);
+ $field = ['type' => 'hidden', 'name' => 'welcome', 'data_type' => PARAM_INT,
+ 'description_key' => null];
+ if ($cfg['welcome_editable']) {
+ $field['type'] = 'textarea';
+ $field['data_type'] = PARAM_CLEANHTML;
+ $field['description_key'] = 'mod_form_field_welcome';
+ $this->bigbluebuttonbn_mform_add_element($mform, $field['type'], $field['name'], $field['data_type'],
+ $field['description_key'], $cfg['welcome_default'], ['wrap' => 'virtual', 'rows' => 5, 'cols' => '60']);
+ }
$field = ['type' => 'hidden', 'name' => 'voicebridge', 'data_type' => PARAM_INT,
'description_key' => null];
if ($cfg['voicebridge_editable']) {
diff --git a/mod/bigbluebuttonbn/version.php b/mod/bigbluebuttonbn/version.php
index cde2191b569..56dd5f0d9d4 100644
--- a/mod/bigbluebuttonbn/version.php
+++ b/mod/bigbluebuttonbn/version.php
@@ -27,6 +27,6 @@
defined('MOODLE_INTERNAL') || die;
-$plugin->version = 2021091408;
+$plugin->version = 2022021600;
$plugin->requires = 2020061500;
$plugin->component = 'mod_bigbluebuttonbn';