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
Comment #1
ainigma32 commentedI think http://www.mysite.com/user/login?destination=node/add/image/edit[myvar]/190 should work
- Arie
Comment #3
smitty commentedHi 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?
Comment #4
ainigma32 commented@smitty: Did you ever figure this out?
- Arie
Comment #5
ainigma32 commentedLooks 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
Comment #6
smitty commentedI'm still waiting for a solution.
Comment #7
ainigma32 commentedRereading 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
Comment #8
ainigma32 commentedLooks 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
Comment #9
smitty commentedHi 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.
Comment #10
nobody1225 commentedDoes anybody know a solution?
Comment #11
ff1 commentedThis 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.
Comment #12
jhodgdonThis 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
Comment #13
jhodgdon