ergophobe - 8:05 pm on Jan 7, 2012 (gmt 0)
I have a thorny Drupal problem and I just can't figure it out. Looking for any ideas. This is long. I'm about to try your patience... Mine is past trying. It's gone!
I have about five content types and all have a the main comment stored in the comment_body field. This is an import of the site from Drupal 6, but since the import almost entirely failed, it is actually a lot of manual importing into the DB and a lot of simply recreating nodes.
All behave as expected except for one content type where the comment body does not show. The title, excerpted from the body shows, but the data does not. If I add a new field, nothing at all from that field shows, regardless of whether it comes first or second in the Comment Fields listing.
This content type is missing the author and subject fields when I look at the Comment Fields tab. In the other content types, if the author and subject fields are present, they are customizable (you have "edit" and "delete" links), which is not normal for Drupal 7 comments.
I also have an older version where the comment body does show on the offending content type, but all the other problems with the other content types are present.
I've ruled a lot of stuff out.
1. It's not a theme issue. It's a database issue.
I've tried this in Bartik, Stark and Seven and the theme makes no difference.
I took the functioning backup and the working version and did a complete diff for any differences in any files and there are none. The files are identical except for the database declaration. So it's the database.
2. It's not just a display problem. The data is missing in the outuput.
When I look at the devel /render output, the comment body shows that in other content types there's an array element for (where 2070 is the comment number):
$array['comments']['comments']['2070']['comment_body'] and that element contains 16 elements.
In the content type that has problems, this is entirely missing. So somehow it is not getting rendered at all.
When I look in the DB, the data is there. When I edit the comment, the data is there. But when I preview or look at the comment on the page, all I get is the title.
The really strange part
I used the Bundle Copy module to duplicate the 'trail' content type. I then renamed it 'trail2' and used the Node Convert module to convert the 'trail' nodes to 'trail2' nodes. Voilą! The comment bodies are back! I clear the caches, run cron and all that and they're still there.
Then I delete the old, unused 'trail' content type and all the 'trail2' comment bodies disappear. Poof! Gone. Still in the DB, but no longer display.
I've been making minor changes to isolate this and then dumping the DB and running a diff on the DB to see if I can find anything odd in the changes that would explain this, and I just can't find anything.
Now I'm faced with
a. Having 10 content types. Five that work and Five that don't, and if I accidently delete one of the non-working ones, the working one goes bad too.
b. using various export/import modules and laboriously moving things to a new site and seeing where the fail point is, but this will involve a lot of manual work, since some things don't have good export/import options.
Anyone with good ideas... I'd love to hear them.
Brought to you by WebmasterWorld: http://www.webmasterworld.com