Last active
August 29, 2015 14:03
-
-
Save WillBrubaker/57157ee587a9d580ddef to your computer and use it in GitHub Desktop.
An example of how to redirect after survey submission for the Awesome Surveys WordPress plugin. Requires Awesome Surveys version > 1.1.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Custom Redirect for Awesome Surveys | |
Plugin URI: http://www.willthewebmechanic.com/awesome-surveys | |
Description: Redirects to a specified link after survey submission | |
Version: 1.0 | |
Author: Will Brubaker | |
Author URI: http://www.willthewebmechanic.com | |
License: GPLv3.0 | |
*/ | |
add_filter( 'after_awesome_survey_response_processed', 'wwm_after_survey_redirect', 10, 2 ); | |
/** | |
* Filters the URL | |
* @param string $url the url that is being filtered | |
* @param array $args an array of arguments. At the time of creation this array contained | |
* 'survey_id' which is, well, the id of the survey being processed | |
* 'survey' which is the survey that was responded to and 'responses' which | |
* is a copy of the 'questions' array that was posted i.e. $_POST['question']. Use these values to decide | |
* where to redirect to or return null if not re-directing. | |
* @return string the filtered url | |
* @since 1.0 | |
* @author Will the Web Mechanic <[email protected]> | |
*/ | |
function wwm_after_survey_redirect( $url = null, $args = array() ) | |
{ | |
$url = 'http://www.willthewebmechanic.com'; | |
return $url; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment