• Resolved g6063523

    (@g6063523)


    im putting the DOB form. However what can i put or where whether using code snippet or maybe adding. Adding a direct function. But i want users tto be 18 years or older. If they enter a date of birth thats not 18+ i want it to not allow them to continue registering until they di

Viewing 1 replies (of 1 total)
  • Plugin Author Stiofan

    (@stiofansisland)

    Hello,

    Sorry for the larte reply, please try the below code snippet which should achive what you want:

    add_filter('uwp_form_input_html_datepicker','_my_min_18_dob',15,4);
    function _my_min_18_dob($html, $field, $value, $form_type){
    	
    	if('dob'===$field->htmlvar_name){
    		$html = str_replace('data-max-date="today"','data-max-date="'.(new DateTime())->sub(new DateInterval('P18Y'))->format('Y-m-d').'"',$html);
    	}
    	return $html;
    }

    Thanks,

    Stiofan

Viewing 1 replies (of 1 total)
  • The topic ‘DOB form requirements’ is closed to new replies.