Some of the stories on a site I maintain comes up with the teaser content duplicated in the body when I edit the stories. For some it comes out fine. For those that comes up with the teaser content duplicated I see that 'Show summary in full view' is unchecked and for the ones that did not have any problem this checkbox is checked. When I delete the duplicated teaser content from the body and save the node with the 'Show summary in full view' unchecked I get a message that says that
You specified that the summary should not be shown when this post is displayed in full view. This setting has been ignored since you have not defined a summary for the post. (To define a summary, insert the delimiter "< !--break-->" (without the quotes) in the Body of the post to indicate the end of the summary and the start of the main content.)
Now when I edit the story again the checkbox comes up checked even though it was unchecked when I opened it and the teaser duplication is not there. On further saving and editing the checkbox remains checked and the teaser does not get duplicated again.
There are two input formats available for the story content type. One is Full HTML with WYSIWYG (TinyMCE) and the other Full HTML without WYSIWYG. The articles comes up with the Full HTML without WYSIWYG format.
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | About Greyhead.co_.uk Greyhead.co_.uk – The online portfolio and blog of Alex Harries.png | 960.76 KB | alexgreyhead |
| #5 | Picture1.png | 48.12 KB | astreib |
Comments
Comment #1
twodI'm not able to reproduce this. Were those nodes created with a separate teaser/summary before Wysiwyg module was enabled?
Comment #2
anoopjohn commentedI am not sure how these nodes where created because I started supporting the site after these nodes where created and there is no way to get that information unless it can be done programmatically.
Comment #3
bigsmile commentedI confirm that the teaser gets duplicated inside the editor when not using the
and 'Show summary in full view' is not checked.
Comment #4
adamo commentedI ran into the same problem with some of my nodes. Not sure if this is something new in 6.14, but I didn't notice it before that. It only seems to be an issue if the contents of the teaser don't match the contents of the node. In my case I deleted the teaser from the DB and everything went back to normal.
Comment #5
astreib commentedI'm having the same problem. Drupal 6.14/Wysiwyg 6x-2.0. It happens regardless of editor; I initially thought it might be a bug in TinyMCE so I tried FCKeditor, and YUI Editor it happens with these also.
Steps to reproduce:
Create a new Page node
Enter some text (at least two separate lines)
Save
Edit the node.
Preview
The preview looks fine but in the editor panel the content is duplicated and if a user saves from the Preview page they get duplicated text.
Comment #6
kevinquillen commentedYep. We get the same thing. Just updated the core to 6.14, latest WYSIWYG and TinyMCE 3.2.7.
No amount of form_alter is preventing the teaser from being stuffed back into the content area, which is why it looks like content is duplicated. The more you save the node, the more times the teaser gets put at the top of the body for the editing page.
How are you supposed to stop this from happening?
Edit:
A former coworker who has gone on to UNC fixed this for us awhile ago, I just remembered.
He upgraded Superteaser module from Drupal 4 to Drupal 6. It wasn't turned on for our site. I just turned it on, and the problem vanished.
Here is the code, feel free to use it or read it whatever:
I think the final two functions are the only important parts to addressing this problem, but I am not entirely sure at the moment. Hope this helps someone.
Comment #7
millenniumtreeThis appears to happen when the `node_revisions` table has data in the `teaser` field, but none in the `body` field.
The following SQL code seems to have fixed it for me (your mileage may vary)
UPDATE `node_revisions` SET `body` = `teaser` WHERE `body` = ''
This looks like a pretty serious bug for 6.14. I hope it gets fixed ASAP as it could cause havoc.
Comment #8
buzzman commentedi noticed this bug in Drupal 6.1 sometime back as well so it's not unique to Drupal 6.14.
the problem is in the node.module/node.pages.inc code
you can mess around there to resolve this directly, but I have patched it many times over now, so can't recall what I did :-(
i'll feedback if I do
Comment #9
AlexisWilke commentedI just noticed that today! I just use FCKeditor by itself (not through WYSIWYG) so I guess that's not specific to you and thus would possibly be a problem in the core. Note that when I use the <!--break--> marker then everything is fine.
One idea would be that before the editor concatenates the teaser with the body, it should first check whether it is necessary to do so by looking for the <!--break--> marker in the body. If not present, ignore the teaser.
Now, the other possibility is that some other 3rd party module saves the $node->teaser when the Core does it right. If you do not have that 3rd party module, it may very well work right...
What do you think?
Thank you.
Alexis
P.S. This only happens when the teaser is marked as part of the body and there is no <!--break--> marker in the node content.
Comment #10
AlexisWilke commentedGot it... It's the Core that does it all wrong.
The following test does not take in account the fact that the teaser may be modified to include closing tags as required (i.e. if a paragraph is cut, then they may add '...' and close the necessary tags such as </p>).
Hmmm... The Teaser as defined in Core is just all broken!
Alexis
Comment #11
kevinquillen commentedAlso, if you have a WYSIWYG or put a empty line at the start of content, the teaser does not get generated.
Comment #12
AlexisWilke commentedYeah it looks like an empty teaser is not correctly managed. I think it's just not expected to be empty (how useful would that be?)
Anyway... I have a fix for the Core Drupal 6.19 which should work on older versions too. It completely replaces the completely broken node_teaser() function with something that never fails (he! he!)
Plus, to avoid the double teaser in the edit box you want to apply the fix to the node_body_field() too. (that's in the same patch.)
The problem is that the teaser will be transformed because it is incorrect HTML and thus it won't match the body anymore. With a correct teaser, you can test it properly against the body and distinguish it as expected.
#221257: text_summary() should output valid HTML and Unicode text
Thank you.
Alexis
Comment #13
sunThat Drupal core patch is one possible cause for this issue. If you applied it, then your {node_revisions}.teaser values are bogus now.
I'm sorry, but neither TwoD nor me can reproduce this problem on a clean Drupal site. So there must be some other module or code that hi-jacks your data. In any case, the issue is not caused by Wysiwyg.
Comment #14
AlexisWilke commentedSun,
The problem is when the very first paragraph is "so large" that it gets cut at the wrong place. Then when you click Preview teaser or Save it messes up everything.
This being said, you are right that is not your problem. It's the Core that doesn't know how to handle the teaser properly.
See reference in #12 above.
Thank you.
Alexis
Comment #15
mikebann commentedI'm pretty sure this is caused by the revisions module or at least it coincides with my installation of that module. I misunderstood the post above. Do you have to hack the core to fix this? is there an update that deals with this issue?
Comment #16
AlexisWilke commentedAs mentioned in #12, there is a patch available here: #221257: text_summary() should output valid HTML and Unicode text
It probably won't be easy to have it added to core, but when using a system like FCKeditor and with the Core bug in cutting the teaser without taking the HTML in account, it will do all sorts of funky things to your content.
I don't use the revisions module much at all so I'm sure that the problem described is very similar to what I mentioned. Either way, I think that you are not responsible. However, if you can help push the patch in Core, it would be great. 8-) More votes will eventually force them to accept the fact that the current version can generate a big bad loss of data and thus the correction is required.
Thank you.
Alexis
Comment #17
twodI may have found a way to reproduce this, but I don't have time to further debug or outline the details yet.
And I'm not sure this can be completely fixed within Wysiwyg either...
Marked duplicates of eachother and this issue: #945910: Wysiwyg always insert <!--break--> before text in textarea after submit edited node, #862822: Breaks tag doubles, doesn't work. The symptoms are a bit different, but I'm pretty sure they are caused by the same bug.
EDIT: Referenced the wrong issue above.
Comment #18
AlexisWilke commentedTwoD,
Would you have the time to test, see whether it fixes your problem to patch your system with #221257: text_summary() should output valid HTML and Unicode text and be so kind as to report the results here?
Thank you,
Alexis
P.S. Btw, the patch is in #49
Comment #19
twodYes I'll test that, but first I need to be 100% sure what happens without it, will fire up the debugger as soon as I get some spare time.
I think this issue is most likely to happen if Wysiwyg was enabled when there are existing nodes with auto-generated teasers, or was it with those having separate teasers? (I forgot the details since I last dug into this.)
Comment #20
AlexisWilke commentedTwoD,
Yes. One very long paragraph at the top of your body ("long" means more than the max. number of characters allowed in your teaser,) and let the automatic teaser system do the work... It cuts the paragraph without closing the HTML tags. When you come back, the missing tags are added by the WYSIWYG editors and break the comparison and that means you end up with the teaser + body instead of just body in your editor.
Thank you.
Alexis
Comment #21
alexgreyhead commentedHope you don't mind me tentatively reactivating this, but I've just fallen foul of this using the recommended version of WYSIWYG on D6.
In case it's useful, my teaser length is set to "unlimited".
(ick, you can ignore the attachment - it's no longer relevant)
Comment #22
Renee S commentedI'm seeing this too, in some very specific circumstances - only when Upload Paths is enabled, and it changes a link, then the subsequent edit has a duplicated teaser. The teaser looks just fine in the node_revisions table, though, and it happens even when the Upload Paths rewrite isn't in the teaser itself.
Comment #23
AlexisWilke commentedReinette,
I've been using this patch on my end:
http://drupal.org/node/221257#comment-3735536
It's a pretty heavy patch on core to fix the teaser problem for all WYSIWYG editors (I use CKEditor, mainly).
That thread is really long, but full of interesting stuff...
Thank you.
Alexis Wilke
Comment #24
kubrt commentedFor those who - like me - don't like the Teaser function at all and can't find a decent solution for the duplicated summary problem in D6, here is how I got a rid of teasers (from the user's perspective) all together. You have to put these two function into a custom module.
Comment #25
twodI'm going to close this issue as a duplicate of #221257: text_summary() should output valid HTML and Unicode text because we can't fix it in Wysiwyg alone, and the motivation and time I have to spend on the 6.x branch is limited.
I may reopen it later, when I've gotten around to fixing other issues. Getting D6 summaries fixed in Core is pretty much a requirement for a useful patch here.
If the Core patch gets committed, this issue may even disappear entirely from Wysiwyg's perspective. (Note, that only applies to new content created/edited after the patch, any existing duplicated summaries are likely messed up beyond safe automated repair anyway.)
As it is now, you have to be very careful about where the teaser splitter gets inserted. If it gets inserted into a tag, Drupal will try to correct the faulty HTML resulting from that split in the field, but not in the summary. Drupal does not recognize that the summary is actually the first part of the field contents (because it has changed slightly) when the node is edited, so it prepends the summary to the field value and inserts the teaser break comment between them.