예제 #1
0
  static function import() {
    $did_import_old_team = false;
    if (isset($_GET['import']) && $_GET['import'] == 'true') {
      OurTeam::import_old_team();
      $did_import_old_team = true;
    }
    if (OurTeam::has_old_team_table()):
    ?>

      <h2>Team Directory Import</h2>
      <p>
        This tool is provided to import team from an older version of this plugin.
        This will copy old team members over to the new format, but it is advised
        that you backup your database before proceeding. Chances are you won't need
        it, but it's always better to be safe than sorry! WordPress provides some
        <a href="https://codex.wordpress.org/Backing_Up_Your_Database" target="_blank">instructions</a>
        on how to backup your database.
      </p>

      <p>
        Once you're ready to proceed, simply use the button below to import old
        team members to the newer version of the plugin.
      </p>

      <p>
        <a href="<?php echo get_admin_url(); ?>edit.php?post_type=team&page=team-directory-import&import=true" class="button button-primary">Import Old Team</a>
      </p>

    <?php else: ?>

      <?php if ($did_import_old_team): ?>

        <div class="updated">
          <p>
            Old team was successfully imported! You can <a href="<?php echo get_admin_url(); ?>edit.php?post_type=team">view all team here</a>.
          </p>
        </div>

      <?php else: ?>

        <p>
          It doesn't look like you have any team members from an older version of the plugin. You're good to go!
        </p>

      <?php endif; ?>

    <?php

    endif;
  }