Background
We have set up a navigation bar to include this:
<A HREF="<%db_cgi_url%>/page.cgi?page=Users&user=<%Username%>">Personal Page</A> /
<A HREF="<%db_cgi_url%>/user.cgi?logout=1&d=0">Logout</A>
<%else%>
<A HREF="<%db_cgi_url%>/user.cgi">Login</A> /
<A HREF="<%db_cgi_url%>/user.cgi?logout=1">Logout</A>
<%endif%>
The Pagebuilder User pages are dynamic-only and restricted to Registered Users.
Dynamic mode is an option available to users after they have logged in, so if Username has a value, the user must be logged in, and be browsing in dynamic mode -- page.cgi?page=Users&user=<%Username%> opens a Pagebuilder page with information and links to everything the user can do.
The problem is how to do the same thing in static pages -- how to generate a 'Users' link with no argument (page.cgi?page=Users) that will
* Open the correct (dynamic) Pagebuilder User page if the user is logged in.
* Open the login page if the the user is not logged in.
Right now, this is what happens when page.cgi?page=Users has no argument ...
* If the user is logged in, we get an error "No page identification specified"
* If the user is not logged in, it opens the login page, but after submitting the form, the user is still not logged in, even though LSQL creates a new session.
Hoped-for Outcome
Static page navigation bar that looks like this ...
... a single button for logging in, or opening the personal user page if already logged in.
What we have tried
We created a dummy user called null, and put this in our static navigation bar ...
<A HREF="<%db_cgi_url%>/user.cgi?logout=1">Logout</A>That allows logged-in users to get to their own personal pages, but it doesn't solve the second problem -- they can't actually log in that way.
The alternative static navigation bar ...
<A HREF="<%db_cgi_url%>/user.cgi">Login</A> /
<A HREF="<%db_cgi_url%>/user.cgi?logout=1">Logout</A>... would be unthinkably bad usability.
Perhaps we should be thinking about an intermediate (server-side) step, so that the 'Users' button would either pass Username to page.cgi?page=Users, or if there were no Username, go straight to the login page.
My mind has gone blank on this one. Perhaps somebody else has already solved it?
A closely-related theme
Our login_success page has a link to the Pagebuilder user page. We would prefer to go straight to the user page. Is this possible?
We have set up a navigation bar to include this:
Code:
<%if Username%> <A HREF="<%db_cgi_url%>/page.cgi?page=Users&user=<%Username%>">Personal Page</A> /
<A HREF="<%db_cgi_url%>/user.cgi?logout=1&d=0">Logout</A>
<%else%>
<A HREF="<%db_cgi_url%>/user.cgi">Login</A> /
<A HREF="<%db_cgi_url%>/user.cgi?logout=1">Logout</A>
<%endif%>
The Pagebuilder User pages are dynamic-only and restricted to Registered Users.
Dynamic mode is an option available to users after they have logged in, so if Username has a value, the user must be logged in, and be browsing in dynamic mode -- page.cgi?page=Users&user=<%Username%> opens a Pagebuilder page with information and links to everything the user can do.
The problem is how to do the same thing in static pages -- how to generate a 'Users' link with no argument (page.cgi?page=Users) that will
* Open the correct (dynamic) Pagebuilder User page if the user is logged in.
* Open the login page if the the user is not logged in.
Right now, this is what happens when page.cgi?page=Users has no argument ...
* If the user is logged in, we get an error "No page identification specified"
* If the user is not logged in, it opens the login page, but after submitting the form, the user is still not logged in, even though LSQL creates a new session.
Hoped-for Outcome
Static page navigation bar that looks like this ...
Code:
... Users / Logout ...What we have tried
We created a dummy user called null, and put this in our static navigation bar ...
Code:
<A HREF="<%db_cgi_url%>/page.cgi?page=Users&user=null">Users</A> / <A HREF="<%db_cgi_url%>/user.cgi?logout=1">Logout</A>
The alternative static navigation bar ...
Code:
<A HREF="<%db_cgi_url%>/page.cgi?page=Users&user=null">Users</A> / <A HREF="<%db_cgi_url%>/user.cgi">Login</A> /
<A HREF="<%db_cgi_url%>/user.cgi?logout=1">Logout</A>
Perhaps we should be thinking about an intermediate (server-side) step, so that the 'Users' button would either pass Username to page.cgi?page=Users, or if there were no Username, go straight to the login page.
My mind has gone blank on this one. Perhaps somebody else has already solved it?
A closely-related theme
Our login_success page has a link to the Pagebuilder user page. We would prefer to go straight to the user page. Is this possible?