Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.