If custom field exists

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 :slight_smile:

Hey Boris :wave:

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?

:triangular_flag_on_post::triangular_flag_on_post: [Feedback sent to roadmap] :triangular_flag_on_post::triangular_flag_on_post:

Hi Duncan,

thanks for getting back at me :slight_smile:

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>

:partying_face:

1 Like