I would like to ask for help with creating a code that I will insert into a code snippet for this function or situation.
I have a paid seller who renews his membership every month. In the attributes I have a condition that certain seller attributes (email, phone, facebook, instagram) will only be displayed if he pays the membership fee every month.
I need help with the situation if the membership fee is not paid. The seller’s profile will remain displayed, but the contact details should not be displayed (this situation motivates him to pay the membership fee regularly, every 30 days). If visitors do not see his contacts, they cannot call and write to him and arrange the performance of the service.
I found out that the plugin does not have a function that would prohibit the display of the contact attribute (which I have limited). If the seller does not pay the membership fee, the phone, email … are still displayed.
Please can you help me with this by editing the code that would prohibit it from being displayed:
At the moment, when there is no active Membership plan or the plan has expired, the phone field will be replaced with an empty space:
$fields[ $field_name ]['display_template'] = '';
If needed, you can replace the empty value with a placeholder such as “Hidden” or something similar to indicate that the field exists but is not available, or keep it empty as in the original snippet.
You can also add more fields to the snippet if needed. Simply replace any_custom_field with the exact field name of the attribute you want to hide when the vendor no longer has an active plan.