Courses 13 Customizations


Put original and revised files under moodle root/CEHD/...

CAS Auth

To increase the reliability of the login process, we are using the UIN rather than the NetID from the CAS payload. To make this happen, the following changes were made to the CAS module.


 Beginning around line 1455
 // CEHD Customization. Changed "user" to "tamuEduPersonUIN"
   if ( sizeof($user_elements = $success_elements[0]->get_elements_by_tagname("user")) == 0) {
 Modified To
   if ( sizeof($user_elements = $success_elements[0]->get_elements_by_tagname("tamuEduPersonUIN")) == 0) {

 Beginning around line 2574
 // CEHD Customization. Changed "user" to "tamuEduPersonUIN"
   if ( sizeof($arr = $tree_response->get_elements_by_tagname("user")) == 0) {
 Modified To
   if ( sizeof($arr = $tree_response->get_elements_by_tagname("tamuEduPersonUIN")) == 0) {


Moodle's CAS plugin presumes the existence of an LDAP server to check against.  The only consequence of this we have found is that it prevents the changing the username of a CAS user (since it assumes the user is in a LDAP DB and hence shouldn't be changed through Moodle).  This hack prevents that check so username changes can be performed.  Note.  There is little reason for the username to change (since we are using the UIN rather than Net ID-- see above -- but it is handy for testing purposes to be able to change the username=uin of a user.

To allow changing the username of a CAS user, comment out the check in auth/ldap/auth.php

function user_update($olduser, $newuser) {
    global $USER;
// CEHD. CAS builds on the LDAP library.  But, there is no reason to disallow username changes for CAS users in our case.
//    if (isset($olduser->username) and isset($newuser->username) and $olduser->username != $newuser->username) {
//        error_log($this->errorlogtag.get_string('renamingnotallowed', 'auth_ldap'));
//        return false;
//    }

Correct Button Display

Apply Patch: (5/29/2012)

  • I am skipping the 3rd part of the patch because it appears the file has changed with the latest upgrade. Index: moodle/mod/lesson/locallib.php --- moodle/mod/lesson/locallib.php Base ( +++ moodle/mod/lesson/locallib.php Locally Modified (Based On @@ -741,8 +741,6 @@ if ($this->_customdata['edit'] === true) { $mform->addElement('hidden', 'edit', 1); $this->add_action_buttons(get_string('cancel'), get_string('savepage', 'lesson')); - } else { - $this->add_action_buttons(get_string('cancel'), get_string('addaquestionpage', 'lesson')); } }

Certificate Module

Awaiting confirmation from Michelle that this resolved the problem.

Edit mod/certificate/lib.php

function certificate_issue($course, $certrecord, $cm) {
    global $USER, $DB, $certificate;

function certificate_issue($course, $certificate, $certrecord, $cm) {
    global $USER, $DB;

  • This patch no longer seems necessary with the latest upgrade of this module

CAS Language Update

Replace the language strings in auth/cas/lang/en/auth_cas.php for accessCAS and accessNOCAS with

  • $string['accesCAS'] = 'Login for Texas A&M Students, Faculty and Staff';
    $string['accesNOCAS'] = 'Login for others';

Add IP Address to Quiz Attemts Report


Changed function base_sql (function begins at approx line 345)

Appended the IP address to the SELECT list

// CEHD Customization to display IP address on quiz attempts report
$fields .= ', log.ip as ipaddress';

Joined the Log table (where the IP address is stored) to the query

// CEHD Customization
$from .= " LEFT JOIN {log} log ON (
                     AND AND module='quiz'
                     AND action='attempt'
                     AND time BETWEEN quiza.timestart-1 AND quiza.timestart+8
// END CEHD Customization

We have seen a pretty large discrepancy between the quiz attempt time and the log time so have had to use a big time cusion.


Altered function add_time_columns (function begins at approx line 217)

Added these lines to display the IP address in the table just prior to the time start/finish columns

$columns[] = 'ipaddress';   // CEHD Customization
$headers[] = "IP Address";  // CEHD Customization