Hello @thebusinesscat
Conditional logic is for users to see only fields they need to see, at this time we don’t have a way to hide the field data on admin side but we will definitely look into this for future versions.
@thebusinesscat
Is there a way to hide fields that are shown as “empty” on the email that is sent to the admin?
Yes, you can try this code snippet which is removing lines
with <span>(empty)</span> in the outgoing emails.
add_filter( 'wp_mail', 'custom_email_um_remove_empty', 10, 1 );
function custom_email_um_remove_empty( $args ) {
$message_lines = explode( '<p>', $args['message'] );
$new_message = array();
foreach( $message_lines as $message_line ) {
if ( ! strpos( $message_line, '<span>' . __( '(empty)', 'ultimate-member' ) . '</span>' )) {
$new_message[] = $message_line;
}
}
$args['message'] = implode( '<p>', $new_message );
return $args;
}
Install by adding the code snippet to your active theme’s functions.php file
or use the “Code Snippets” Plugin
https://ww.wp.xz.cn/plugins/code-snippets/
Hi @missveronicatv,
Thank you so much, this works as expected.
I have now realised that there are dropdowns with default values, so this shows in the email to admin as it is not seen as an empty field because of the default values. Well, that’s what I assume. I don’t suppose there is a way to hide the fields based on the user’s choice.
Here is my scenario. In the first field of the form, a user must select whether they are an individual or a company, and then based on these two choices certain fields will display. The email/username and password fields do not have conditional logic and will display no matter their choice in the first field.
Please let me know if this is possible and thank you for all your help so far. I really appreciate it.
@thebusinesscat
A possible solution with two multi-select dropdowns in UM Settings
with all the Registration form fields by meta_key and label
where you exclude fields for the individual and company Registrations.
Excluded fields will be “(empty)” and the code snippet will remove them.
Hi @missveronicatv,
Thank you for your quick reply.
Sorry if I am misuderstanding, but how do you exclude fields? I only see Show and Hide.
Thank you.