elearningsoftware / moodle-mod_journal

The Moodle journal module for moodle 2.0+
https://moodle.org/plugins/view.php?plugin=mod_journal
16 stars 34 forks source link

Warning: Use of undefined constant FEATURE_MOD_PURPOSE #76

Closed drachels closed 2 years ago

drachels commented 2 years ago

Your new and latest version is listed as working with Moodle 3.4 thru Moodle 4.0, which technically it does. However, In every version except Moodle 4.0, you get the following warning as seen in my Moodle 3.11: Warning: Use of undefined constant FEATURE_MOD_PURPOSE - assumed 'FEATURE_MOD_PURPOSE' (this will throw an Error in a future version of PHP) in /homepages/41/d181171505/htdocs/moodle311/mod/journal/lib.php on line 130

voegii commented 2 years ago

As a workaround and because other plugins may also do it this way, we temporary defined the FEATURE_MOD_PURPOSE and MODPURPOSE* constants in config.php (Moodle 3.11 and PHP8).

drachels commented 2 years ago

The problem I have with that is that many, "New to Moodle people," as well as me, will not have a clue as to how to do that. How exactly do you add that to the config.php file? Personally, I prefer to just change the function so that it does a branch check and use one switch for anything greater than 311 and another copy of the switch for everything else. The end user doesn't have to know about or do anything.

adrian-sarmas commented 2 years ago

I'll come back with a fix as soon as possible. Thank you!

adrian-sarmas commented 2 years ago

This has been fixed in the latest version of the master branch.

drachels commented 2 years ago

Thanks for the fix. Looks good!