I'm having another issue in WP_DEBUG. I'm integrating an options panel from another theme into mine, so I'm having to correct the issues it has.
Here is the code...
The line giving me the error is on the $output line.
Thanks for your help.
case 'multicheck':
$multi_stored = $data[$value['id']];
foreach ($value['options'] as $key => $option) {
$of_key_string = $value['id'] . '_' . $key;
$output .= '<input type="checkbox" class="checkbox of-input" name="'.$value['id'].'['.$key.']'.'" id="'. $of_key_string .'" value="1" '. checked($multi_stored[$key], 1, false) .' /><label for="'. $of_key_string .'">'. $option .'</label><br />';
}
Erez S answers:
This should fix all of your problems:
case 'multicheck':
if(isset($value['id']) && isset($data[$value['id']]))
$multi_stored = $data[$value['id']];
if(isset($value['options'])){
foreach ($value['options'] as $key => $option) {
$of_key_string = $value['id'] . '_' . $key;
$output .= '<input type="checkbox" class="checkbox of-input" name="'.$value['id'].'['.$key.']'.'" id="'. $of_key_string .'" value="1" '. checked($multi_stored[$key], 1, false) .' /><label for="'. $of_key_string .'">'. $option .'</label><br />';
}
}
Erez S comments:
Or this:
case 'multicheck':
if(isset($value['id']) && isset($data[$value['id']]))
$multi_stored = $data[$value['id']];
if(isset($value['options'])){
foreach ($value['options'] as $key => $option) {
$of_key_string = $value['id'] . '_' . $key;
if(isset($multi_stored[$key]))
$output .= '<input type="checkbox" class="checkbox of-input" name="'.$value['id'].'['.$key.']'.'" id="'. $of_key_string .'" value="1" '. checked($multi_stored[$key], 1, false) .' /><label for="'. $of_key_string .'">'. $option .'</label><br />';
}
}
Armand Morin comments:
The second option worked perfectly.
thanks
AdamGold answers:
Again, you will need to check if everything is defined:
case 'multicheck':
if( isset($value['id']) && isset($data[value['id']]) && isset($value['options']) ) {
$multi_stored = $data[$value['id']];
foreach ($value['options'] as $key => $option) {
$of_key_string = $value['id'] . '_' . $key;
$output .= '<input type="checkbox" class="checkbox of-input" name="'.$value['id'].'['.$key.']'.'" id="'. $of_key_string .'" value="1" '. checked($multi_stored[$key], 1, false) .' /><label for="'. $of_key_string .'">'. $option .'</label><br />';
}
}