Skip to content

Instantly share code, notes, and snippets.

@salsalabs
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save salsalabs/bc06c88d4b9bc3dcba7d to your computer and use it in GitHub Desktop.
Save salsalabs/bc06c88d4b9bc3dcba7d to your computer and use it in GitHub Desktop.
Scripts to change the title of a TAF from a P2P donation page to the P2P donation page's title
<?
// If this is a TAF page and there is a 'supporter_my_donation_page_KEY' in the URL, then use
// the P2P page's title to fill the TAF page subject.
//
if (Request.getURL().indexOf('my/tellafriend.jsp') != -1) {
var myDonatePageTitle = null;
var myDonatePageKey = Request.getParameter('supporter_my_donate_page_KEY');
if (myDonatePageKey != null) {
var myDonatePage = DB.getObject('supporter_my_donate_page', myDonatePageKey);
myDonatePageTitle = myDonatePage == null ? "null" : ('"' + myDonatePage.Page_Title + '"');
?>
<script type="text/javascript">
var myDonatePageTitle = <?= myDonatePageTitle ?>;
if (myDonatePageTitle != null) {
var formRow = $('label[for=subject]').parent();
if (formRow.length > 0) {
var target = $('blockquote p', formRow);
if (target.length > 0) {
target.text(myDonatePageTitle);
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment