Added as a feature request per discussion in http://drupal.org/node/view/5066. Need generic method to set and get referrer out of user's session.

CommentFileSizeAuthor
#3 dries.referrer-session.patch4.35 KBdries

Comments

patman’s picture

Project: Feature » Drupal core
Component: Code » base system

doh! put this request in the wrong category! Added per discussion in http://drupal.org/node/view/5066. Need generic method to set and get referrer out of user's session.

Anonymous’s picture

PHP provides mechanism to set and get from a session. It is the $_SESSION superglobal. I propose that this 'referer' save happen at the bottom of includes\common.inc

dries’s picture

StatusFileSize
new4.35 KB

I created a patch for this. We could use it to fix a login bug (implemented by the patch) and to redirect the user to the referring page after saving a node (implemented by the patch). In the latter, the referring page can be a user page (node/view/nid), the overview page at the administration section (admin/node), the book outline (book/view/nid), the book administration pages (admin/node/book/nid), and so on. However, the problem with using drupal_goto() is that status messages are lost ...

moshe weitzman’s picture

This patch was applied, and I don't think we've made matters better. I often open multiple windows coming off of the tracker page. Then I respond to those threads which interest me. After I post my comment, I am often showed the wrong page, because my referer is wrong. According to #drupal, this is a frequent occurrence. Not just me.

I propsoe we always show the node/view or comment/view page after editing. Most authors like to see their post after submitting it. This is reassuring.

If we must have different pages afetr editing a node/comment, then let the function which calls node_form() specify a destination in a hidden field.

dries’s picture

I second that the patch is not working properly in its current state and that we need to implement and test and alternative solution.

gábor hojtsy’s picture

I also experience strange behaviour since this patch got accepted. If the referer needs to be remembered, than it should be in a hidden form field, as it was with the user login... That should be reverted and the node module should do similar referer handling IMHO.

dries’s picture

The patch was never committed to HEAD. I only wrote and shared it for testing purpose. The problem with using a hidden form field (like the user module's login block does now) is that it does not play nice with Drupal's cache. That is, using a hidden form is buggy.

gábor hojtsy’s picture

Doh, if this patch was not accepted in HEAD, then I experience something else when getting redirected to various unrelated places after submitting forms... I will look into it later...

moshe weitzman’s picture

Closing this item in favor of this similar issue