Format Not Applied to Special Mail Tag ‘_date’
-
CF7 v4.7 allows the special tag [_date]. It also allows to specify a format for a date tag like [_format_your-date “D, d M y”].
THE ISSUE: It will not apply the ‘_format’ to the special date tag ‘_date’.
Meaning, if you specify a format for the special date tag such as [_format__date “Y”] the format will be ignored. Instead, the system default date format e.g. “March 5, 2017” will be applied rather than “2017” as specified in the _format = “Y”.
The issue occurs in include/mail.php. Currently the _format is applied on line 307, but the _date special tag is processed afterwards on line 327.
A small change to mail.php would fix this problem, simply inserting 2 extra lines as follows after line 327 and before line 329 in mail.php:
// mail.php line 327: $special = apply_filters( 'wpcf7_special_mail_tags', '', $tagname, $html ); // To apply '_format' the special tag '_date': // Insert the following after line 327 (and before line 329): if ( ! empty( $special ) && '_date' == $tagname && ! empty( $format ) ) { $special = $this->format( $special, $format ); } // mail.php line 329: if ( ! empty( $special ) ) { $this->replaced_tags[$tag] = $special; return $special; }
I hope you can include this minor fix in the next release. Thank you for your help, best regards.
- The topic ‘Format Not Applied to Special Mail Tag ‘_date’’ is closed to new replies.