[Zope-PTK] Adding 'Go back where you came from' to Membership
Michael Bernstein
mbernstein@profitscape.com
Wed, 04 Oct 2000 11:48:38 -0500
I've figured out (by examining the zope.org source) how to implement 'Go
back where you came from' functionality in Membership:
Change the loginForm method so the first <dtml-if> (up to the
<dtml-else>) reads like so:
<dtml-if "AUTHENTICATED_USER.has_role(['Member','Manager'])">
<dtml-let urlRedirect="'loggedIn?came_from='+_['came_from']" >
<dtml-call "RESPONSE.redirect(_['urlRedirect'])">
</dtml-let>
<dtml-else>
and add the following code inside the form in both loginForm and
logoutForm:
<dtml-if came_from>
<input type="hidden" name="came_from" value="&dtml-came_from;">
</dtml-if>
Then you need to add the following block to loggedIn and logoutForm
after the 'success' message:
<dtml-if came_from>
<p>You can go back where you <a href="&dtml-came_from;">came from</a>.
</dtml-if>
After you make these changes, log in links should take the form:
<A HREF="/acl_users/loginForm?came_from=&dtml-URL0;">Log in</A>
And log out out links should take the form:
<a href="/acl_users/logoutForm?came_from=&dtml-URL0;">Log out</a>
HTH, This Works For Me(tm), YMMV. Tests and enhancements are welcome.
Michael Bernstein.