Journal
Maintained by
Cosmin HERMAN, Adrian Sarmas, Ovidiu Morariu, Paul Neag
This module allows a teacher to ask students to reflect on a particular topic. The students can edit and refine their answer over time.
Comments
Comments are no longer open for new posts. Existing comments remain available to read.
For the 2020091100 version, please update the version.php file with the new version, because it has the old version and does not trigger the moodle database upgrade.
$plugin->version = 2020091100;
Thank you!
First of all thanks to the developer of this module for the great work done!
I would like to report a conflict that exists between this module and the GDPR functionality of moodle. If the GDPR functionality is enabled and a user is deleted (after a user request or manually), then the deletion process crashes and it is never completed. The scheduled tasks logs also fill up with every execution of the user_deletion task, failing to complete the process. I had spotted the bug a few months ago when I noticed that the user anonymization/deletion was not being completed.
What I found was that in the classes/privacy/provider.php file, the first two methods do not specify the return type on the method declaration.
A proposed fix, which works in the versions 3.8 and previously, was to add the return value to these two methods, i.e. get_metadata(collection) and get_contexts_for_userid(userid) as follows:
public static function get_metadata(collection $collection) : collection
and
public static function get_contexts_for_userid(int $userid) : contextlist
Below I attach the "corrected" code from the provider.php file
/**
* Returns metadata.
*
* @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
$collection->add_database_table(
'journal_entries',
[
'userid' => 'privacy:metadata:journal_entries:userid',
'modified' => 'privacy:metadata:journal_entries:modified',
'text' => 'privacy:metadata:journal_entries:text',
'rating' => 'privacy:metadata:journal_entries:rating',
'entrycomment' => 'privacy:metadata:journal_entries:entrycomment',
],
'privacy:metadata:journal_entries'
);
return $collection;
}
/**
* Get the list of contexts that contain user information for the specified user.
*
* @param int $userid The user to search.
* @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
*/
public static function get_contexts_for_userid(int $userid) : contextlist {
$sql = "
SELECT DISTINCT ctx.id
FROM {%s} fc
JOIN {modules} m
ON m.name = :journal
JOIN {course_modules} cm
ON cm.instance = fc.journal
AND cm.module = m.id
JOIN {context} ctx
ON ctx.instanceid = cm.id
AND ctx.contextlevel = :modlevel
WHERE fc.userid = :userid";
$params = ['journal' => 'journal', 'modlevel' => CONTEXT_MODULE, 'userid' => $userid];
$contextlist = new contextlist();
$contextlist->add_from_sql(sprintf($sql, 'journal_entries'), $params);
return $contextlist;
}
Added index.php line#114:
$description = file_rewrite_pluginfile_urls($journal->intro, 'pluginfile.php', $context->id, 'mod_journal', 'intro', null);
Before calling format_text(), the content must be processed with file_rewrite_pluginfile_urls()
line 1347 of /lib/weblib.php: call to debugging()
line 114 of /mod/journal/index.php: call to format_text()