Moodle (LMS)
- 1 About Moodle API
- 2 Moodle Configuration
- 3 Moodle Users
- 3.1 Individually create user or tie existing user to Campus Café ID
- 3.2 Mass import users from Campus Café
- 3.3 Automatically create Moodle user accounts based on Campus Cafe
- 3.4 Set Campus Cafe to automatically create student accounts in Moodle
- 3.5 Set Campus Cafe to automatically create instructor accounts in Moodle
- 4 Moodle Courses
- 5 Enable Moodle Web Services
- 6 Activate Moodle Web Service Protocols
- 7 Create Moodle Role
- 8 Create Moodle Service User
- 8.1 Create user
- 8.2 Assign user role
- 9 Create Moodle Web Service
- 10 Create Moodle Token
- 11 Campus Café Web App Config
- 12 Configure Course End-Times and Nickname/Preferred Name Settings
- 13 Configure Create Courses Setting
- 14 Define Course Categories in Campus Cafe
- 15 Campus Cafe Custom Control Configuration
- 16 Manual Sync
- 17 Review Queue Log
- 17.1 Moodle Queue tab
- 18 Automatic Sync
- 18.1 Upon Sync Error
- 19 Queue History Log
- 19.1 Access the log
- 20 Import Final Course Grades
- 20.1 Final Grade Sync Tab
- 20.1.1 Run a Report
- 20.1.2 Run the Import
- 20.1 Final Grade Sync Tab
About Moodle API
The Campus Café to Moodle API will enroll and drop students when their enrollment changes in Campus Café. The API can optionally be configured to create users (students and instructors) and courses in Moodle upon their creation in Campus Cafe. The API also supports importing final course grades from Moodle to Campus Cafe. The API does not transfer attendance or assignment grades between systems.
These instructions are written based on Moodle Version 3.9.4. The integration will work with later versions, but the navigation instructions for Moodle may have changes.
Moodle Configuration
Follow the instructions outlined in the sections below to complete the configuration setup in Moodle.
Moodle Users
Users in Moodle include instructors and students. These users only need to be established once in Moodle and are connected to Campus Café by their Campus Café ID number. Regardless of how users are created in Moodle, each user must be associated with his or her Campus Café ID number. In the Moodle interface, the ID is added and edited on the user screen.
Students and instructors must have a user account (username and password) in Campus Cafe for enrollments to be added in Moodle.
Individually create user or tie existing user to Campus Café ID
Log in to Moodle
Navigate to Site administration > Users > Add a new user
(To edit an existing user, find the user and click the gear for settings.)Complete the general fields according to your business processes
Click the Optional section to show additional fields
In the ID number box enter the Campus Café ID number
Click Create user or Update profile
Mass import users from Campus Café
Campus Café provides a pre-defined report for a user upload. The report Moodle Student ID Number Listing is available in Base Reports under the Administrator Reports folder. Export the file as a .CSV file.
Log in to Moodle
Navigate to Site administration > Users
Click Upload users
Click Choose your file
For the CSV delimiter choose the comma
For the Encoding choose UTF-8
Click Upload Users
Configure your upload settings
Pay special attention to the settings related to creating versus updating users. To have the ID merge into existing Moodle Users, set the upload type to “Add new and update existing users” or “Update existing users only”. In the existing user details choose “Override with file” or “Override with file and defaults”.Click Upload users
Automatically create Moodle user accounts based on Campus Cafe
Campus Cafe will automatically create a user in Moodle if a student is enrolled in a class in Campus Cafe and he or she does not already exist in Moodle. (The process looks for a Moodle user with the Campus Cafe ID number in the ID number field.) Campus Cafe will also automatically create a user in Moodle if an instructor is added to a course in Campus Cafe and he or she does not already exist in Moodle. (The process looks for a Moodle user with the Campus Cafe ID number in the ID number field.)
When a user is created, his or her Moodle username and password will be the same as the Campus Cafe username and password. Unless SSO is implemented changing a password in one system will not change it in the other.
Prior to turning on auto user creation ensure that all existing Moodle users have Campus Cafe IDs assigned to them to avoid duplicate account creation.
Set Campus Cafe to automatically create student accounts in Moodle
A student account will be created when the student is enrolled in a class and the system finds no corresponding user in Moodle.
Navigate to Admin > Custom Control
Locate ProgramId Moodle, Sequence 1, Parameter 5
Click the pencil next to Moodle, Sequence 1, Parameter 5
In Parameter Value 5 box enter Y
Click Save and Back
Locate ProgramId Moodle, Sequence 2, Parameter 1
Click the pencil next to Moodle, Sequence 2, Parameter 1
In Parameter Value 1 box enter the Moodle student role name (case sensitive)
Click Save and Back
Set Campus Cafe to automatically create instructor accounts in Moodle
This process will create a user account for an instructor assigned to a course if the system finds no corresponding user in Moodle. If the instructor is later removed from the course, the instructor will remain in the Moodle course.
Navigate to Admin > Custom Control
Locate ProgramId Moodle, Sequence 2, Parameter 2
Click the pencil next to Moodle, Sequence 2, Parameter 2
In Parameter Value 2 box enter the Moodle role name (case sensitive) for the instructor listed in the Instructor 1 box of the Campus Cafe course
Valid teacher roles: TEACHER, NON_EDITING_TEACHER
TEACHER is the default role if no valid role supplied
In Parameter Value 3 box enter the Moodle role name (case sensitive) for the instructor listed in the Instructor 2 box of the Campus Cafe course
Valid teacher roles: TEACHER, NON_EDITING_TEACHER
NON_EDITING_TEACHER is the default role if no valid role supplied
Click Save
Moodle Courses
Each unique course requires a Course ID number to be associated with Campus Café. The Course ID number for a course in Moodle is constructed from the Term, Course Number, and Course Section with a tilde between each field. (Term~CourseNumber~CourseSection) For example, the course CIS 123, Section 1 offered in the term 202010 would be “202010~CIS123~1”.
Individually create course or tie existing course to Campus Café ID
Log in to Moodle
Navigate to Site Administration > Courses
Click Add a New Course
(To update an existing course, navigate to the course, click the gear and then click Edit Settings)Complete the general fields in agreement with your business processes
In the Course ID number, enter the unique number to tie the course to Campus Café. For example, 202010~CIS123~1
Click Save
Enable Moodle Web Services
Moodle must have Web Services enabled to make the connection to Campus Café.
Log in to Moodle
Navigate to Site administration > Advanced features
Next to Enable web services check the box
Click Save Changes
Activate Moodle Web Service Protocols
Log in to Moodle
Navigate to Site administration > Plugins > Web services > Manage protocols
Ensure the REST protocol is enabled by looking at the eye icon (a slash means it is disabled, click the icon to enable) To enable, click the eye.
Click Save changes
Create Moodle Role
This role in Moodle will tie to the Moodle user that will serve as the bridge between Moodle and Campus Café.
Note: Moodle allows the creation of a role based on an XML template attached to this document. Create the role by navigating to Site administration > Users > Permissions > Define Roles > Add a new role. Set role or archetype as manager and upload the file. Review and then click Create this Role.
Assign Role Permissions
Log in to Moodle
Navigate to Site Administration > Users > Category: Permissions
Click Define Roles
Click Add a new Role
Leave the defaults blank
Click Continue
Give the role a short name (e.g. Campus Café)
Give the role a Custom full name (e.g. Campus Café)
Role archetype: Manager
Context types where this role may be assigned: Check System and User
Allow role assignments: Select Teacher, Non-editing teacher and student
(Note this may need to be adjusted depending on your specific roles assigned to instructors and students)In the Capability chart, check Allow for the following:
Configure custom fields moodle/course:configurecustomfields
View participants moodle/site:viewparticipants
Create users moodle/user:create
Update user profiles moodle/user:update
Create a web service token moodle/webservice:createtoken
View user full information moodle/user:viewalldetails
Manage categories moodle/category:manage
View list of courses you are not enrolled in moodle/category:viewcourselist
See hidden categories moodle/category:viewhiddencategories
Create courses moodle/course:create
Enroll users enrol/manual:enrol
Unenroll users from the course enrol/manual:unenrol
View the grader report gradereport/grader:view
View the grade history gradereport/history:view
View the outcomes report gradereport/outcomes:view
View the overview report gradereport/overview:view
View report gradereport/singleview:view
View your own grade report gradereport/user:view
Change course category moodle/course:changecategory
Change course full name moodle/course:changefullname
Change course ID number moodle/course:changeidnumber
Change course short name moodle/course:changeshortname
Change course summary moodle/course:changesummary
Delete courses moodle/course:delete
Control section visibility moodle/course:sectionvisibility
Update course settings moodle/course:update
Enable/disable email address moodle/course:useremail
View courses without participation moodle/course:view
View hidden courses moodle/course:viewhiddencourses
View hidden sections moodle/course:viewhiddensections
View hidden user fields moodle/course:viewhiddenuserfields
View participants moodle/course:viewparticipants
View scales moodle/course:viewscales
View suspended users moodle/course:viewsuspendedusers
Hide/show courses moodle/course:visibility
View grades of other users moodle/grade:viewall
Assign roles to users moodle/role:assign
View user profiles moodle/user:viewdetails
View hidden details of users moodle/user:viewhiddendetails
Use REST protocol webservice/rest:use
Access all groups moodle/site:accessallgroups
14. Click Save
Allow Role Assignments in Moodle
Navigate to Site administration > Users > Permissions
Click Define Roles
Click the Role created earlier
Click Allow role assignments
Look for the row corresponding to the role you created
Check the boxes to allow the role to have access to the teacher, non-editing teacher and student roles (or your equivalent)
Click Save changes
Create Moodle Service User
A user in Moodle must be created as part of the connection between Campus Café and Moodle. Campus Café recommends creating a generic user for this purpose (e.g. Campus Café). Although the user does not need administrative access, it requires specific permissions.
Create user
Log in to Moodle
Navigate to Site Administration > Users
Click Category: Accounts
Click Add a new user
Complete at least username, authentication method, password, first name, last name and email
Click Create User
Assign user role
Navigate to Site administration > Users > Permissions
Click Assign System Roles
Click the role you created earlier
Add the user you created earlier to the role
Remove Manager Archetype
The role initially requires the manager archetype to assign the permissions. To take an extra step to ensure security, remove this archetype once the role is created and user assigned.
Navigate to Site Administration > Users
Click Category: Permissions
Click Define Roles
Click the Role you created
Click Edit
In Role archetype, select none
Click Save changes
Create Moodle Web Service
This allows the function calls to cross the web and make a connection to Campus Café.
Log in to Moodle
Navigate to Site administration > Server
Under Services click External services
Click Add
Give the service a name (e.g. Campus Café)
Give the service a short name
Check Enabled
Check Authorized users only
Click Add service
Back on the web services page, click Functions next to the service just created
Click Add Functions
Add the following functions:
auth_email_signup_user
core_auth_confirm_user
core_course_check_updates
core_course_create_categories
core_course_create_courses
core_course_delete_courses
core_course_edit_module
core_course_edit_section
core_course_get_categories
core_course_get_courses
core_course_get_courses_by_field
core_course_update_categories
core_course_update_courses
core_enrol_edit_user_enrolment – Moodle versions previous to 3.8
core_enrol_submit_user_enrolment_form – Moodle versions 3.8
core_enrol_get_enrolled_users
core_enrol_get_users_courses
core_enrol_unenrol_user_enrolment
core_role_assign_roles
core_role_unassign_roles
core_user_create_users
core_user_get_users
core_user_get_users_by_field
core_webservice_get_site_info
enrol_manual_enrol_users
enrol_manual_unenrol_users
gradereport_overview_get_course_grades
gradereport_overview_view_grade_report
gradereport_user_get_grade_items
gradereport_user_get_grades_table
Click Add Functions
Back on the web services page, click Authorized users next to the service just created
Add the user created to make the connection to Campus Cafe
Create Moodle Token
Log in to Moodle
Navigate to Site administration > Server > Web Services
Under Manage Tokens click Create Token
In the User box, select the user created earlier
In the Service box, select the service created earlier
Leave IP restriction blank
Check Enable
Set the date the token will expire. (The Moodle-Campus Café connection will stop working on this date)
Click Save Changes
Copy the token for future use
Campus Café Web App Config
Log in to Campus Café
Navigate to Admin > Web App
Update the following Parameters
MOODLE_API_NAME - enter CC_MDL
MOODLE_AUTO_QUEUE_ITEMS - If set to Y, the system will queue course sections and enrollments created prior to the number of days specified in later configuration items
MOODLE_BASE_URL – Unique path to your Moodle installation webservice root. Typically https://<your-Moodle-URL>/webservice/rest/server.php
MOODLE_COURSE_DAYS_ACTIVE_BEF_BEGIN - Enter a number representing days. Individual course sections will be created in Moodle only if created in Campus Cafe this many days or fewer prior to the course section start date unless MOODLE_AUTO_QUEUE_ITEMS is set to Y in which case they will be held for creation until the time arrives.
MOODLE_COURSE_TITLE_FORMAT - controls the name of the course section created in Moodle. Variables supported are @SEMESTER@, @COURSE_NUMBER@, @COURSE_SECTION@, @COURSE_TITLE@ and @SEMESTER_DESCRIPTION@. For example, for the Fall 2021 class (Intro to Math, MTH101, Section 4 setting this value to @COURSE_NUMBER@ - @COURSE_SECTION@: @COURSE_TITLE@ in @SEMESTER_DESCRIPTION@ would create the section in Moodle called "MTH101 - 4: Intro to Math in Fall 2021"
MOODLE_CUTOVER_SEMESTER - the Campus Cafe semester numerical code (e.g. 202210) of the first semester to sync between Campus Cafe and Moodle
MOODLE_EMAIL – Optionally enter an email address to receive emails when an enrollment fails
MOODLE_ENROLLMENT_DAYS_ACTIVE_AFT_END - Enrollments will stop syncing after the course end date if this is set to 0. Set a higher number for enrollments to stop syncing after the course end date. For example, set 5, enrollments would stop syncing file days after the course end date.
MOODLE_ENROLLMENT_DAYS_ACTIVE_BEF_BEGIN - Enrollments will sync for registrations starting the entered number of days prior to the course start date. Registrations that occur prior to this date will not be processed in Moodle unless MOODLE_AUTO_QUEUE_ITEMS is set to Y in which case they will be held for creation until the time arrives.
MOODLE_PASSWORD - For legacy Moodle only. Leave empty for Moodle 3.2+ versions.
MOODLE_REMOVE_DOMAIN_FROM_USERNAME - To remove @domain from Campus Cafe username for Moodle username value.
MOODLE_REMOVE_FROM_QUEUE_DAYS - How long to keep a technical log of sync actions. Campus Cafe recommends "30"
MOODLE_TIMEZONE - Enter the timezone. US/Eastern; US/Central; US/Mountain or US/Pacific Case sensitive
MOODLE_TOKEN – The Moodle token generated in Moodle
MOODLE_TURN_OFF_INTEGRATION_WITH_CC - enter ON to turn on the connection; OFF to turn it off
MOODLE_USERNAME - For legacy Moodle only. Leave empty for Moodle 3.2+ versions.
MOODLE_VERSION – 3.2 (set as 3.2 for any version 3.2 and higher)
GRADE_SYNC_EMAIL_ADDRESS - The email address that will receive the final course grade import exceptions report
Refresh the cache by navigating to Admin > Refresh Data Cache
Configure Course End-Times and Nickname/Preferred Name Settings
The connection allows for the adjustment of course end-times. Default is set to 0:00 z time; however, this may be adjusted from 0 to 2359 to account based on when you want the courses to end in Brightspace. Additionally, the integration may now be configured to bring in the Campus Cafe Nickname as the Preferred Name in Moodle. If set to Y and no Nickname exists in Campus Cafe, the First Name will be sent as the Preferred Name.
Configuring Course End-Times
Log in to Campus Cafe
Navigate to Admin > System Setup > Custom Control
Locate ProgramID MOODLE
Click the pencil icon next to Moodle Seq 2 Parm 9
Update the course end-times (HHMM) to a value from 0 to 2359 (Default is 0)
Configuring Nickname Preferences
Log in to Campus Cafe
Navigate to Admin > System Setup > Custom Control
Locate ProgramID MOODLE
Click the pencil icon next to Moodle Seq 2 Parm 10
Enter Y to send Nickname as Preferred Name
Enter N to ignore Nickname field in Campus Cafe and only send First Name as preferred name (Default is 0)
Configure Create Courses Setting
Automatically create courses in Moodle when scheduled in Campus Cafe
This setting will cause a Moodle course to be created upon the course being scheduled in Campus Cafe. Caution should be exercised if using this setting because once a course is created in Moodle it may be visible to Moodle users. In addition, a course will not be removed from Moodle if the course is later deleted in Campus Cafe.
Navigate to Admin > Custom Control
Locate ProgramId Moodle, Sequence 1, Parameter 7
Click the pencil next to Moodle, Sequence 1, Parameter 7
In Parameter Value 7 box enter Y
Click Save
Automatically create courses in Moodle when student registers for first time
This setting will cause a Moodle course to be created upon registration of the first student in the course in Campus Cafe. Caution should be exercised if using this setting because once a course is created in Moodle it may be visible to Moodle users. In addition, a course will not be removed from Moodle if the course is later deleted in Campus Cafe.
Navigate to Admin > Custom Control
Locate ProgramId Moodle, Sequence 1, Parameter 6
Click the pencil next to Moodle, Sequence 1, Parameter 6
In Parameter Value 6 box enter Y
Click Save
Define Course Categories in Campus Cafe
Course Categories
Moodle groups courses into categories. The connector will add courses to the default Moodle category unless otherwise specified.
To set a default Moodle Category in Campus Cafe
Navigate to Admin > Custom Control Maintenance
Locate ProgramId Moodle, Sequence 2, Parameter 4
Click the pencil next to Moodle, Sequence 2, Parameter 4
In Parameter Value 4 box enter the Moodle value of field 'Category ID number' of your chosen Moodle category.
Click Save and Back
To set the Campus Cafe Course 6 digit semester code to be your default Moodle Category
Navigate to Admin > Custom Control Maintenance
Locate ProgramId Moodle, Sequence 2, Parameter 4
Click the pencil next to Moodle, Sequence 2, Parameter 4
In Parameter Value 4 box enter the value @SEMESTER@
Click Save and Back
Define Categories in Campus Cafe
Moodle categories must be created in Campus Cafe. If the category does not exist in Moodle, it will be created.
Navigate to Admin > STPARMs
In the Parameter Code box enter LMSCAT
In the Parameter Value box enter the Moodle category
Click Add
In Description enter text to illustrate the category
In Long Description enter text to further illustrate the category
Click Save
Refresh the cache by navigating to Admin > Refresh Data Cache
Attach Category to Course
Navigate to Filters > Courses
Complete the filters to return the desired course
Next to the course click the magnifying glass
Click the Codes tab
In the LMS Category drop down choose the category
Click Save
Campus Cafe Custom Control Configuration
This essentially turns on the connection although enrollments will not transfer automatically until Campus Cafe Support schedules the process to run. Enrollments may be pushed manually to Canvas by using the LMS Managment screen. Refer to Manual Sync below.
Navigate to Admin > Custom Control
Locate ProgramId Moodle
Next to ProgramId Moodle, Sequence Number 1, Parameter 1 click the pencil
In Parameter Value 1 enter YYY
Click Save
Refresh the cache by navigating to Admin > Refresh Data Cache
Manual Sync
Enrollments and course creations made in Campus Cafe will be queued to send to Moodle. To send these changes to Moodle for processing, launch the manual sync.
Moodle Management tab
View number of pending changes
Navigate to Registrar > LMS Management
The number next to Unprocessed Queue Entries Count indicates the number of changes waiting to sync. This may represent changes to an individual's name, enrollments, course creations, etc.
Queue enrollments and send to Moodle
You can direct Campus Cafe to send all enrollments for an entire semester or specific course or specific section to Moodle regardless of when the students registered.
Navigate to Registrar > LMS Management
In the Semester Box select the Campus Cafe semester code (e.g. 202110) from the dropdown
Optional: To limit the enrollments to all sections of a course, in the Course box enter the full course number (e.g. MTH100)
Optional: To limit the enrollments to a single section of a course, in the Section box enter the section number (e.g. 14)
Click Enqueue Enrollments
Queue courses to be created in Moodle
You can direct Campus Cafe to create all courses for an entire semester or specific course or specific section.
Navigate to Registrar > LMS Management
In the Semester Box select the Campus Cafe semester code (e.g. 202110) from the dropdown
Optional: To limit course creations to all sections of a course, in the Course box enter the full course code (e.g. MTH100)
Optional: To limit course creations to a single section of a course, in the Section box enter the section number (e.g. 14)
Click Enqueue Courses
Process pending changes
This queue represents all changes (enrollments, changes to names, etc.) made in Campus Cafe that are waiting to be sent to Moodle.
Navigate to Registrar > LMS Management
The number next to Unprocessed Entries count indicates the number of changes waiting to sync
Enter the number of entries you wish to process in the box next the Unprocessed Entries
Click Manually Run
Review Queue Log
As items are added to and processed from the LMS queue, they will appear in the LMS queue tab. All changes made to records in Campus Cafe will be added to the queue, but only relevant enrollments, course and user changes will update in the LMS.
Moodle Queue tab
Select the Moodle Queue tab to view all items on the queue.
Unprocessed items will not have a processed time.
Processed items will have a processed time and a message regarding the actions taken in the LMS. If the message is blank, the change did not impact the LMS, and no changes were made in LMS.
Results can be limited to a specific ID Number, Semester, Course/Section if looking for a specific item on the queue. Additionally, a search box is available for searching specific key words.
Reviewing Errors
Results may also be limited to messages containing errors only. To narrow the search results to show only those with error messages, check the Errors Only checkbox and click Search.
Automatic Sync
After testing the connection, contact Campus Cafe support to request an automatic connection be activated if desired. Changes made in Campus Cafe will typically update in Moodle within an hour.
Upon Sync Error
If a change cannot be made in Moodle, the system will send an email to the email address listed in the Web App Config MOODLE_EMAIL. The email will only be sent for changes that fail. Other transactions in the queue that did not encounter issues will still process. Put another way, a single failure will not prevent other changes from processing.
Queue History Log
The queue history log shows the results of synchronization attempts between Campus Cafe and the LMS. For example, if a student's enrollment is not initiated in the LMS, the history log will show why.
Access the log
Log in to Campus Cafe
Navigate to Registrar > LMS Management
Click Queue History Log
Import Final Course Grades
The API determines the final course grade in Moodle by looking for the grade within a course that has no weighting.
The system will overwrite existing final grades in Campus Cafe if Custom Control Moodle, Sequence 2, Parameter 6 is set to Y.
A report will be emailed to the email address configured in Web App Config GRADE_SYNC_EMAIL_ADDRESS.
Final Grade Sync Tab
Run a Report
Checking this will prevent the import of grades into Campus Cafe. Instead, the system will email a report showing grades that cannot be imported into Campus Cafe. The report is emailed to the email address configured in Web App Config GRADE_SYNC_EMAIL_ADDRESS.
Navigate to Registrar > LMS Management
Select the Final Grade Sync tab
Select the Semester to Synchronize from the drop-down menu
Optional: Enter a specific course or course section, if not importing grades for the entire semester
Check Report Only
Click Synchronize
The Process Output Message will update to indicate the process has began
Optional: Click Refresh Job Output to see updated report results in the Process Output Message box
Run the Import
Navigate to Registrar > LMS Management
Select the Final Grade Sync tab
Select the Semester to Synchronize from the drop-down menu
Optional: Enter a specific course or course section, if not importing grades for the entire semester
Check Report Only
Click Synchronize