Course custom fields and backup problem

Course custom fields and backup problem

by Oleg Mikheev -
Number of replies: 2

Hello! I want to create custom fields in the course settings. I'am doing so:

  1. add to the course/edit_form.php some custom fields.
  2. create new columns in the mdl_course data table.

This work perfectly. After update or create new course, all changes will saved. 

But i have a big trouble. I'am create the backup of this course, and restore it. new columns in the database doesn't saved. I think i need to do some changes in restorelib.php and backuplib.php, but i don't understand what changes it be. Thanks.

Average of ratings: -
In reply to Oleg Mikheev

Re: Course custom fields and backup problem

by Oleg Mikheev -

The problem was solved.

You will must add your custom fields into the backup_stepslib.php file in the \backup\moodle2 folder. Line 391. protected function define_structure() function.

$course = new backup_nested_element('course', array('id', 'contextid'), array( here all your fields)

Average of ratings: Useful (1)
In reply to Oleg Mikheev

Re: Course custom fields and backup problem

by Rituraj Jain -

Sir,

Can you please guide me how to do it. I m getting some errors. Please sir  explain how to add a custom field in add course form briefly.

Thankx in advance.