Is there a way to check if a custom field exists? E.g. if Birthday field not empty, show div on website, and otherwise show nothing.
Thanks in advance
Is there a way to check if a custom field exists? E.g. if Birthday field not empty, show div on website, and otherwise show nothing.
Thanks in advance
Hey Boris
Thatโs not possible with native Memberstack, but Iโll add it to our roadmap for you. How important would you say this feature is to you?
[Feedback sent to roadmap]
Hi Duncan,
thanks for getting back at me
I would say this would be a really handy feature, because you could condition content blocks based on custom fields input, which allows further personalization of dashboards and member pages.
Actually, I made it work with some script, so it is already possible.
On userโs dashboard, I just added an empty text field, with id=user-birthday with the following attribute: ms-data=birthday.
In the footer code, I run a small script to check if the #user-birthday id is empty.
If it is, I show them a DIV #user-without-birthday.
If it is not, I show them a DIV #user-with-birthday.
<script>
$(document).ready(function(){
if( $('#user-birthday').is(':empty') ) {
$("#user-without-birthday").show();
$("#user-with-birthday").hide();
} else {
$("#user-without-birthday").hide();
$("#user-with-birthday").show();
}
});
</script>