Set Variable Lock
The Variable Lock condition controls gate access based on user data values. This allows you to show or hide content based on user attributes, roles, or any other variable stored in the system.
Overview
Variable Lock enables you to:
- Show content only to specific user types
- Hide content based on user attributes
- Create role-based access control
- Personalize content visibility
Enabling Variable Lock
- In the gate editor, find the Page Access Condition section
- Toggle the "Use Variable Lock" switch to enable
- Configure the condition settings
Configuration Options
| Field | Description | Example |
|---|---|---|
| Variable | The user variable to check | is-focus-person |
| Operator | How to compare values | ==, !=, >, < |
| Value | The value to compare against | true, 50, "admin" |
Selecting a Variable
- Click the Variable dropdown
- Select the variable to check
- Only non-mandatory variables appear
The dropdown shows:
- Variable name
- Variable type (boolean, number, string)
Available Operators
| Operator | Description | Use With |
|---|---|---|
== | Equal to | All types |
!= | Not equal to | All types |
> | Greater than | Numbers only |
< | Less than | Numbers only |
Setting the Comparison Value
The value input changes based on variable type:
Boolean Variables
Radio buttons for True/False selection:
Variable: is-premium-member
Operator: ==
Value: ○ True ● False
Result: Shows content only when is-premium-member is falseNumber Variables
Numeric input field:
Variable: completed-modules
Operator: >
Value: 5
Result: Shows content only when user has completed more than 5 modulesString Variables
Text input field:
Variable: user-role
Operator: ==
Value: facilitator
Result: Shows content only to users with role "facilitator"Common Use Cases
Role-Based Access
Show content only to specific roles:
Variable: user-role (string)
Operator: ==
Value: "admin"
Result: Only administrators see this contentPremium Content
Gate content behind premium status:
Variable: is-premium-member (boolean)
Operator: ==
Value: true
Result: Only premium members access this contentProgress-Based Access
Show content after reaching a milestone:
Variable: points-earned (number)
Operator: >
Value: 100
Result: Content visible after earning more than 100 pointsExclude Certain Users
Hide content from specific users:
Variable: is-focus-person (boolean)
Operator: ==
Value: false
Result: Focus persons don't see this contentStatus Display
When Variable Lock blocks access, users see:
"Blocked – condition is not met"This message appears in the configured overlay element.
Combining with Other Locks
Variable Lock works alongside other conditions:
Gate: "Premium Day 2 Content"
Time Lock: Opens +24h after start
Variable Lock: is-premium-member == true
Result: Content opens 24 hours after start,
but ONLY for premium membersAll enabled conditions must be met for the gate to open.
Variable Types and Operators
Boolean Conditions
| Condition | Meaning |
|---|---|
is-admin == true | User is an admin |
is-admin == false | User is not an admin |
is-admin != true | User is not an admin |
is-admin != false | User is an admin |
Number Conditions
| Condition | Meaning |
|---|---|
score == 100 | Score is exactly 100 |
score != 0 | Score is not zero |
score > 50 | Score is greater than 50 |
score < 75 | Score is less than 75 |
String Conditions
| Condition | Meaning |
|---|---|
role == "admin" | Role is exactly "admin" |
role != "guest" | Role is not "guest" |
status == "active" | Status is "active" |
Best Practices
Use descriptive variable names -
is-focus-personis clearer thanflag1Plan your access patterns - Map out who should see what
Test with different users - Verify access works for each user type
Document your conditions - Keep notes on what each lock controls
Keep conditions simple - Complex logic can be confusing
Troubleshooting
Variable Not Appearing in Dropdown
- Verify the variable exists in your schema
- Confirm the variable is not mandatory
- Refresh the page and try again
Gate Not Responding to Variable
- Check that the variable has a value for the user
- Verify the operator and value are correct
- Test with a user who should definitely pass/fail the condition
Unexpected Access Results
- Review the complete gate configuration
- Check if other locks are also active
- Verify the user's actual variable value in User Data
Questions?
If you have any questions, please don't hesitate to contact us. Alternatively, you can submit an issue on this platform.
Useful Links:
Add a Gate - https://help.acenji.com/#/./shared-concepts/gate-controller/add-a-gate/index Set Time Lock - https://help.acenji.com/#/./shared-concepts/gate-controller/add-a-gate/set-time-lock/index Set Precondition Lock - https://help.acenji.com/#/./shared-concepts/gate-controller/add-a-gate/set-precondition-lock/index