Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
Hi KK

I am using member module in profile.php use this code
Code: Select all
  <!-- this is secured page. login first to access it -->
    <cms:if k_member_logged_out >
        <cms:redirect "<../index.php>" />
    </cms:if>

    <form  class="login">
    <a class="login-submit" href="<cms:member_logout_link />">Logout</a> 
<form>


the above code working fine in my local server, but when I use this in a public server and trying to logout, its cant logged out (redirect to index.php). there was no error message displaying. after processing it still stay on profile.php.

How do I fix it?


Thanks
Subhamoy
Hmmm....

This part doesn't look right:
<cms:redirect "<../index.php>" />

Shouldn't it be:
<cms:redirect "../index.php" />

Or maybe:
<cms:redirect "<cms:link masterpage='index.php'/>" />
Thank you so much...@tim, for your response.

I tried

<cms:redirect "../index.php" /> and <cms:redirect "<cms:link masterpage='index.php'/>" />
both are working fine on local server, but still not working in a public server.
@subhamoy, can you please PM me the access creds (FTP+Couch) for your site?
Also let me know precisely how to elicit the problem (i.e. which template and what action).

Thanks.
@subhamoy, I had a look at your site.

The problem is not in the part of the code you were pointing to.
It actually stems from the logout link -
Code: Select all
<a class="login-submit" href="<cms:member_logout_link />">Logout</a> 

The link above points to 'members/login.php' template which is then supposed to process the logout.

Instead, your ''members/login.php' template (actually the embedded 'login2.php' within it) has the following -
Code: Select all
<cms:if "<cms:not k_member_logged_in />" >

    <!-- not logged-in. Prompt for creds -->
    .. shows login form ..
   
<cms:else />
    <!-- we have a logged-in member -->   

    <cms:redirect url="<cms:link 'members/profile.php' />" />
</cms:if>

Your code, instead of processing the logout, simply redirects the logged-in user back to the profile page.

You need to amend it (as shown in the sample members code) to become
Code: Select all
<cms:if "<cms:not k_member_logged_in />" >

    <!-- not logged-in. Prompt for creds -->
    .. shows login form ..
   
<cms:else />
    <!-- we have a logged-in member -->   

    <!-- this 'login' template also handles 'logout' requests. Check if this is so -->
    <cms:set action="<cms:gpc 'act' method='get'/>" />

    <cms:if action='logout' >
        <cms:member_process_logout />
    <cms:else /> 
        <!-- what is an already logged-in member doing on the login page? Send back to homepage. -->
        <cms:redirect k_site_link />
    </cms:if>
</cms:if>

Hope it helps.
Thanks KK for the trouble shoot.

By mistake I upload wrong (login.php) file on public server.
Now I upload the correct (login.php) and its working fine..


Thank and thanks again


Subhamoy
6 posts Page 1 of 1