Redirecting from login to a specific web page for CiviCRM

Have you ever wanted to redirect website users when they login to a specific page? Maybe you want to show different rates for logged-in members for an event or service or you may have sent an email to members and you want them to visit a specific form.

In Drupal this can be easily done using a destination parameter:

"www.myorganisation.com/user/login?destination=node/1"

[If you want to know the what page node is simply edit the page and the node will show up in the URL bar]

You can also redirect to CiviCRM pages with a bit of extra work. CiviCRM adds other parameters into the url, so we need to rewrite those parameters as HTML so that they can be followed. So if you want to redirect to a contribution page, the ? needs to be rewritten as %3F and the & as %26

So, what would normally be: "www.myorganisation.comcivicrm/contribute/transact?reset=1&id=3 would become www.myorganisation.com/civicrm/contribute/transact%3Freset=1%26id=3"

So the full destination rewrite would be:

www.myorganisation.com/user/login?destination=civicrm/contribute/transac...

Easy!

You can see the full list of HTML url encoding references here: https://www.w3schools.com/tags/ref_urlencode.asp

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.