Wed Oct 26 12:24:45 2005

Ticket #1505 (Closed: fixed)

Documention of <!** if user > seems wrong


Priority: normal Reporter: john
Severity: minor Assigned to: mugur
Component: Template Engine Status: closed
Version: 2.3.2 Resolution: fixed
Milestone: 2.3.3 Keywords:  

Description by john:

I'm changing the description of this one because my understanding has changed...

From the documentation:

<!** if user defined> -- the if condition is true if user is defined
(user cookie exists); this doesn't necessary mean that the user is 
properly logged in
<!** if user loggedin> -- the if condition is true if user is 
properly logged in

It appears to me that 'if user defined' is true if the user is logged in EITHER BY IP ADDRESS OR BY COOKIE.

On the other hand, it appears to me that 'if user loggedin' ONLY gives true if the user is logged in by COOKIE.

My vote for how this *should* work:

    • <!** if user loggedin>: user is logged in either by IP access or cookie.
    • <!** if user ipaccess>: user is logged in by IP access
    • <!** if user defined>: username is know because of old cookie, but has not entered password. Useful for showing 'welcome back' message.

Changelog

Wed Oct 26 15:36:22 2005: Modified by paul

  • milestone changed from 2.4.0 to 2.3.3

Wed Oct 26 15:45:27 2005: Modified by john

    FYI...

    <div class="userinfo">
    <!** if user loggedin>
    	<p class="opt"><b>Logged in – <!** Print user uname></b></p>
    	<p class="opt"><a href="<!** URI issue template usermodify.tpl>">Modify user information</a>
    	<p class="opt"><a href="<!** URI issue template userchgpass.tpl>">Change password</a>
    	<p class="opt"><a href="<!** URI issue template logout.tpl>">Logout</a>
    <!** else>
    	<!** if user defined>
    		<p class="opt">Your are not logged in. Login <a href="<!** URI template login.tpl>">here</a>
    	<!** else>
    		<p class="opt"><b>Subscribe to Fastnews</b></p>
    		<p class="opt">Fastnews is supported by paying subscribers. Some content, labelled <img src="/look/fastnews/subscriber.png" width=11 height=11" alt="[S]">, will only be open to you if you havea  subscription</p>
    		<p class="opt"><a href="<!** URI template useradd.tpl>&SubsType=trial">Free trial subscription</a></p>
    		<p class="opt"><a href="<!** URI template useradd.tpl>&SubsType=paid">Buy a full subscription</a></p>
    		<p class="opt">Existing subscribers <a href="<!** URI template login.tpl>">login here</a>
    	<!** endif>
    <!** endif>
    </div>
    

    Wed Oct 26 15:56:51 2005: Modified by john

    • description changed.
    • summary changed from <!** if user defined > doesn't behave as expected for IP-address based users to Documention of <!** if user > seems wrong

    Wed Oct 26 15:58:52 2005: Modified by john

    • description changed.

    Thu Oct 27 13:20:38 2005: Modified by mugur

    • resolution set to fixed
    • status changed from new to closed

    The statement "If User" DOES work like this:

      • <!** if user loggedin>: user is logged in either by IP access or cookie.
      • <!** if user defined>: username is know because of old cookie, but has not entered password. Useful for showing 'welcome back' message.

    I updated the manual.

    Thu Oct 27 16:19:43 2005: Modified by john

    • resolution cleared
    • status changed from closed to reopened

    I think there's still a bug, Mugur. With my user 'jdpipe' on campsite.jdpipe.dyndns.org, which is my RPM campsite-2.3.2-4.i386.rpm, and accessing through the IP-based subscription 127.0.0.1, I used the following template:

    <div class="userinfo">
    <!** if user loggedin>
    	<p class="opt"><b>Logged in – <!** Print user uname></b></p>
    	<p class="opt"><a href="<!** URI issue template usermodify.tpl>">
    		Modify user information</a>
    	<p class="opt"><a href="<!** URI issue template userchgpass.tpl>">
    		Change password</a>
    	<p class="opt"><a href="<!** URI issue template logout.tpl>">
    		Logout</a>
    <!** else>
    	<!** if user defined>
    		<p class="opt">Your are not logged in. 
    		Login <a href="<!** URI template login.tpl>">here</a>
    	<!** else>
    		<p class="opt"><b>Subscribe to Fastnews</b></p>
    		<p class="opt">Fastnews is supported by paying subscribers. 
    		Some content, labelled 
    		<img src="/look/fastnews/subscriber.png" width=11 height=11" alt="[S]">,
    		will only be open to you if you havea  subscription</p>
    		<p class="opt">
    		<a href="<!** URI template useradd.tpl>&SubsType=trial">
    			Free trial subscription</a></p>
    		<p class="opt">
    		<a href="<!** URI template useradd.tpl>&SubsType=paid">
    			Buy a full subscription</a></p>
    		<p class="opt">Existing subscribers 
    		<a href="<!** URI template login.tpl>">
    			login here</a>
    	<!** endif>
    <!** endif>
    </div>
    

    gave the result:

    Your are not logged in. Login here
    

    (woops, spelling). But template

    <!-- ARTICLE -->
    <script language="JavaScript">
    var cs_pub = '<!** print publication identifier>';
    var cs_iss = '<!** print issue number>';
    var cs_sec = '<!** print section number>';
    var cs_art = '<!** print article number>';
    var cs_sub = '<!** print subtitle name>';
    var cs_usr = '<!** print user identifier>';
    var cs_tpc = '<!** print topic identifier>';
    </script>
    

    gave cs_usr = 3, so I AM logged in, and all the articles are visible to me.

    Maybe I've missed something but it looks to me as though it's not working.

    Thu Oct 27 21:03:00 2005: Modified by paul

    • status changed from reopened to new
    • owner changed from anonymous to mugur

    Fri Oct 28 13:28:29 2005: Modified by mugur

    • resolution set to fixed
    • status changed from new to closed