This guide explains how to use the new user update trigger in the Discourse Automation plugin to create posts when users update their profiles.
Required user level: Administrator
The Discourse Automation plugin includes a trigger for the Create Posts script. This trigger allows you to automatically create posts in a specified topic when a user updates their profile, provided certain conditions are met.
Setting up the automation
- Navigate to
example.discourse.com/admin/plugins/automationin your Discourse instance. - Click on āNew automationā.
- Select āCreate postā as the script.
- Choose āAfter user updateā as the trigger.
Configuration options
User custom fields and User profile fields
Specify which fields need to be filled by the user before the script runs after a profile update. You can choose either custom fields, profile fields, or both.
Note: At least one of āUser custom fieldsā or āUser profile fieldsā must be specified. The automation will only trigger once the user has filled in all of the specified fields.
Once per user
Enable this option to limit the automation to triggering only once per user. After the automation has fired for a given user, it will not fire again for that user on subsequent profile updates.
New users only
Enable this option to restrict the automation to only fire for users who joined after the automation was enabled. This is useful for welcome/introduction post workflows where you donāt want existing users to trigger the automation.
Creator
You can choose to have the post created by:
- A specific user
- The system user (default if no creator is specified)
- The user who triggered the automation (i.e., the user who updated their profile)
Using placeholders
You can use placeholders in your post content to include information from the userās profile. The following built-in placeholders are available:
-
%%USERNAME%%ā the username of the user who updated their profile -
%%NAME%%ā the full name of the user who updated their profile -
%%UPDATED_USER_USERNAME%%ā same as%%USERNAME%% -
%%UPDATED_USER_NAME%%ā same as%%NAME%% -
%%CREATOR_USERNAME%%ā the username of the post creator
In addition, any user profile fields or user custom fields you specify in the trigger configuration become available as placeholders. For example, if the user profile field ālocationā is specified, %%LOCATION%% becomes available. Custom field names are converted to uppercase with spaces replaced by underscores.
Hereās an example:
Welcome to our community, @%%USERNAME%%!
We're excited to have you join us from %%LOCATION%%.
Tell us more about your interest in %%CUSTOM_FIELD_1%%!
Note: Placeholders must be in all caps and surrounded by %%. Any placeholder that isnāt required in the triggerās āUser custom fieldsā or āUser profile fieldsā may not be replaced if the user hasnāt filled in that information.
Testing the automation
You can test the automation using your own profile:
- Set up the automation as described above.
- Update your user profile, filling in the fields you specified in the trigger.
- Save your profile changes.
- Check the designated topic to see if the automated post was created.
Remember that the action is triggered when the user saves their profile, but only runs according to the trigger conditions youāve set.
Troubleshooting
If you encounter issues:
- Ensure that at least one of āUser custom fieldsā or āUser profile fieldsā is configured in the trigger ā both cannot be left blank.
- Double-check that the field names in your configuration match exactly with the custom fields or profile fields defined in your Discourse instance.
- Verify that the placeholders in your post content are correctly defined and match the expected format (e.g.,
%%LOCATION%%for the ālocationā profile field). - If using āOnce per userā, note that the automation tracks which users have already triggered it. A user who has already triggered the automation will not trigger it again.
- If using āNew users onlyā, ensure the user account was created after the automation was enabled.
Additional considerations
- Performance: If you have a large number of users with frequent profile updates, monitor system resources to ensure the automation doesnāt impact performance.
- User permissions: Ensure that the automation uses an account with sufficient privileges to create posts in the specified topic.
- Closed/archived topics: The automation will not create posts in topics that are closed or archived.
Last edited by @hugh 2024-07-26T02:13:12Z
Last checked by @hugh 2024-07-26T02:13:19Z
Check document
Perform check on document:




