I have a listing website with several custom fields. Depending if a user have a free, silver or gold membership, some custom fields are visible, some not.
I have two fields that only silver and gold membership can have access :
- Extra categories (give the users the chance to have their listing visible up to 4 more categories)
- Specialities (give the users the possibility to add some business specialities)
Both field are searchable with the main website search engine.
In the case that a user would like to cancel its membership and downgrade to a free membership, I would like those two fields emptied to make sure that we can't search their business with the extra categories and specialities.
Is it possible to add some code that empty those field when the user role go from Silver to Free or Gold to Free?
Writing such custom code that is not directly related to using our APIs is not really within the scope of our support, but let me give you some pointers.
First, how will the code be triggered? How does the downgrade from paid to free memberships happen?
If you were using a Toolset Form to edit a user, for example, then you would be able to use the cred_save_data hook to trigger the code you need to erase the custom fields.