Creating a User Profile

Last edit: Aug 16, 2019
  • Contributors:
  • pavelloz
  • Slashek

This guide will help you create User Profiles for your platformOS site.

For the sake of the tutorials in this section, we will assume that you want to build a marketplace which connects Developers (who build marketplaces) with Clients (who want to hire them). In order to display a different UI based on their role in the marketplace, you will create two profiles: developer and client.

Requirements

To follow the steps in this tutorial, you should be familiar with the required directory structure for your codebase, and understand the concept of users.

Steps

Creating a User Profile is a two-step process:

Step 1: Create yml file

Create two yml files for the two User Profiles (developer and client) in the app/user_profile_types directory. Name the files developer.yml and client.yml.

Step 2: Edit User Profile

app/user_profile_types/developer.yml

name: developer
properties:
  - name: enabled
    type: boolean
  - name: bio
    type: string
  - name: years_of_experience
    type: integer
  - name: hourly_rate
    type: float

Explanation:

  • name: the most important setting. Its snake case version is used in many places like Form and GraphQL.
  • properties: the heart of User Profiles, that allow you to specify Properties for the User Profile. They are used to build customized forms that gather user input during registration for later display. They take an array of elements that consist of name and type. To learn more, check our full Properties documentation.

Similarly, add content to the client.yml User Profile:

name: client
properties:
  - name: enabled
    type: boolean

Save your User Profiles.

Next steps

Congratulations! You have created User Profiles. Now you can create a sign-up form:

Questions?

We are always happy to help with any questions you may have.