Hi Vmercader,
We haven’t built that into the plugin, but could be a handy feature moving forward. There currently is no filter set up to add that feature, and the only way would be to hack up core plugin files (which will revert in the next revision of the plugin). But if this is a feature you really need, you can do the following just above the loop for pages :
Step 1 – Add the option to the redirect dropdown
You need to first add the ‘Previous Page’ option to the redirect dropdown. You can do so by opening up yikes-inc-easy-mailchimp-extender/classes/class.yksemeBase.php
scroll down to line 2706, and add the following:
// add a previous page option to the dropdown
?><option <?php if(isset($field['page_id_'.$list['id']])) { selected( $field['page_id_'.$list['id']], 'Previous Page' ); } ?> value="Previous Page">Previous Page</option><?php
That should add a ‘Previous Page’ option to your dropdown on the settings page.
Step 2 – redirect to the appropriate page
For the redirect, you’ll want to remain in the same file yikes-inc-easy-mailchimp-extender/classes/class.yksemeBase.php
. Scroll down to (around) line 3080, where the redirect is set up. (you’ll want to paste the following code in place of the old code, around lines 3080-3091)
You’ll want to change things around to the following:
// Create and store our variables for the redirection
$form_id = explode('-', $field['id']); // get the form ID
$redirect_value = (isset($field['yks_mailchimp_redirect_'.$form_id[1]]) ? $field['yks_mailchimp_redirect_'.$form_id[1]] : ''); // get the redirect value from the lists page redirect checkbox
$redirect_page = (isset($field['page_id_'.$form_id[1]]) ? $field['page_id_'.$form_id[1]] : '') ; // get the redirect page that was set in the pages dropdown on the lists page
$site_url = "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; // grab and store the current sites URL
$redirect_url = get_permalink($redirect_page); // get the permalink of the page we are going to redirect too
if ( $redirect_page == 'Previous Page' ) {
$redirect_url = $_SERVER['HTTP_REFERER'];
$site_url = "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; // grab and store the current sites URL
}
Note: You will have to update this section, as well as the section above it (if you plan on ever using the ‘table’ prefferred layout setting).
That should be all. Once those lines of code are in place, you should be successfully redirected to the previous page.
Thanks,
Evan