I have Drupal 7.34 installed.

Some time ago I created a content type "Video Downloads" with machine name video_downloads and created only one node with it so far. The node is a list of videos and it's called "Video Downloads" also.

Today I created another similar node which a list of 3D image sets. The node is called "CGI Sets". I was going to use the same Content Type as before so I realized this content type good not only for my lists of video downloads but for all digital downloads lists on my store. So I changed the Content Type name to "Store Downloads", with machine name "store_downloads"... And I created this new node "CGI Sets"

As expected, the content type of my "Video Download" node now changed to "Store Downloads". So, both nodes (Video Downloads and CGI Downloads) are now a "Store Downloads" content type.

Problem: However when I go to my "Create Content" page to choose a content type to create a node, I realize that although there is now a "Store Downloads" content type, there is also a content type "Video Downloads" which should have disappeared when I renamed it to "Store Downloads".
Putting it simple, it seems that instead of renaming the content type, Drupal created a new one. But the strange things are:

1. The old content type "Video Downloads" shows up in the "Add Content" page (http://www.mydomain.com/node/add) but not in the "Content Types" page (http://www.mydomain.com/admin/structure/types).

2. When I click on that old Content Type "Video Downloads" in the "Add Content" page, to try and create a new node... It just returns me to the "Add Content" page. But in the URL bar I see "http://www.mydomain.com/node/add/video-downloads".

I imagine that if changing a Drupal content type name would be a mistake, Drupal itself would block Admins from doing so or at least a warning should pop-up disadvising to do so. So I never thought I was doing anything wrong that would harm my installation. What shall I do now???...

  • Shall I delete the new node "CGI Downloads" and rename the content type to "Video Downloads" to see if it merges back with the original one?
  • Shall I go to phpMyAdmin and do something there to delete tables related to the original content type name "Video Downloads"? Which ones?
  • Shall I revert to my previous database backup? Last backup I made was a few days ago before doing site updates some modules. But I have installed new modules after that and still hadn't do any new database backups so I guess it's not a good idea to revert databases at this point.
  • Shall I delete both nodes and delete both content types... And then create a new content type and re-create both nodes under that content type? This seems like the best option to me but I am unable to delete the original content type "Video downloads" as it doesn't show on the "Content Types" page (http://www.mydomain.com/admin/structure/types).

So if anyone could point me in the right direction I'd be most grateful. :)

Comments

VM’s picture

I'd delete both content types and start anew. changing of the machine name when there is data existing within that table can cause issues.

ARTIMEDIA’s picture

Thank you for your reply. Yes I suppose I could do that but... When I tried deleting (by reseting it in the Navigation Menu) the original Content Type, I had a new issue that I'm not being able to solve... (Please read my reply below)

I could try deleting also the other "modified" content type and see if for some magic, the "duplicate menu item" issue disappears by itself. But I have my doubts...

.

ARTIMEDIA’s picture

I have opted for an even more radical approach and restored a database backup from 3 days ago. More details in my last reply.

ARTIMEDIA’s picture

I've been doing some forum search and reading in these last 10 hours and I found out this particular Topic:

https://www.drupal.org/node/325093

According to the proposed solution in that topic, I went to /admin/structure/menu/manage/navigation and I reset the original Content Type from that Menu. But also according to what is said there, after reseting this Content Type, a duplicate "Create Content" menu item appeared at the bottom of my Navigation menu. Now I have two "Create Content" Menu Items. Worse, at some point I even have an empty Menu Item without title or description... Please notice the lat menu items in this image:

http://www.artimedia.pt/duplicate+empty_menu-item.gif

I'm not sure why this happens but I sure would like to know. It just doesn't smell good... A an empty and a duplicate Menu Item are just not supposed to exist. I can't even understand why this happened or how to fix this.

Also... I could restore my database to a version I have from a couple of days ago. After that backup I updated the "Views" module and I installed the "Site Disclaimer" module. Then I created the site disclaimer node and a couple more nodes. Not much more... And of course I also renamed the content type in question.

Could I just uninstall the Site Disclaimer module and remove it altogether, and then restore the database backup?.. Or are there any risks in doing this???.. If at least I could understand what is happening at all, it would be great. :P But I can't seem to understand what's causing this duplicate menu item and the empty one.

ARTIMEDIA’s picture

Ok, after trying to delete both Content Types, I was still experiencing the weird problems of having duplicate Menu Items in my Navigation Menu. Also, when I created a new Content Type it ended up in the Navigation Menu and not in the Content Types list... It was obvious the database was getting confused. What's worse, I started receiving error warnings on top of my website.

The problem was that after renaming the content type, the original name didn't disappear from the "Add Content" Menu. It disappeared from the "Content Types" Menu but in the "Add Content" Menu I ended up with both content types: The original one and the renamed one.
I tried deleting it from the "Add Content" Menu by going to Structure=>Menus=>Navigation Menu=>List Items=>Reset(original content type) but it was a bad idea. It deletes the original Content Type but creates a mysterious duplicate "Add Content" item to the bottom of the Navigation Menu. From that point on, everything just started behaving weird. If I created new Content Types they would neither show on Structure=>Content Types nor as a sub-item of the the "Add Content" Navigation Menu. They would show up at the bottom of the Navigation Menu instead.

It was evident that errors upon errors were multiplying and increasing exponentially. Database would be corrupted sooner than later and in the end my website was going to stop working... Predictably.

So I went ahead and restored the latest database backup I had from 3 days ago. I lost some nodes I had made and some registered users... But it was a small price to pay. The website is now working normally.

Lesson learned, I will never change machine names of Content Types again. Drupal should even prevent Admins from doing so or at least pop-up a very red warning sign, explaining what can happen, when people try to rename content types.

VM’s picture

Drupal should even prevent Admins from doing so or at least pop-up a very red warning sign, explaining what can happen, when people try to rename content types.

I disagree with the prevention. Changing the machine name previous to data being added doesn't cause any issues. Previous to D7 there was a note included in the description text. I'm not sure why it was removed in D7. I'd venture there is an issue in the queue that discusses the removal and the reasoning during D7 development.

ARTIMEDIA’s picture

I don't necessarily disagree. But something like - "Attention: Content (x number of nodes) has been created for this Content Type. Modifying it's machine name can cause database inconsistencies and eventually prevent your website from working correctly." - would help.
Just the same way Drupal warns when you're deleting a Content Type that already has content created.

Best,

Miguel

VM’s picture

Features such as that begin as issues in the next version of core. Feel free to file one after researching to ensure there isn't an already existing issue.

ARTIMEDIA’s picture

Will do.

Thanks a lot for the advice.

mobil_maniak’s picture

Hi, i have content type "transfer" where is 72 fields. Client decided to change content type name. I changed "transfer" to "transfer system" (with machine name "transfer_system")

what happened? Content type name was changed without any trouble on Drupal 7.54 . But administration menu stuck on old name but links worked (same on node/add )
Menu links in Management and Navigation - reset didnt worked , cache clear didnt worked, rename Menu - didnt worked.
Then i changed old translation in current language - worked. Then I did test on my dev machine.
Clear installation 7.54 -> one content type -> 15 new nodes -> changed CT name -> everything works but menu links didnt. clear cache few times - works (i think this is something odd with menu rebuild or cache).
If languages are enabled -> you must to search old names and translate it and/or change interface language if nothing was found.
But new or duplicate content types didnt appear. +1 to drupal. :)

jaesperanza’s picture

Posting here, as this is still relevant. In my case, it was the Node Body Class module causing issue when renaming the Content Type. It attaches a setting within the CT edit mode. Uninstalling that removed the issue. Not sure yet why the conflict.