The WS Form User Management add-on can be used to create a login form for WordPress. Sometimes it can be helpful to redirect the user back to the referring page after a successful login. This tutorial explains how to modify the included Login form template so that it redirects to the referring page after a user logs in.
Enabling Referrer Tracking
The #tracking_referrer
variable returns the URL of the page user visited before arriving at the current page. It can be placed in the URL setting of the Redirect action on the login page to return the user back to where they were after logging in.