In my ninja form , I have required field . But I want to change that required attribute if the user is not logged in . I have seen ninja form documentaion and tried as they say . Here is what I have tried .
function my_filter_function( $data, $field_id ){
if(!is_user_logged_in()){
if( $field_id == 135){
$data['req'] =0;
}
return $data;
}
}
add_filter( 'ninja_forms_field', 'my_filter_function', 10, 2 );
But it doesn't work . When I submit the form it says that field is required .