Skip to content

Commit

Permalink
Fix the way of specifying the default value of the preference
Browse files Browse the repository at this point in the history
  • Loading branch information
mudrd8mz committed Mar 6, 2024
1 parent f755d27 commit c5859ab
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static function _get_metadata(collection $collection) {
*/
public static function _export_user_preferences($userid) {

$raw = (array) json_decode(get_user_preferences('editor_marklar/formats', null, $userid) ?? '');
$raw = (array) json_decode(get_user_preferences('editor_marklar/formats', '', $userid));

if (is_array($raw)) {
foreach ($raw as $format => $enabled) {
Expand Down
2 changes: 1 addition & 1 deletion lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function get_supported_formats() {
$supported = [FORMAT_MARKDOWN => FORMAT_MARKDOWN];

// Other formats can be supported via user preferences.
$formats = json_decode(get_user_preferences('editor_marklar/formats') ?? '');
$formats = json_decode(get_user_preferences('editor_marklar/formats', ''));

if (is_object($formats)) {
if (!empty($formats->{'format'.FORMAT_MOODLE})) {
Expand Down
2 changes: 1 addition & 1 deletion preferences.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
'monospace' => get_user_preferences('editor_marklar/monospace', false, $user),
];

$formats = json_decode(get_user_preferences('editor_marklar/formats', null, $user) ?? '');
$formats = json_decode(get_user_preferences('editor_marklar/formats', '', $user));
if (is_object($formats)) {
$data = array_merge($data, (array)$formats);
}
Expand Down

0 comments on commit c5859ab

Please sign in to comment.