Firstly, what do you mean by a āset periodā? 30 days after signing up? Or two weeks after purchasing a product or a plan? Or on a specific date like 25th December?
Given on what your āset periodā is, you will either have to set up an automation or write a background cron job which:
Calculates the period and filters out members who match that criteria.
Then using the unassignBadge() function, pass the Badge ID and the ID of all the members that you want to remove the badge for.
Thank you for your reply. I speak French, so Iāll translate into English.
In Automation, I want to implement the following process:
Form submitted ā badge issued to the user ā 2-minute delay (for testing, for example) ā badge removed.
The problem is that it gets stuck at the last step: thereās no way in Automation to remove a badge, except by using Velo code. Thatās precisely where it doesnāt work. I tried using ChatGPT (https://chatgpt.com/share/6950dfcb-2e0c-8000-ae02-ebc2f6d038be) to help, but I canāt configure that part correctly.
Thatās correct. Automations is indeed missing an āUnassign Badgeā function. So now the only way to do this is through code, by using the function I pointed out above. All you need to do is hardcode the ID of the badge that you want to remove. If you can provide the ID of that badge, I can help you out with the code.
Thank you for your reply. Here is the ID of the badge in question. As previously mentioned, I would like the badge to be automatically removed from each person who has it, for example, 2 minutes after it is issued.
Please note that each member may receive the badge at a different time; therefore, removal must be managed individually for each user.
Finally, click on the Publish button on the top right corner to publish your automation.
Now your membersā badges will be removed automatically after the delay that youāve set.
The automation will run individually for each user signup so yes the badge will be removed independently for each user after the set delay even if they are logged out or inactive.
Note:
To ensure this works perfectly, make sure thereās no other code, event hook or automation that will interfere with this. If you have added the code that was suggested by ChatGPT which did not work, Iād recommend that you either disable it by commenting the code, or remove it completely.