Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Script to accept &uid=whatever and store it into the new donation's uid field.
<script type="text/javascript">
// Add donation.uid to the form and populate it with the contents of the
// `uid` query in the URL.
// @see
$(document).ready(function() {
if (window.location.href.indexOf('public/?donate_page_KEY=') == -1) {
var searches ='&')
.reduce(function(a, x) {
var parts = x.split('=');
a[parts[0]] = (parts.length > 1) ? parts.splice(1).join('=') : null;
return a;
}, {});
if (searches.hasOwnProperty('uid')) {
// @note The UID *must* appear at the end of the form. If it's not there
// then Salsa will apply it to the supporter record.
+ '<input type="hidden" name="object" value="donation"/>'
+ '<input type="hidden" name="uid" value="' + searches['uid'] + '"/>');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.