Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('wcfmmp_store_list_after_store_info', function($store_id) {
- $wcfmmp_addition_info_fields = wcfm_get_option( 'wcfmvm_registration_custom_fields', array() );
- if( empty( $wcfmmp_addition_info_fields ) ) return;
- $has_addition_field = false;
- if( !empty( $wcfmmp_addition_info_fields ) ) {
- foreach( $wcfmmp_addition_info_fields as $wcfmvm_registration_custom_field ) {
- if( !isset( $wcfmvm_registration_custom_field['enable'] ) ) continue;
- if( !$wcfmvm_registration_custom_field['label'] ) continue;
- $has_addition_field = true;
- break;
- }
- }
- if( !$has_addition_field ) return;
- $wcfmvm_custom_infos = (array) get_user_meta( $store_id, 'wcfmvm_custom_infos', true );
- if( !empty( $wcfmmp_addition_info_fields ) ) {
- $label = 'DOB';
- $name = sanitize_title( $label );
- $field = $wcfmvm_custom_infos[$name] ?? '';
- if($field) {
- $age = DateTime::createFromFormat('d/m/Y', $field);
- $currentDate = new DateTime();
- echo '<p class="store-phone"><i class="wcfmfa fa-birthday-cake" aria-hidden="true"></i> Age: ' . $currentDate->diff($age)->y . ' years</p>';
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement