Forum

Thread tagged as: Question, Addons

Showing the members app login form in a template

I have a template that I need to show the login form for them to access it. The way the page is laid out I need it to be in the intro.html content template. The only example I see is in the provided php files. Can the form be displayed in an html template?

David Powell

David Powell 0 points

  • 9 months ago
Drew McLellan

Drew McLellan 2603 points
Perch Support

Yes, you should be able to put a form into your template. What problem are you running into?

The documentation is extremely limited. The only example of placing a form on the page is i the "index.php" that comes with it. However, I need it as a tag. Something like <perch:members form="login" />

Drew McLellan

Drew McLellan 2603 points
Perch Support

You can reference the default template

perch/addons/apps/perch_members/templates/members/login/login_form.html

The members app comes with default templates that you can copy and play around with. I would try to paste the default login form into your template and edit it to fit in with your page:

<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>

More info: https://docs.grabaperch.com/addons/members/examples/registration/#registration-form-templates

Drew beat me by 13 seconds ):

Thanks for point this out. I did't know those were there.