Advertisement
Guest User

Untitled

a guest
May 10th, 2012
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.98 KB | None | 0 0
  1. My install activation hook:
  2.  
  3. function mouldings_activate() {
  4.     global $wpdb, $mouldings_options;
  5.     if( false == get_option( 'mouldings_settings' ) ) {
  6.         $mouldings_options = array(
  7.             'img_base64_enable'         => '1',
  8.             'moulding_combination_page' => '',
  9.             'moulding_collection_page'  => '',
  10.             'idea_gallery_thumb_height' => '200',
  11.             'idea_gallery_thumb_width'  => '200',
  12.             'collection_thumb_height'   => '200',
  13.             'collection_thumb_width'    => '200',
  14.             'profile_item_columns'      => '4',
  15.             'idea_item_columns'         => '2',
  16.             'collections_item_columns'  => '2',
  17.             'combinations_item_columns' => '4',
  18.             'profile_element_order' => array(
  19.                 'Option 1',
  20.                 'Option 2',
  21.                 'Option 3',
  22.                 'Option 4',
  23.                 'Option 5'
  24.             )
  25.         );
  26.         update_option( 'mouldings_settings', $mouldings_options );
  27.     }
  28. }
  29. register_activation_hook( MOULDINGS_PLUGIN_FILE, 'mouldings_activate' );
  30.  
  31. mouldings_settings output (in wp_options table):
  32.  
  33. 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";}}
  34.  
  35. Trying to get value of 'profile_element_order' in table list:
  36.  
  37. $count = 0;
  38. foreach($mouldings_options['profile_element_order'] as $key => $item) :
  39.     echo '<tr id="list_items_' . $key . '" class="list_item">';
  40.         echo '<td>' . $item . '</td>';
  41.         echo '<td>' . $count . '</td>';
  42.     echo '</tr>';
  43.     $count++;
  44. endforeach;
  45.  
  46. 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