MG 2.0 Mass move media from category to category

It's just a case of changing the category_id field in the xf_mg_media_item table. Afterwards you'll also need to run the rebuild tool for categories so the correct counts are displayed.
 
It's just a case of changing the category_id field in the xf_mg_media_item table. Afterwards you'll also need to run the rebuild tool for categories so the correct counts are displayed.
Thanks!

What about mass moving personal albums to a media item category?
 
Same but the xf_mg_album table, though you'll need to ensure the category is an album type, rather than media item.

If you want to move the contents of albums to media item categories, then you'll need to use inline moderation, ideally. Otherwise it would be a case of setting the album_id of the media item to 0 and setting the category_id to the desired category.

Just please be careful doing this. You can't do enough backups or testing if you're manually changing the database.
 
If you want to move the contents of albums to media item categories, then you'll need to use inline moderation, ideally. Otherwise it would be a case of setting the album_id of the media item to 0 and setting the category_id to the desired category.
The aim is really to ditch the album category type and change it to media item. Then move personal albums to a media item category.

We have over one million items in the album category already (we can't change the category type to media item via admin panel) and over 20,000 personal albums. I don't think inline moderation is a viable option for us, unfortunately.

What's your recommended advice to go about all of this?
 
Just to be clear, you’re talking about moving the contents of albums into categories, right?

Because you can’t have albums inside a media item category.
 
Just to be clear, you’re talking about moving the contents of albums into categories, right?

Because you can’t have albums inside a media item category.
Just the images and whatever related data so it'll work like a media item category type. Album titles that are associated with the album category type etc aren't needed. We want to move personal albums and media from the album category type.
 
Same but the xf_mg_album table, though you'll need to ensure the category is an album type, rather than media item.
I managed to move personal albums to an album category but when I click on the album from the media gallery page, it says:

No media has been added to this album yet.
 
If the media item is in an album which is inside an album category, then no, of course not. The media item still needs to know which album it is in.
 
If the media item is in an album which is inside an album category, then no, of course not. The media item still needs to know which album it is in.
How would I go about getting rid of the albums but keeping all the media?

My objective is just to move all personal albums to a category and change the category from the album type to the media item type.
 
These media items, do they have a category_id value (the category_id of the album category) or do they have a category_id of 0?

And can you confirm that all of them now have an album_id of 0?
 
These media items, do they have a category_id value (the category_id of the album category) or do they have a category_id of 0?

And can you confirm that all of them now have an album_id of 0?
xf_mg_media_item table, album and category IDs are 0.
xf_mg_album table, album and category IDs are not 0.
 
  1. Create a new media only category, note down the category_id, e.g. 9999
  2. Run the following query:
SQL:
UPDATE xf_mg_media_item
SET category_id = 9999
WHERE category_id = 0
AND album_id = 0

That should do it. You should then be able to delete the album category which should delete the albums within.

Hopefully you’re running these on a test database and taking lots of backups...
 
Back
Top Bottom