Process Flow: User Login & Registration
This document outlines the process flow for user registration and login, detailing how the system handles B2B roles and permissions.
1. User Registration Flow
The registration process is designed to assign new users to the correct B2B role (institution or user type) from the outset.
Trigger: A new user fills out the registration form on the website.
sequenceDiagram participant User participant Frontend participant GravityForms as "Gravity Forms" participant EdgePlugin as "EDGE Store Plugin" participant WordPress User->>Frontend: Fills out registration form Frontend->>GravityForms: Submits form data EdgePlugin->>GravityForms: Filters available roles in dropdown GravityForms-->>EdgePlugin: Processes form submission EdgePlugin->>WordPress: Assigns selected role to new user WordPress-->>User: Sends welcome email with password reset link
Step-by-Step Breakdown:
- Form Provider: The registration form is powered by the Gravity Forms plugin.
- Role Selection: The form contains a dropdown field for the user to select their institution or role (e.g., “Student”, “Lecturer”, “Bookstore”).
- Dynamic Filtering: The EDGE Store plugin dynamically filters this dropdown to only show roles that are configured to allow self-registration. This prevents users from signing up for restricted roles.
- Role Assignment: When the form is submitted, the plugin intercepts the data and ensures that the selected role is assigned to the new user account created in WordPress.
- Student Access Control: A special rule applies to users in “Student” roles. If their role is not yet activated for registration (a manual setting), they will be able to create an account, but they will not be able to see any products in the store until their access is enabled.
2. User Login Flow
The login process primarily handles redirects, as the user’s role and permissions are already set.
Trigger: An existing user logs into their account.
Step-by-Step Breakdown:
- Login: The user enters their credentials on the standard WooCommerce login page.
- Role Recognition: WordPress recognizes the user’s assigned role (e.g.,
role_2685991000000102861). - Content Visibility: The EDGE Store plugin, in conjunction with a visibility control plugin, filters the product catalog. The user will only see the products that are associated with their specific pricelist (role) in Zoho.
- Pricing: The plugin applies the correct pricing for the user based on their role.
- Redirects: The plugin handles any necessary redirects after login, for example, sending a user to a specific course page if they were trying to access it before logging in.