The Member Directory app allows users to log in, view a directory of members and make changes to member records based on user roles. Members can update their own profile, as well as view other member’s records. Admins can view, edit and delete member records.
In order to build a member directory app, you must activate user roles, create at least two user roles, Members and Admin, and create at least two different user pages that each role will have sole access to.
Defining User Roles
Defining your user roles is a critical part of creating a functioning member directory for your business. This will ensure that Admin roles are able to assign tasks and edit fields, while members are able to view and update their tasks in the field.
To add user roles, click the +ADD button next to the Users in your Knack builder. This will create your main Account object that will represent all the user accounts that can log in to your app regardless of their role.
Activating user logins will allow you to create pages where users can only view or edit information based on their role:
Determine which registration method you want to enable for your app. This can be done by clicking on the login form of your pages:
- Closed: When this option is chosen, users will only be able to be added to the database by an Admin with access to the builder.
- Open: Allow users to register and gain instant access to the database.
- Approval: Allow users to register and gain access once they are approved by an Admin.
Add User Roles
Now that your users have been activated, it’s time to add your user roles. For this app, we will create an Admin role and a Member role. You can click the +ADD button next to the Accounts object to create these specific, additional roles:
Add User Records
There are two ways to add records to your user roles in the Builder: manually or by importing records using a CSV file.
Manually Add User Records
User records can be manually added by pressing the +Add Record button:
Import User Records from a CSV file
User records can also be imported by uploading a CSV file:
Knack Tip: It is highly recommended that you include headers in your CSV file that will match the headers in your records. Make sure your CSV file is properly formatted before importing. Read our CSV Format Guide for Importing for more information.
Now that you have created your user roles and added your records, it’s time to put your app together by adding pages.
Add an Admin Access Page
Beyond viewing and editing member records, Admins can also add or delete members.
To get started, add a new page and require a login to access. Limit permission to the Admin user role:
Add a view for records of the Members object:
When selecting which views to add to this page, select:
- A menu linked to a form that adds a new Member.
- A table to display Members details to view more Member fields.
- A form to edit the Member.
Once the page has been added, you will need to add the ability to delete records in a table. To do this, open up the table view editor:
The delete link can be added in the columns section of the table view editor.
Add a Member Access Page
In order for Members to access and edit their Member records, you must add a Member access page. This page will require the user to login to view, and should be limited to Members. Members will be able to view and edit their records, as well as view the records of other Members.
To get started, add a new page and require a login to access. Limit permission to the Member user role:
Choose to display the records connected to the logged-in Member for this page:
Press Continue and name your new page. Once you have added your Member access page, you will need to add a table to display Member records. Add a table using the views toolbar:
This table will display Member records:
Add a link to view more details about each Member to the table:
View Your Live App
Congratulations! You’ve built your member directory. Your page should now look something like this:
Members will be able to view a table containing Member information. They will also be able to click a link to view more details about each Member. Admins will be able to view, edit and delete Member information.
- Give users the ability to login, view their own page, and access their own records by Showing Records Connected to the Logged-in User.
- Add Single Sign-On authentication to your app.
- Enable E-commerce to accept membership payments.
- Add a report that tracks how many new Members are added or registered each month.