0

On my Drupal 7 site, I am using the Prepopulate module to pre-fill a field based on a parameter in the URL for authenticated users.

An example of a URL is:

http://website.com/node/add/content-type?edit[field_test][value]=123456

When accessing the URL as an anonymous user, Context shows the login block.

After logging in, it redirects the user back the same URL BUT without the prepopulate info.

Simply something like:

http://website.com/node/add/content-type

Is there anything that can be done so that the information in the URL is not lost after logging in?

1

You can use a destination parameter in URL to retain those values. There is a good read on drupal.org (https://www.drupal.org/docs/7/theming/overriding-themable-output/how-to-add-a-destinationurl-to-the-request-new-password)

Let me know if you need any help.

0

I have found a solution.

Instead of the following URL that was posted originally:

http://website.com/node/add/content-type?edit[field_test][value]=123456

I will send the User to the Login Page but with the Destination paramater set to that URL so that it retains the prepopulate data.

This is an example url:

http://website.com/user/login?destination=node/add/content-type?edit[field_test][value]=123456

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.