CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • {mailing.viewUrl} link breaks WordPress pages
Pages: [1]

Author Topic: {mailing.viewUrl} link breaks WordPress pages  (Read 1044 times)

craftee123

  • I post occasionally
  • **
  • Posts: 36
  • Karma: 0
{mailing.viewUrl} link breaks WordPress pages
June 09, 2014, 10:45:39 am
I've been testing sending CiviMail messages using the {mailing.viewUrl} token.

The link comes through fine into the e-mail, but when I visit the link, the CiviCRM codes seem to have broken the WordPress base page.

Here's are two examples:

#1
WordPress base page: http://tcadp.org/civicrm-page
{mailing.viewUrl}-generated CiviMail link: http://tcadp.org/civicrm-page/?page=CiviCRM&q=civicrm/mailing/view&reset=1&id=785

[At first I thought this was just a theming issue, but when I looked at the html, I noted that all of the WordPress code that should be below the code for the e-mail -- e.g. divs for sidebar and footer -- are stripped]


#2
WordPress base page: http://cnadp.org/civicrm-page/
{mailing.viewUrl}-generated CiviMail link: http://cnadp.org/civicrm-page/?page=CiviCRM&q=civicrm/mailing/view&reset=1&id=205



andrewhunt

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 13
    • AGH Strategies
  • CiviCRM version: all of 'em
  • CMS version: Drupal, Joomla, and WordPress
Re: {mailing.viewUrl} link breaks WordPress pages
June 09, 2014, 12:29:42 pm
I have no idea what the cause is, but your page rendering is crapping out while displaying the message.  There's the table that wraps most of the message body, and then there's the tracking image, and that's it.  Viewing the source, I can see that the page is missing all kinds of closing tags--everything that would go after the content.

For what it's worth, you've got the same problem when CiviCRM displays its error message: http://tcadp.org/civicrm-page/?page=CiviCRM&q=civicrm/user&reset=1
But when CiviCRM's displaying an event info page, it works fine: http://tcadp.org/civicrm-page/?page=CiviCRM&q=civicrm/event/info&id=1&reset=1

You might experiment a bit with this on other sites and/or with different themes on this site.  This may be a real bug somewhere deep, though.
You can find me at AGH Strategies.
Need help now?  Civi911 is your go-to for CiviCRM support.

craftee123

  • I post occasionally
  • **
  • Posts: 36
  • Karma: 0
Re: {mailing.viewUrl} link breaks WordPress pages
June 09, 2014, 12:39:52 pm
Thanks, Andrew. I knew you'd tackled some of the page rendering issues, which is why I flagged this for you. I've tested on several sites all using different themes. (You can see a second one in my original post.)

I'm surprised no one has seen this before, though...

andrewhunt

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 13
    • AGH Strategies
  • CiviCRM version: all of 'em
  • CMS version: Drupal, Joomla, and WordPress
Re: {mailing.viewUrl} link breaks WordPress pages
June 09, 2014, 12:49:53 pm
If it's any consolation, it's a general bug even affecting the demo site: http://wordpress.demo.civicrm.org/?page=CiviCRM&q=civicrm/user&id=1&reset=1

Do you know whether you set the permissions for those mailings as user or public?  I wonder if something's failing on permission checks.
You can find me at AGH Strategies.
Need help now?  Civi911 is your go-to for CiviCRM support.

haystack

  • I post occasionally
  • **
  • Posts: 61
  • Karma: 2
  • CiviCRM version: 4.n
  • CMS version: WordPress 4.n
  • MySQL version: 5.n
  • PHP version: 5.n
Re: {mailing.viewUrl} link breaks WordPress pages
June 24, 2014, 07:33:23 am
I posted my assessment of why this is happening on Jira: https://issues.civicrm.org/jira/browse/CRM-14827?focusedCommentId=62167

I'm afraid I haven't got a fix for this - or the other related issue CRM-14841: https://issues.civicrm.org/jira/browse/CRM-14841 which also affects the display of mailings. However, because you're using WordPress I should let you know that I have written a plugin that handles CiviMail in WordPress and works around both these issues to produce a viable working system...

What the plugin does is to intercept the setup of each mailing and creates a WordPress post (of a Custom Post Type) from the content of the mailing. It then injects the permalink to the WordPress post into the foot of the template. Each mail is therefore viewable within the default post template for your theme, though it can be overridden by using standard WordPress template hierarchy techniques. The plugin replaces the tokens in each email with the values for the person viewing it. Lastly, the plugin filters the WordPress archive query for that CPT and allows a logged in user to view all emails they have been sent. You can find it on GitHub here:

https://github.com/christianwach/civicrm-wp-mail-sync

Any feedback much appreciated.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • {mailing.viewUrl} link breaks WordPress pages

This forum was archived on 2017-11-26.