diff --git html/sites/all/modules/contrib/smackdown/smackdown.js html/sites/all/modules/contrib/smackdown/smackdown.js
index 3029963..8e03968 100644
--- html/sites/all/modules/contrib/smackdown/smackdown.js
+++ html/sites/all/modules/contrib/smackdown/smackdown.js
@@ -44,7 +44,7 @@
*/
Drupal.smackdown.attachVote = function(context, selector) {
$(selector, context).each(function() {
- var $element = $(this), smackdownLocation = Drupal.settings.basePath + Drupal.theme('smackdownLocation');
+ var $element = $(this);
// Attach the on-click popup behavior to the element.
$element.click(function(e){
Drupal.theme('voting', $element);
@@ -58,7 +58,7 @@
data: params,
success: function(json) {
// we put the location into a variable so that it can be changed by other modules
- location.href = smackdownLocation;
+ location.href = json.location
}
};
$.ajax(ajaxOptions);
@@ -88,9 +88,4 @@
element.parent().css({'background-color':'#ffc'});
return element.parent().append(output);
};
-
- Drupal.theme.prototype.smackdownLocation = function() {
- return Drupal.settings.smackdown.location;
- };
-
})(jQuery);
diff --git html/sites/all/modules/contrib/smackdown/smackdown.module html/sites/all/modules/contrib/smackdown/smackdown.module
index 5885f40..d4df4f8 100644
--- html/sites/all/modules/contrib/smackdown/smackdown.module
+++ html/sites/all/modules/contrib/smackdown/smackdown.module
@@ -72,15 +72,14 @@ function smackdown_vote($cid = NULL, $sid = NULL) {
'value' => $cid,
'value_type' => 'option',
'tag' => 'smackdown',
+ 'location' => "node/$sid/voting-results",
);
+ drupal_alter('smackdown_vote', $vote);
+ $location = url($vote['location'], array('absolute' => TRUE, 'query' => "smackdown_vote=$sid"));
// Save voting results.
$results = votingapi_set_votes($vote);
-
- // Set user session var to include this $nid
- $_SESSION['smackdown_vote'] = $sid;
- drupal_set_header('text/javascript');
- print drupal_to_js(array('results' => $results));
+ drupal_json(array('results' => $results, 'location' => $location));
exit();
}
}
@@ -117,10 +116,9 @@ function smackdown_nodeapi(&$node, $op) {
);
drupal_add_js($settings, 'setting');
- // a log of previous votes are stored in $_COOKIE
- if (isset($_SESSION['smackdown_vote'])) {
+ // a log of previous votes are stored in $_GET
+ if (isset($_GET['smackdown_vote'])) {
$prev_results = smackdown_results('short', node_load($_SESSION['smackdown_vote']));
- unset($_SESSION['smackdown_vote']);
// append the results of the previous smackdown to $node->content
$node->content['prev_results'] = array('#value' => $prev_results, '#weight' => $node->content['body']['#weight']--);
}