function mbdb_upgrade_to_2_0() { // set all pages with a book grid to NOT use the default values mbdb_migrate_to_book_grid_defaults(); // set up roles mbdb_set_up_roles(); // migrate post_tags to mbdb_tags mbdb_migrate_post_tags(); // insert default edition formats $mbdb_options = get_option('mbdb_options'); mbdb_insert_default_edition_formats($mbdb_options); update_option('mbdb_options', $mbdb_options); //fix retailer array imageID = image_id //mbdb_fix_retailer_array(); // update buy link images mbdb_update_retailer_images(); // update format images mbdb_update_format_images(); // update the excerpts $mbdb_books = mbdb_get_books_list('all', null, 'title', 'ASC', null, null, null); foreach ($mbdb_books as $book) { mbdb_save_excerpt($book->ID, $book); } // migrate publishers to settings mbdb_migrate_publishers(); // rewrite rules because new redirects added global $wp_rewrite; $wp_rewrite->flush_rules(); }
function mbdb_activate() { MBDB()->books->create_table(); mbdb_set_up_roles(); // insert defaults $mbdb_options = get_option('mbdb_options'); mbdb_insert_default_retailers($mbdb_options); mbdb_insert_default_formats($mbdb_options); mbdb_insert_default_edition_formats($mbdb_options); mbdb_insert_default_social_media($mbdb_options); mbdb_insert_image('coming-soon', 'coming_soon_blue.jpg', $mbdb_options); mbdb_insert_image('goodreads', 'goodreads.png', $mbdb_options); update_option('mbdb_options', $mbdb_options); // SET DEFAULT OPTIONS FOR GRID SLUGS mbdb_set_default_tax_grid_slugs(); mbdb_init(); flush_rewrite_rules(); }