Answers.Body: <p>I settled on using a Wordpress shortcode. The shortcode gets evaluated by Wordpress so practically it's the same as running some php. I put the shortcode in Civi's .tpl file.</p>
  
  <p>Some additional information: the first time I tried inserting a shortcode in a .tpl file, it didn't work. I tried it on a contribution page. But the contribution page itself is loaded through a shortcode, so in effect we would have a shortcode inside a shortcode, which didn't work. After that I tried inserting a shortcode in the /civicrm/templates/CRM/Mailing/Page/Confirm.tpl and it worked. I think it's because the CiviCRM page in Wordpress is loaded by a hook, not by a shortcode.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-24T21:27:29.660Z
Answers.LastActivityDate: 2015-12-24T21:27:29.660Z
Answers.UserDisplayName: Borislav Zlatanov
Answers.Body: <p>Have you looked at adding a .tpl.extra file? This can be a very easy way to add more content to any template.</p>
  
  <p><a href="https://civicrm.org/blogs/dave-greenberg/now-its-easier-add-custom-behaviors-templates" rel="nofollow">Instructions are here</a>.</p>
  
  <p>Your .tpl.extra file could contain either the extra content you wish, or one line of javascript to perform the redirect.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-22T17:01:08.957Z
Answers.LastActivityDate: 2015-12-22T17:01:08.957Z
Answers.UserDisplayName: Coleman
Body: <p>After a user signs up to receive newsletters (using the profile coming from CiviCRM/CiviMail), they receive a confirmation email. Upon clicking on the confirmation link in that email, they are taken to a Confirmation page which says that they have successfully been subscribed to the X mailing list. The content of that Confirmation page comes from the /civicrm/templates/CRM/Mailing/Page/Confirm.tpl.</p>
  
  <p>What I need to do is one of the following. Either of these options would work for me:<br>
  1) Run php code in the Confirm.tpl file. This would allow me to dynamically load some additional content and present it to the user. I'm not sure about the possibility of this because I know inserting php in Smarty has been deprecated.<br>
  2) Redirect to a separate page and present to the user that page instead of the content coming from Confirm.tpl. In that separate page I would then be able to run my php and load content dynamically.</p>
  
  <p>I am running Wordpress 4.4 and CiviCRM 4.6.8.</p>
  
Tags: <civimail><redirect><confirmation><newsletter>
Title: How to redirect after successful newsletter subscription
ThreadText: # How to redirect after successful newsletter subscription
  
  (Asked by: username_0 on 2015-12-22)
  
  After a user signs up to receive newsletters (using the profile coming from CiviCRM/CiviMail), they receive a confirmation email. Upon clicking on the confirmation link in that email, they are taken to a Confirmation page which says that they have successfully been subscribed to the X mailing list. The content of that Confirmation page comes from the /civicrm/templates/CRM/Mailing/Page/Confirm.tpl.
  
  What I need to do is one of the following. Either of these options would work for me:  
  1) Run php code in the Confirm.tpl file. This would allow me to dynamically load some additional content and present it to the user. I'm not sure about the possibility of this because I know inserting php in Smarty has been deprecated.  
  2) Redirect to a separate page and present to the user that page instead of the content coming from Confirm.tpl. In that separate page I would then be able to run my php and load content dynamically.
  
  I am running Wordpress 4.4 and CiviCRM 4.6.8.
  
  **Tags:** civimail, redirect, confirmation, newsletter
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2015-12-24. Score: 0 | Accepted answer
  
  I settled on using a Wordpress shortcode. The shortcode gets evaluated by Wordpress so practically it's the same as running some php. I put the shortcode in Civi's .tpl file.
  
  Some additional information: the first time I tried inserting a shortcode in a .tpl file, it didn't work. I tried it on a contribution page. But the contribution page itself is loaded through a shortcode, so in effect we would have a shortcode inside a shortcode, which didn't work. After that I tried inserting a shortcode in the /civicrm/templates/CRM/Mailing/Page/Confirm.tpl and it worked. I think it's because the CiviCRM page in Wordpress is loaded by a hook, not by a shortcode.
  
  
  ---
  
  ### Answer by username_1 on 2015-12-22. Score: 3
  
  Have you looked at adding a .tpl.extra file? This can be a very easy way to add more content to any template.
  
  [Instructions are here](https://civicrm.org/blogs/dave-greenberg/now-its-easier-add-custom-behaviors-templates).
  
  Your .tpl.extra file could contain either the extra content you wish, or one line of javascript to perform the redirect.
  
  
  ---
  
  