/**
  * Auto setup settings.
  *
  * Fires after a membership setup is completed.
  * This hook is executed every time a new membership is created.
  *
  * Related Action Hooks:
  * - ms_controller_membership_setup_completed
  *
  * @since  1.0.0
  *
  * @param MS_Model_Membership $membership
  */
 public function auto_setup_settings($membership)
 {
     $settings = $this->get_model();
     // Create special pages.
     MS_Model_Pages::create_missing_pages();
     $pg_prot_cont = MS_Model_Pages::get_page(MS_Model_Pages::MS_PAGE_PROTECTED_CONTENT);
     $pg_acco = MS_Model_Pages::get_page(MS_Model_Pages::MS_PAGE_ACCOUNT);
     $pg_regi = MS_Model_Pages::get_page(MS_Model_Pages::MS_PAGE_REGISTER);
     $pg_regi_comp = MS_Model_Pages::get_page(MS_Model_Pages::MS_PAGE_REG_COMPLETE);
     $pg_memb = MS_Model_Pages::get_page(MS_Model_Pages::MS_PAGE_MEMBERSHIPS);
     // Publish special pages.
     // Tip: Only pages must be published that are added to the menu.
     wp_publish_post($pg_acco->ID);
     if (!$membership->private) {
         wp_publish_post($pg_memb->ID);
         wp_publish_post($pg_regi->ID);
     }
     // Create new WordPress menu-items.
     MS_Model_Pages::create_menu(MS_Model_Pages::MS_PAGE_ACCOUNT);
     if (!$membership->private) {
         MS_Model_Pages::create_menu(MS_Model_Pages::MS_PAGE_MEMBERSHIPS);
         MS_Model_Pages::create_menu(MS_Model_Pages::MS_PAGE_REGISTER);
     }
     // Enable Membership2.
     $settings->plugin_enabled = true;
     $settings->save();
     // Enable the "Allow user registration" setting of WordPress
     MS_Model_Member::allow_registration();
 }