Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UNDEFINED OFFSET MESSAGE WHEN USING USER CREATED ARRAY AT RUN TIME #371

Open
rogerad opened this issue Oct 17, 2016 · 1 comment
Open

UNDEFINED OFFSET MESSAGE WHEN USING USER CREATED ARRAY AT RUN TIME #371

rogerad opened this issue Oct 17, 2016 · 1 comment

Comments

@rogerad
Copy link

rogerad commented Oct 17, 2016

SEE PREVOUS POST

I CAN ADD THE ITEMS INTO THE ARRAY CORRECTLY NOW BUT WHEN THERE ARE MORE THAN 10 ITEMS , THE 10 TH ITEM AND LATER IS AN UNDEFINED OFFSET MESSAGE
EG ERROR MESSAGE ON THESE LINES

'10' => $option_wp_roles_string[10],
'11' => $option_wp_roles_string[11],
'12' => $option_wp_roles_string[12],
'13' => $option_wp_roles_string[13],

THE MESSAGE DOES NOT APPEAR ON ALL MY COMPUTERS ONLY ON 1 OF THEM

Notice: Undefined offset: 12 in C:\xampp\apps\wordpress\htdocs\wp-content\plugins\40mtest\40mtest.php on line 288

THESE LINES BELOW ARE PERFECT
$aa_panel->createOption( array(
'name' => 'User Role Access',
'id' => 'aa_general_role',
'type' => 'multicheck',
'desc' => 'Which User Roles have Access to website - Administrators always have access',
'options' => array(
// '1' => $option_wp_roles_string[0],
'1' => $option_wp_roles_string[1],
'2' => $option_wp_roles_string[2],

@brandbrilliance
Copy link

brandbrilliance commented Feb 7, 2017

undefined offset is generated when you try to access an array with an invalid index, so the problem is that the array "$option_wp_roles_string" doesn't actually have 10-13 items. Perhaps you can generate the options automagically using a function above and then simply include them like so:]
'options' => $my_generated_options,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants