Documentation

Member Pages

Overview

Member pages are all the pages your members interact with on your site. They include registration and login forms and password protected pages.

You'll find sample member pages in the /frontdesk/app/templates folder:

/frontdesk/app/templates/register.php
/frontdesk/app/templates/register_paypal_single.php
/frontdesk/app/templates/register_paypal_subscription.php

/frontdesk/app/templates/login.php
/frontdesk/app/templates/find.php

/frontdesk/app/templates/members/protected.php
/frontdesk/app/templates/members/profile.php
/frontdesk/app/templates/members/logout.php

Two important notes:

Registration

You can add accounts for members from the control panel, or they can sign up for themselves using one of your registration forms.

register.php lets users sign up for an account free of charge.

Users can sign up and submit a one-time payment or make recurring payments using register_paypal_single.php and register_paypal_subscription.php.

Note: You'll notice that the two PayPal registration forms contain hidden PayPal-specific fields that determine the details of the transaction (e.g., how much the user should be charged, how often they should be re-billed, etc.).

(More details on PayPal registration forms here.)

Always add the following lines to the top of the page your registration form is on:

<?php
$action = 'ss';
require $_SERVER['DOCUMENT_ROOT'] . '/frontdesk/app/frontdesk.php';
extract(get_response());
?>

Following are fields that must be included on every registration form:

<form method="post" action="/frontdesk/app/frontdesk.php">
Username<br />
<input type="text" name="username" value="" /><br />
Password<br />
<input type="password" name="password_1" /><br />
Re-enter password<br />
<input type="password" name="password_2" /><br />
<input type="hidden" name="url_to_this_page" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />
<input type="hidden" name="url_to_response" value="URL GOES HERE" />
<input type="hidden" name="a" value="aam" />
<input type="submit" value="Create my account" />
</form>

The registration form field options follow:

a
Type: hidden
This is the action the form performs. Always set it to "aam" for regular registration forms; set it to "pps" for PayPal forms.
allow_renewals
Type: hidden
Set this field to "yes" if you want members to be able to renew their account.
custom_0x
Type: hidden or text
Use custom fields (e.g., custom_01, custom_02, custom_03, ..., custom_20) to collect and store additional account information.
days
Type: hidden
Number of days accounts should remain active
email
Type: text
Email address
password_1
Type: password
Users enter their password here.
password_2
Type: password
Users enter their password again to confirm it.
register_with_email
Type: hidden
Set this to "yes" if you want members to log in with their email address instead of a username. Leave the "username" field off your registration form.
required
Type: hidden
Enter the fields you want users to always fill in; separate them with a comma. An example: Set this to "name, email" to require users to provide their name and email address.
subscriber
Type: checkbox or hidden
Set this field to "yes". Use it to let users subscribe to the emails you send from the "Email Members" page in the control panel.
url_to_response
Type: hidden
Enter the URL of the page you want members sent to after they complete the form.
url_to_this_page
Type: hidden
Enter the URL of the registration form so Frontdesk can re-display it if an error occurs.
username
Type: text
The username the user wants to... use

Login

Members use your login form to gain access to your password protected pages.

Always add the following lines to the top of the page your login form is on:

<?php
check_token($_SERVER['REQUEST_URI']);
extract(get_response());
?>

Take note of the line that begins with check_token. Frontdesk will automatically replace the PHP code here with the URL to the page the user was trying to access before they were redirected to the login form.

Here's a sample login form:

<form method="post" action="/frontdesk/app/frontdesk.php">
Username<br />
<input type="text" name="username" value="" /><br />
Password<br />
<input type="text" name="password" value="" /><br />
<input type="hidden" name="url_to_this_page" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />
<input type="hidden" name="url_to_response" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />
<input type="hidden" name="a" value="sim" />
<input type="submit" value="Sign in" />
</form>

Login form field options follow:

a
Type: hidden
This is the action the form performs. Set it to "sim".
email
Type: text
The member's email address. Only add this field to your form if you set up your registration form to allow users to register with their email address via the register_with_email field. The sign_in_with_email field below is also required.
password
Type: password
The member's password
remember_me
Type: checkbox
Set this to "yes" to allow members to remain logged in indefinitely on the computer they're using.
sign_in_with_email
Type: hidden
When set to "yes", members can sign in with their email address. Replace the username field on your form with the email field above.
url_to_response
Type: hidden
Enter the URL of the page you want members sent to after they log in.
url_to_this_page
Type: hidden
Enter the URL of the login form so Frontdesk can re-display it if an error occurs.
username
Type: text
The member's username

Find password

If a member forgets their password, they can look it up using your "find password" form. Members enter the email address they signed up with and Frontdesk emails them their password.

Always add the following lines to the top of the page your "find password" form is on:

<?php
$action = 'ss';
require $_SERVER['DOCUMENT_ROOT'] . '/frontdesk/app/frontdesk.php';
extract(get_response());
?>

Here's code for a "find password" form:

<form method="post" action="/frontdesk/app/frontdesk.php">
Email<br />
<input type="text" name="email" value="" /><br />
<input type="hidden" name="url_to_this_page" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />
<input type="hidden" name="url_to_response" value="URL GOES HERE" />
<input type="hidden" name="a" value="fp" />
<input type="submit" value="Send my password" />
</form>

Field definitions follow:

a
Type: hidden
This is the action the form performs. Set it to "fp".
email
Type: text
Members enter the email address associated with their account.
url_to_response
Type: hidden
Enter the URL of the page you want members sent to after they complete the form.
url_to_this_page
Type: hidden
Enter the URL of the "find password" form so Frontdesk can re-display it if an error occurs.

Protected page

protected.php is a sample password protected page.

The following lines should appear at the top of each of your protected pages:

Note: This applies only when you manually password protect a page. When you password protect a directory from the control panel, Frontdesk protects all the pages inside without making changes to them.

<?php
$action = 'ss';
require $_SERVER['DOCUMENT_ROOT'] . '/frontdesk/app/frontdesk.php';
if (! check_signed_in()) {
  require $_SERVER['DOCUMENT_ROOT'] . '/frontdesk/app/templates/login.php';
  exit;
}
?>

You can display a member's account information from the database by adding the following line to your password protected pages, before the ?> line:

extract(get_the_profile());

After adding the line, you can show the member's username or any other information from the database on the page you're working with. Here's an example:

Welcome, <?php echo $first_name; ?>!

Frontdesk will automatically replace $first_name the member's first name:

Welcome, Jenni!

Following are all the database field names you can use:

Profile

Members can view and update their account information from the profile page.

Copy and paste the the code below to the top of any profile page you create:

<?php
$action = 'ss';
require $_SERVER['DOCUMENT_ROOT'] . '/frontdesk/app/frontdesk.php';
if (! check_signed_in()) {
  require $_SERVER['DOCUMENT_ROOT'] . '/frontdesk/app/templates/login.php';
  exit;
}
extract(get_response(1));
?>

An example profile form:

<form method="post" action="/frontdesk/app/frontdesk.php">
Name<br />
<input type="text" name="name" value="" /><br />
Email<br />
<input type="text" name="email" value="" /><br />
Username<br />
<input type="text" name="username" value="" /><br />
New password<br />
<input type="password" name="password_1" /><br />
Re-enter new password<br />
<input type="password" name="password_2" /><br />
<input type="hidden" name="required" value="username, name, email" />
<input type="hidden" name="url_to_this_page" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />
<input type="hidden" name="url_to_response" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />
<input type="hidden" name="a" value="ep" />
<input type="submit" value="Save changes" />
</form>

Profile form field options follow:

a
Type: hidden
This is the action the form performs. Always set it to "ep".
custom_0x
Type: hidden or text
Use custom fields (e.g., custom_01, custom_02, custom_03, ..., custom_20) to collect and store additional account information.
email
Type: text
Email address
password_1
Type: password
Users enter a password here to change their current password.
password_2
Type: password
Users re-enter their new password to confirm it.
required
Type: hidden
Enter the fields you want users to always fill in; separate them with a comma. An example: Set this to "name, email" to require users to provide their name and email address.
subscriber
Type: checkbox
Set this field to "yes". Use it to let users subscribe or unsubscribe from the emails you send from the "Email Members" page in the control panel.
url_to_response
Type: hidden
Enter the URL of the page you want members sent to after they update their profile.
url_to_this_page
Type: hidden
Enter the URL of the profile page so Frontdesk can re-display it if an error occurs.
username
Type: text
The member's username. If you include this field on your profile form, always include it in the "required" fields list.

Logout

When members click on to your logout page, Frontdesk ends their session and redirects them to the page of your choice.

Paste the following code to the top of any logout page you create:

<?php
$action = 'ss';
require $_SERVER['DOCUMENT_ROOT'] . '/frontdesk/app/frontdesk.php';
sign_out('/');
?>