VCF file comes out empty by default
-
I’m running your plugin and would only get empty VCF files. Looking at the Apache error log, I could see an error:
[Sun Mar 12 21:58:08.539576 2017] [:error] [pid 629] [client x.x.x.x:58684] PHP Warning: Invalid argument supplied for foreach() in /.../wp-content/plugins/team-vcard-generator/includes/single-team_member.php on line 403
I looked at the code and it assumes that
$dia[1]
is an array.I protected that
foreach()
loop with anif()
so it would not fail there and the result is that I get the VCF files. I suppose, however, that the loop should work but maybe it was$dia[0]
instead?In any event, that is probably not the fix, but it gets me going.
if(is_array($dia[1])) { $cuenta_horarios = count($dia[1]); foreach ($dia[1] as $numero => $hora) { if (($numero + 1) == $cuenta_horarios) { $horas.="<span>" . $dia[1][$numero] . "-" . $dia[2][$numero] . "</span></td>"; } else { $horas.="<span>" . $dia[1][$numero] . "-" . $dia[2][$numero] . "</span> "; } } }
- The topic ‘VCF file comes out empty by default’ is closed to new replies.