- This topic has 1 reply, 2 voices, and was last updated 9 years, 1 month ago by
Steve.
-
AuthorPosts
-
-
November 19, 2012 at 7:05 pm #439
Daniel MénardMemberHi !
I found a bug in the way Piklist (0.6.7) handle settings when multiple tabs are used.
Steps to reproduce:
1. I go to the Piklist demo settings pages (/wp-admin/edit.php?post_type=piklist_demo&page=piklist_demo_fields) for the first time (e.g. wp_options do not contain the piklist_demo_fields key).
The first tab (Basic) shows all fields with their defaults values (lorem).2. I go on the second tab (Custom) and I click “save”.
The piklist_demo_fields key is created in wp_options and contains settings only for the second tab.3. I go back to the first tab
-> all fields are blank (e.g. they don’t show their default value).
In the html code generated for inputs, there’s no value for the value attribute (value=””).I think that the bug lies in a logic flaw in Piklist_Form::get_field_value(), on line 352:
return isset($options[$key]) ? $options[$key] : (empty($options) && isset($field['value']) ? $field['value'] : false);
The “empty($options)” condition is the culprit. In that case, it is not empty, and we return false.
The line should be:
return isset($options[$key]) ? $options[$key] : (isset($field['value']) ? $field['value'] : false);
I tested and it works, but I don’t know if this modification has side effects…
Cheers,
Daniel
-
December 13, 2012 at 12:54 pm #554
-
-
AuthorPosts
- You must be logged in to reply to this topic.