Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- My install activation hook:
- function mouldings_activate() {
- global $wpdb, $mouldings_options;
- if( false == get_option( 'mouldings_settings' ) ) {
- $mouldings_options = array(
- 'img_base64_enable' => '1',
- 'moulding_combination_page' => '',
- 'moulding_collection_page' => '',
- 'idea_gallery_thumb_height' => '200',
- 'idea_gallery_thumb_width' => '200',
- 'collection_thumb_height' => '200',
- 'collection_thumb_width' => '200',
- 'profile_item_columns' => '4',
- 'idea_item_columns' => '2',
- 'collections_item_columns' => '2',
- 'combinations_item_columns' => '4',
- 'profile_element_order' => array(
- 'Option 1',
- 'Option 2',
- 'Option 3',
- 'Option 4',
- 'Option 5'
- )
- );
- update_option( 'mouldings_settings', $mouldings_options );
- }
- }
- register_activation_hook( MOULDINGS_PLUGIN_FILE, 'mouldings_activate' );
- mouldings_settings output (in wp_options table):
- a:12:{s:17:"img_base64_enable";s:1:"1";s:25:"moulding_combination_page";s:0:"";s:24:"moulding_collection_page";s:0:"";s:25:"idea_gallery_thumb_height";s:3:"200";s:24:"idea_gallery_thumb_width";s:3:"200";s:23:"collection_thumb_height";s:3:"200";s:22:"collection_thumb_width";s:3:"200";s:20:"profile_item_columns";s:1:"4";s:17:"idea_item_columns";s:1:"2";s:24:"collections_item_columns";s:1:"2";s:25:"combinations_item_columns";s:1:"4";s:21:"profile_element_order";a:5:{i:0;s:8:"Option 1";i:1;s:8:"Option 2";i:2;s:8:"Option 3";i:3;s:8:"Option 4";i:4;s:8:"Option 5";}}
- Trying to get value of 'profile_element_order' in table list:
- $count = 0;
- foreach($mouldings_options['profile_element_order'] as $key => $item) :
- echo '<tr id="list_items_' . $key . '" class="list_item">';
- echo '<td>' . $item . '</td>';
- echo '<td>' . $count . '</td>';
- echo '</tr>';
- $count++;
- endforeach;
- Getting this error: Notice: Undefined index: profile_element_order in /wp-content/plugins/mouldings/includes/plugin-settings.php on line 234 (which is the foreach call)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement