n my theme I put a link like this for an anonymous user: http://www.mysite.com/user/login?destination=node/add/image&edit[myvar]=190

This should redirect the user to the login-page and after the login to the add/image page, where he can post an image. Furthermore this should provide the information to the add/image page, that the variable myvar has the value '190'.

Well, the redirect works fine and I am getting to the add/image page after login. But the part &edit[myvar]=190 gets lost.

Is this a bug in Drupal or am I doing something wrong? Perhaps the syntax isn't correct?

After several hours of searching I am a little bit desolate now.

The link http://www.mysite.com/node/add/image?&edit[myvar]=190 (for already logged in users) works fine and the part &edit[myvar]=190 is provided.

Hope, someone can help.

Comments

ainigma32’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

smitty’s picture

Version: 5.3 » 5.14
Status: Closed (fixed) » Active

Hi Arie,

you are right: your proposed syntax the 'edit[myvar]=190' is not lost any more.

But that's only because the syntax for the query is now broken and so the 'myvar' not stored in the $_GET-variable and the whole mechanism is not working any more.

Does anybody have a better suggestion?

ainigma32’s picture

Status: Active » Postponed (maintainer needs more info)

@smitty: Did you ever figure this out?

- Arie

ainigma32’s picture

Status: Postponed (maintainer needs more info) » Fixed

Looks like smitty won't be posting any feedback so I'm setting this to fixed.

Feel free to reopen if you think that is wrong.

- Arie

smitty’s picture

Status: Fixed » Active

I'm still waiting for a solution.

ainigma32’s picture

Title: Edit-part gets lost, when redirectig after Login » Edit-part gets lost, when redirecting after Login
Status: Active » Postponed (maintainer needs more info)

Rereading the issue I realised I don't understand what you are saying in #3

Anyway maybe this post http://drupal.org/node/70067 and the accompanying API docs http://api.drupal.org/api/function/arg/6 will spark a new idea ...

If not please explain in more detail what you are trying to do with the myvar variable.

- Arie

ainigma32’s picture

Status: Postponed (maintainer needs more info) » Fixed

Looks like smitty won't be posting any feedback so I'm setting this to fixed .. again ;-)

Feel free to reopen if you think that is wrong.

- Arie

smitty’s picture

Hi Arie,

might it be, that you are a little bit impatient? This issue is from 01/2008 and nobody had an answer for me till now. But you expect me to answer to your posting within a few days.

I’ve had a hack in the core for this issue, so it was not as urgent as in January 08 any more. But I wanted to get this fixed “in the right way”.

As a result of the hints in your posting I examined the problem again and found that I did the programming based on the query-functionality. So the url-variable normally was handed over by the attribute $query of the function l(), which resulted in the following link-syntax: http://www.mysite.com/node/add/image?&edit[myvar]=190.

Now I did some experiments and found, that the ‘$edit’ was not necessary, resulting in $query = ‘myvar=190’, and as a result of this: http://www.mysite.com/node/add/image?myvar=190.

For a not registered user the result was: http://www.mysite.com/user/login?destination=node/add/image?myvar=190, witch also worked fine.

But it did not work for http://www.mysite.com/user/register?destination=node/add/image?myvar=190, because after the registration a 403-error page is displayed and in function drupal_access_denied() (common.inc) only the $_GET[‘q’] variable is handed over but not the the $_GET[‘myvar’].

So I decided to dispense with the query-mechanism ant put everything into the ‘q’-string.
Now I use the l() function without the $query-parameter and put everything into the $path-parameter, which changes from $path = ‘node/add/image’ to $path = ‘node/add/image/myvar/190’. Instead of accessing $_GET[‘myvar’] inside the module I do everything with the arg()-function now.

This seems to work for the logged in user as well as for the not registered user (still testing).

I hope this helps other drupallers having the same problem.

nobody1225’s picture

Version: 5.14 » 5.1
Assigned: Unassigned » nobody1225
Status: Fixed » Active

Does anybody know a solution?

ff1’s picture

Version: 5.1 » 7.x-dev
Component: user system » base system

This functionality is handled by http://api.drupal.org/api/function/drupal_get_destination

Maybe there's a way to include the entire contents of $_GET instead of just the 'q' variable.

jhodgdon’s picture

Status: Active » Closed (duplicate)

This is a bug report, not a support request, actually.

There's another issue that is already working on a patch, so I'm going to close this one as a duplicate of
#158159: drupal_get_destination() doesn't work with queries

jhodgdon’s picture

Category: support » bug