Forum
Members Login Action?
I'm a little confused on the setup for the Perch Members app. The documentation doesn't seem to explain the "sign in" procedure.
I have the perch_members_login_form(); login script on my website, which displays the generic login form.
When I input my credentials, nothing happens. I noticed that the form template contains not "action". It just states the following?
<perch:member logged-in="true">
<p>Hi <perch:member id="first_name" />, you are logged in</p>
<perch:else:member />
<perch:form id="login" method="post" app="perch_members">
<fieldset>
<legend>Log in</legend>
<perch:error for="all" type="login">
<p class="error">Those details do not match our records.</p>
</perch:error>
<div>
<perch:label for="email">Email</perch:label>
<perch:input type="email" id="email" required="true" label="Email" />
<perch:error for="email" type="required">Required</perch:error>
<perch:error for="email" type="format">Check format of address</perch:error>
</div>
<div>
<perch:label for="password">Password</perch:label>
<perch:input type="password" id="password" required="true" label="Password" />
<perch:error for="password" type="required">Required</perch:error>
</div>
<div>
<perch:input type="submit" id="submit" value="Log in" />
<perch:input type="hidden" id="r" />
<p>Forgotten your password? <a href="/members/reset.php">Reset it now</a>.</p>
</div>
</fieldset>
</perch:form>
</perch:member>
The form doesn't even display error messages. It does nothing.
Is there a PHP file that we can modify to do something after the user logs in? Like bring them to another page?
If you don't set an action, the implicit action is the URL of the current page. You can set one explicitly if you wish - it's the same
action
attribute.Hi Matthew
Like much of Perch, you do need to set that all up yourself. Perch doesn't assume one way of doing things so leaves it up to you to decide how it should work.
The documentation for apps is admittedly a bit confusing, because it is spread across different sections and they are not linked together.
There are a bunch of page functions available to you, as well as template tags.
You need to check if a member is logged in. You can do this with a conditional. If they are, do something. If not, do something else, just like the default template shows you.
You could then elaborate on this by redirecting the user before the page loads. For example, upon reaching a checkout page with Perch Shop:
While you are working on a dev site, it might be a good idea to add a conditional that outputs the member's logged in state into the header of the page.
And, as the King of Siam once said, et cetera, et cetera, et cetera…
Best of luck,
Jon
Hi Matthew,
You could also check the Perch Nest demo website to see how a Perch website could be built. https://github.com/PerchCMS/perchdemo-nest/blob/master/public_html/perch/templates/pages/members/members_area.php
Hey Guys!
I got the login working. Thanks for all of the input.
I have another issue that I'll start another thread on.
Cheers, Matt