I have seen a few examples of how to do it for checkboxes on the forums but they all seem to create the checkboxes on the fly using the gform_pre_render hook. My situation seems to be a bit different as I already have the checkbox with all the fields created and all I want to do is to check the boxes based on the values in the database. The data is contained in the post meta and when I use the following code it checks only the first value encountered...
add_filter('gform_field_value_postmeta_community_amenities', create_function("", '$value = populate_postmeta(\'community_amenities\'); return $value;' ));
function populate_postmeta($meta_key){
$postID = '469';
$value = get_post_meta($postID, $meta_key, true);
return $value;
}
Any ideas on what am I doing wrong?