Forum

Thread tagged as: Problem, Error, Add-on-development

Members App - Logged Out

Hi guys,

This one is really frustrating me :(

I keep getting logged out every time i change page. I guess this is something to do with me using the forms in different places. It seemed fine when i used the /members folder but I have changed the layout of the forms a little and put the login and registration in a different place and now I can't stay logged in.

I have this set up here - https://murphynet.co.uk/recipes/

Username - test@test.com Password - test123

If anyone would be able to help me out it would be greatly appreciated.

Thanks, Martin

Martin Murphy

Martin Murphy 0 points

  • 6 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

You'll need to give us more information about what you have actually done to set this up, show us your code etc. otherwise we'll just be making guesses which could take a while!

Ok well so far all I have done is installed the app and I am using the app in a directory called /recipes and my index page looks like this:

<?php
include('../perch/runtime.php');
?><?php 
$page = 'recipes';
include('../inc/html.php'); 
?>

        <?php include('../inc/navigation.php'); ?>

        <div class="featured_area full-width">
            <div class="grid grid-pad">
                <div class="col-1-1">
                    <div class="logo_holder_services">
                        <img src="<?php echo $root; ?>img/logo.png" alt="My Logo">
                        <h1>My Recipes</h1>
                    </div>
                </div>
            </div>
        </div>

        <div class="grid grid-pad qual_holder">

            <?php if(perch_member_logged_in()) : ?>

                <p>You are now logged in | <a href="<?php perch_member_log_out(); ?>">Logout</a></p>

            <?php else : ?>

                <p>Welcome to my recipes page. I spend a lot of time experimenting and creating great recipes for people like you to enjoy. Each recipe gives you detailed ingredients and explains how to make each thing. I am more than happy to be sharing these recipes free of charge, however as a contributution all I ask is that you register to my site. If you have already registered then please login. Once you have logged in or registered then you will be able to view this page in full. If you don't have an account already then please <a href="register.php">register here</a>.<p>

                <?php perch_members_login_form(); ?>

            <?php endif; ?>

        </div>

<?php include('../inc/footer.php'); ?>

And my login form looks like this:

<div class="col-1-1" id="tabs-1">
    <div class="form">
        <perch:form id="login" method="post" app="perch_members">

            <h1>Login</h1>

            <perch:error for="all" type="login">
                <p>Those details did not match our records.</p>
            </perch:error>

            <p>
                <perch:input type="email" id="email" required="true" placeholder="Email" />
                <perch:error for="email" type="required">Email address is required.</perch:error>
                <perch:error for="email" type="format">Check the format of your email address.</perch:error>
            </p>

            <p>
                <perch:input type="password" id="password" required="true" placeholder="Password" />
                <perch:error for="password" type="required">Password is required.</perch:error>
            </p>

            <p>Forgotten your password? <a href="reset.php">Reset it now</a>.</p>

            <perch:input type="submit" id="submit" value="Login" />
            <perch:input type="hidden" id="r" />

        </perch:form>
    </div>
</div>

My templates are currently stored here - /perch/templates/members/login

I have also made a new registration form but I haven't had any issues with that.

If you need anymore information then let me know :)

Martin

Drew McLellan

Drew McLellan 2638 points
Perch Support

perch_member_log_out() will log you out. It does not output a link to a log out page.

Eugh..

Thanks Drew, sorry for that, ye why I didn't notice the logout.php file in the members folder...

Apologies, but thanks haha! It works now -_-

Martin