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