How to merge two categories ?

How to merge two categories ?

על ידי Đinh Lư Giang בתאריך
מספר תגובות: 3
I have two categories, say A and B. Each of the category includes many entries. I want to merge them into one category, say A. How can i do (with moodle codes or mysql) so that I don't need to to them manually (by changing each entry).

Thank you very much

Giang
http://vietcourses.com
http://vietnameseonline.net
ממוצע דרוגים: -
בתגובה ל: Đinh Lư Giang

Re: How to merge two categories ?

על ידי Joseph Rézeau בתאריך
תמונה של Core developers תמונה של Particularly helpful Moodlers תמונה של Plugin developers תמונה של Testers תמונה של Translators

Dear Giang,

There is unfortunately no direct method through the Moodle interface to bulk move glossary entries from one category to another. However, if you have access to your Moode site database, through phpMyAdmin, here's a little example illustrating how to do it.

Suppose in your Moodle course you have 2 glossaries: "Giang's glossary" and "Joseph's glossary". in "Giang's glossary" we have created 2 categories named Category A and Category B. in "Joseph's glossary" we have created 2 categories named Category C and Category D. Enter your Moodle mysql database using phpMyAdmin.

go to Table mdl_glossary to identify the id number of Giang's glosary, (extract below)

Id course name
2 2 Giang's glossary
3 2 Joseph's Glossary

In course id 2 we have Giangg's glossary id 2 and Joseph's glossary id 3

go to Table mdl_glossary_categories

identify the categories id

Id

glossaryid

name

usedynalink

4

2

category A

0

5

2

category B

0

6

3

category C

0

7

3

category D

0

In Giang's glossary (id 2) we have category A, id 4 and category B, id 5.

we want to move all glossary entries from category B (id 5) to category A (id 4).

In the sql query window, we type this command:

UPDATE `mdl_glossary_entries_categories` SET `categoryid` = '4' WHERE `categoryid` = '5';

or (without the queer apostrophes):

UPDATE mdl_glossary_entries_categories SET categoryid = '4' WHERE categoryid = '5';

Joseph

בתגובה ל: Joseph Rézeau

Re: How to merge two categories ?

על ידי Đinh Lư Giang בתאריך
Dear Joseph,
Thank you so much for your time and help.
I am testing on localhost before doing it in a production site.

Je te souhaite bonne sante חיוך . Merci encore
Cordialement

Giang