amandadoughty / moodle-mod_peerwork

5 stars 8 forks source link

Undefined constant error. #9

Closed mhughes2k closed 2 weeks ago

mhughes2k commented 2 years ago

I'm getting an "Warning: Use of undefined constant FEATURE_MOD_PURPOSE - assumed 'FEATURE_MOD_PURPOSE' (this will throw an Error in a future version of PHP) in /var/www/html/mod/peerwork/lib.php on line 56" error on a Moodle 3.11.7 installation.

This key only appears to be supported in Moodle 4

The mod_zoom plugin appears to be working around this by doing:

function zoom_supports($feature) {
    // Adding support for FEATURE_MOD_PURPOSE (MDL-71457) and providing backward compatibility (pre-v4.0).
    if (defined('FEATURE_MOD_PURPOSE') && $feature === FEATURE_MOD_PURPOSE) {
        return MOD_PURPOSE_COMMUNICATION;
    }

    switch($feature) {
        case FEATURE_BACKUP_MOODLE2:
        case FEATURE_COMPLETION_TRACKS_VIEWS:
        case FEATURE_GRADE_HAS_GRADE:
        case FEATURE_GROUPINGS:
        case FEATURE_GROUPMEMBERSONLY:
        case FEATURE_MOD_INTRO:
        case FEATURE_SHOW_DESCRIPTION:
            return true;
        default:
            return null;
    }
}

so something similar would be good eliminate this warning/error.

amandadoughty commented 2 years ago

Thanks @mhughes2k I'll get back to you at the weekend

amandadoughty commented 2 years ago

Hi @mhughes2k are you using the master branch in a Moodle 3.11.7 installation? The MOODLE_311_STABLE branch is intended for Moodle 3.11. The master branch is in the process of being updated for Moodle 4.0