Ardnived
Ardnived

Reputation: 75

URL: Include a parameter inside a destination query

I've searched a lot to try and solve this problem, but I'm not quite sure what to search for. I didn't really manage to find anything.

Essentially I'm working on a website in which users can register for an event. However, if the user is not logged in, I need to redirect them to the registration screen. This much I've been able to accomplish without much difficulty. However I need to redirect back to the event that they attempted to register for.

My real problem is that the URL of the page I need to return to contains an a parameter, and I'm not sure how to make the registration page take that parameter into account when it redirects back.


Currently when an anonymous user tries to go to

http://[...].com/drupal/?q=civicrm/event/register&id=6

I have it redirect you to

http://[...].com/drupal/?q=user/register&destination=civicrm/event/register&id=6

However, once the form is submitted the "&id=6" is not taken as part of the destination parameter, which means you just go to.

http://[...].com/drupal/?q=civicrm/event/register

Which is not a valid page.

Is there a way for me make the destination parameter include "&id=6"?

On a whim I've also tried.

[...]destination='civicrm/event/register&id=6'
[...]destination="civicrm/event/register&id=6"
[...]destination=civicrm/event/register#id=6

Upvotes: 1

Views: 4084

Answers (1)

Heather Gaye
Heather Gaye

Reputation: 1118

You need to url-encode the value for your destination. Try this:

[..]destination=civicrm/event/register%3Fid%3D6

%3F is hex code for question mark (?), %3D is code for equals (=).

Upvotes: 4

Related Questions