Move Courses from old categories and subcategories to new categorie

Re: Move Courses from old categories and subcategories to new categorie

by C Behan -
Number of replies: 3
You could try the course upload feature: https://docs.moodle.org/310/en/Upload_courses
I haven't done this but I expect that if you use this to update courses you can can specify a new category to place the courses into.

However, it may not be necessary - if you move a parent category 'under' another category I would expect all its sub categories and courses to move also. So you may only have to do it a few times in the course and category management that Colin mentioned.
Average of ratings: Useful (1)
In reply to C Behan

Re: Move Courses from old categories and subcategories to new categorie

by Randy Thornton -
Picture of Documentation writers
I like that idea, the course upload. Yes it can move existing courses to other (existing) categories.

What you would need to know is the correspondence of the current category ids to the target category ids to move each course. In Config Reports, this simple query will show the fields that Course upload needs:

SELECT
c.shortname AS "shortname",
c.fullname AS "fullname",
cat.id AS "category"
FROM prefix_course c
JOIN prefix_course_categories cat ON cat.id = c.category

Run that, save as a csv and then in the spreadsheet swap out each old category id to the new target category id and upload and move them.



In reply to Randy Thornton

Re: Move Courses from old categories and subcategories to new categorie

by Clovis Tristao -
Hi, Randy,

I'll try this tip, who knows, maybe not solve it. Thus, we can create a simple php program, which runs on Moolde's cron and performs this exchange, in specific semester periods.

Thank you very much.
In reply to Clovis Tristao

Re: Move Courses from old categories and subcategories to new categorie

by Randy Thornton -
Picture of Documentation writers
Exactly the same idea I had. If you are using a naming convention for semester periods in your categories, a script should be able to find and match up the current and future id numbers, then just create a basic output file to upload. Sounds like the way.