Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
Hello all!
My site is a pay-to-play site.
The public can get to index.php, but beyond that they must register then pay using the paypal button.
Knowing that some will bail upon payment, only to come back later to pay, is there a way to, upon login, instead of saying "Account is disabled", can I just direct them to the paypal.php page I've created?
My code below has code in it that works to redirect a level10 user to a separate page, so I thought I'd give a shot to another way, but this doesn't work (comments show).

Code: Select all
  <cms:if k_logged_in >
       
                <!-- 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:process_logout />
                <cms:else /> 
                   
                    <cms:redirect 'daily.php' />
                </cms:if>[code][/code]
           
            <cms:else />
               
                <!-- show the login form -->
                <h1>Login</h1>
               
                <cms:form method='post' name='login' anchor='1'>
                    <cms:if k_success >
                        <!--
                            The 'process_login' tag below expects fields named
                            'k_user_name', 'k_user_pwd' and (optionally) 'k_user_remember', 'k_cookie_test'
                            in the form
                        -->
                        <cms:process_login redirect='0' />
                            <cms:if k_success>
                                <cms:php>
                                    global $AUTH, $CTX;
                                    $CTX->set( 'my_user_access_level', $AUTH->user->access_level, 'global' ); <!-- THIS WORKS-->
                                    $CTX->set( 'my_user_disabled', $AUTH->user->disabled, 'global' ); <!-- WHAT I'M TRYING BUT NOT WORKING-->
                                </cms:php>
                             <cms:if my_user_disabled='1'> <!-- WHAT I'M TRYING BUT NOT WORKING-->
                                   <cms:redirect 'paypal.php' />
                                </cms:if>
                                <cms:if my_user_access_level='10'> <!-- THIS WORKS-->
                                    <cms:redirect "<cms:show k_admin_link /><cms:show k_admin_page />" />
                                <cms:else />
                                    <cms:redirect k_site_link />
                                </cms:if>
                            </cms:if>
                       
                       </cms:if>
                   
                    <cms:if k_error >
                        <h3><font color='red'><cms:show k_error /></font></h3>
                    </cms:if>
                   



any help would be greatly appreciated.
Hi,

You'll need to place that check in k_error block (as opposed to k_success as you are doing right now - for disabled account the login always fails).

Here is one way of doing it (modification done to your existing k_error block) -
Code: Select all
<cms:if k_error>
    <cms:if k_error='Account disabled'>
        <cms:redirect "<cms:link 'paypal.php' />" />
    </cms:if>
   
    <h3><font color='red'><cms:show k_error /></font></h3>
</cms:if>

Hope this helps.
this is great stuff! works like a charm! Thanks KK!
3 posts Page 1 of 1