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.

CommentFileSizeAuthor
#2 anonymous_login-2261567-2.patch746 bytesspesic

Comments

spesic’s picture

Status: Needs review » Active
spesic’s picture

StatusFileSize
new746 bytes

The proposed solution is to replace $path logic at the redirect with drupal_get_destination()

spesic’s picture

Status: Active » Needs review

  • Commit 508a2ea on 7.x-1.x authored by spesic, committed by mstef:
    Fix GET parameters being lost during redirect. [#2261567]
    
mstef’s picture

Status: Needs review » Fixed

Thanks 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.

Status: Fixed » Closed (fixed)

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