Many Pies

Many Pies

Friday, November 25, 2011

Blackbaud NetCommunity redirect to previous page after login

After I put on the Blackbaud forums that I knew how to do this and the third person asked for details I thought I'd better tell you all.

The scenario to use this is if, say, you have a donation page and you want to offer the option of logging in. Once the user has logged in you want them to go back to the donation page, rather than the page they would normally go to after login.

First of all grab yourself the code from Stephen Morley to parse query strings (the bit after a ? in a URL). Create a document library on some sort of test page on your site and upload it.

Then create a formatted text and images part and put this in it:


Things to modify:

  • Your website domain
  • Set the id of the login page in the loginPageId variable at the top.
  • Put the id of that page in the loginHomePageId variable that you want them to go to when they log in through some other route (where you don't want them to go back to the previous page).
  • Put the id of the document you uploaded instead of "10" in this bit /NetCommunity/Document.Doc?id=10
  • Make sure that the function name runit3 is unique amongst all your javascript parts, otherwise change it.
Once you've done those modification you create a new page and put this part into it. Configure the login part to go to this new page after login.

You'll notice that I look for where the id of the previous page is 1. This is for a link we used to have at the top of every page on our site, but's no longer there. It had the srcid as 1 so we could track how many people clicked on that link in our analytics reports. I kept the code just in case.

No comments: