Brief summary:
I'm am currently using anonymous_login in conjunction with entityreference_prepopulate. Module entityreference_prepopulate is using GET Query params to pre populate referenced field on node creation. These parameters are lost during the redirect as $_GET['q'] doesn't include them.
Problem Scenario:
Content type #1: Event
Content type #2: Media
Media has entity_reference field: field_event => Event
On the event page (visible to anonymous traffic) there is a link to node/add/media?field_event=NNN (where NNN is current event nid). This will pre-populate event info and hide the field so user can focus on what they are here to do (upload media from the event). Anonymous users shouldn't be able to upload media so I would like them to login and be redirected to media upload page.
Expected Result:
When anonymous user requests node/add/media?field_event=NNN, they are redirected to URL encoded user/login?destination=node/add/media%3Ffield_event%3DNNN and after login they are redirected back to node/add/media?field_event=NNN
Actual Result:
When anonymous user requests node/add/media?field_event=NNN, they are redirected to user/login?destination=node/add/media and after login they are redirected back to node/add/media - losing event info in the process.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | anonymous_login-2261567-2.patch | 746 bytes | spesic |
Comments
Comment #1
spesic commentedComment #2
spesic commentedThe proposed solution is to replace $path logic at the redirect with drupal_get_destination()
Comment #3
spesic commentedComment #5
mstef commentedThanks for the detailed report and patch. Looks good and it's been committed..
I know there was a reason why I didn't use drupal_get_destination() initially, but I can't remember why. It is needed, so it's in there now.