I'm not sure if this is a mail_edit issue or date or subscriptions issue I was advised to post this here.
I go to administer->site building->mail templates and configure the digest template to include a cck date created using the date module.
When the date is printed in the digest email, it contains HTML tags, even though the user's account is configured to receive e-mail in plain text only:
Title: MPAA: Box Office Up 5.2%, Foreign Ticket Sales Dominate
<span class="date-display-single">04/01/2009</span>
TheWrap.com : Foreign now comprises 65 percent of the industry total -- an
increase of 17 percent over the last five years.
I uninstalled mimemail, but the date is still wrapped in these tags. Any ideas on how to remove these tags from the date printed in the digest?
I posted this in the subscriptions issue forum and got this reply:
#1
salvis - April 3, 2009 - 00:18You mean a cck date field?
subscriptions_cck.module uses the following code
if (!($formatted = html_entity_decode( content_format($field_info, $value, 'plain'), ENT_QUOTES, 'UTF-8'))) { $formatted = content_format($field_info, $value, 'default'); }to try to retrieve the field data in 'plain' format. If nothing is returned, it then asks for the 'default' format. Please take this information to the queue of the cck module that supplies your date field and ask there, why you're getting the span tags.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | 423502-13.patch | 4.73 KB | roderik |
| #7 | 423502-7.patch | 5.07 KB | roderik |
| #6 | 423502-6.patch | 5.14 KB | roderik |
Comments
Comment #1
karens commentedThere is no 'plain' format, but there probably should be one, so this is a feature request. Shouldn't be hard to add, I just need to get to it.
But on the mime mail issue, I don't know why they don't just do strip_tags() on the value they get back for plain mail text, I would guess that many or most CCK 'default' values have html in them.
Comment #2
aren cambre commentedI also need this for data exports. Right now my XML export (through Views Bonus Pack) looks like this on a module's date field named Date:
<Date><span class="date-display-single">Tue, 06/16/2009</span></Date>.Excel's gonna barf when it sees this.
I could give the fix a shot if you can guide me where to find the code.
Comment #3
aren cambre commentedKaren, if you get a chance, could you review #495426: Doesn't respect Format of overridden Date module in Views Bonus Pack's queue and see whether it relates to this?
Comment #4
Andrew Kaufmann commentedHey Karen!
I'm doing a large amount of XML export as well, and the ability to have the date in a plain format is also important to me -- and others, based on the thread referenced in #3.
Any chance of seeing that feature added?
Thanks!
Andrew
Comment #5
bomarmonk commentedRelated to http://drupal.org/node/598674 ??
Comment #6
roderikOK, here's a patch.
It adds extra formats: for every format 'Long', 'Medium', 'Short' & custom defined formats, there is an extra format:
- the format string has '_plain' appended
- the description has ' (no HTML)' appended.
Also, a 'default_plain' format is added, which could be used (instead of 'plain') in the code block in the original post.
This patch theoretically can change the behavior of some custom defined formats, because date_formatter_process() assumes that all field formats ending in '_plain' are a plaintext companion of a field format with '_plain' chopped off.
Comment #7
roderikMeh. I'm getting warnings from strrpos sometimes, saying the index is out of bounds for the haystack.
Here's a fixed patch, where the comparisons using 'strrpos' are replaced by 'substr', which does not have that problem. (And is better readable too.)
Comment #8
roderikForgot status change
Comment #9
Renee S commentedCan I suggest calling it "plain" and label it "Plain text" to make it consistent with the core formatters?
Comment #10
brad.bulger commentedthis is working for me.
i have a related question that i may need to take to the Views queue, though: the output in a view of a date field in the Plain format has a whole bunch of white space and newlines before and after the value. where are those coming from? they don't seem to be coming out of the Date code....this was a Views issue, not related to the plain date formatting.Comment #11
rbrownell+1 Subscribe
Any further progress on this?
Comment #12
roderikWell, people (which in busy project queues are usually not the module maintainer) usually try the patch out and comment, or set it to RTBC.
I don't feel qualified to decide on the labeling issue, or on naming the default plaintext format 'plain' instead of 'default_plain'.
I'm sympathetic to labeling the formats "formatname (plain text)" instead of "formatname (no HTML)" as I did... just not sure if people would grasp what the non-'plain text' format was, in that case.
Comment #13
roderikre-roll
Comment #14
marcoscanois this patch going to be ported (or committed) to D7? I'm having the same issue with date 7.x-2.x-dev
thanks
Comment #15
honza pobořil commentedIn D7 it is already solved - use "plain" formatter for date fields.
Comment #16
damienmckennaUnfortunately the D6 version of this module is no longer supported, but we appreciate the time you put into this. If this problem is relevant for D7 too, please reopen the issue. Thanks.