Schoelje (@schoelje)

Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)

  • Schoelje
    Participant

    @schoelje

    Hi senatorman,

    My apologies for the late reply. I haven’t looked at this for quite some time and I haven’t tested it on any other situation/environment than my own.

    If you still need it: I usually use phpMyAdmin to export data to a csv file.


    Schoelje
    Participant

    @schoelje

    Glad you found it useful and thanks for posting back your code.


    Schoelje
    Participant

    @schoelje

    Note: else if should be elseif.
    It still works, though.

    How do I set this topic to resolved?


    Schoelje
    Participant

    @schoelje

    It took some time to make this topic visible on the forum. So, I’ve solved my own problem.

    Instead of writing an htacces file I chose to write an alternative viewtopic.php script that collects the appropriate new bbPress URL from the database.

    If your new bbPress forum is online, you place the following script in your old phpBB domain and save it as viewtopic.php (exactly where the old viewtopic.php used to be located) and don’t forget to replace the “my_xxxx” values with your information:

    <?php
      // If all else fails, use this url.
      $defaulturl = "http://my_domain/forums/";
      
      // Your new bbPress database credentials.
      $host = "my_host";
      $db = "my_database";
      $dbuser ="my_database_user";
      $userpwd = "my_database_user_password";
      
      // Build the query according to url parameters p or t.
      $query = '';
      if (!empty($_GET['p'])) {
          $query = "SELECT xkcom_posts.guid FROM xkcom_postmeta 
                    INNER JOIN xkcom_posts ON xkcom_posts.ID = xkcom_postmeta.post_id 
                    WHERE xkcom_postmeta.meta_key = '_bbp_old_reply_id' 
                    AND xkcom_postmeta.meta_value = '" . $_GET['p'] . "';";
      }else if (!empty($_GET['t'])) {
          $query = "SELECT xkcom_posts.guid FROM xkcom_postmeta 
                    INNER JOIN xkcom_posts ON xkcom_posts.ID = xkcom_postmeta.post_id 
                    WHERE xkcom_postmeta.meta_key = '_bbp_old_topic_id' 
                    AND xkcom_postmeta.meta_value = '" . $_GET['t'] . "';";
      }
      
      // Set the new url to the default url
      $url = $defaulturl;
      
      // Check if we need to make a database connection.
      if (!empty($query)) {
        // Make a connection
        $mysqli = new mysqli($host, $dbuser, $userpwd, $db);
        
        // Check the connection.
        if (!$mysqli->connect_errno) {
          // Run the query.
          $result = $mysqli->query($query);
          
          // Get the new URL.
          if ($result) {
    	$row = $result->fetch_array(MYSQLI_ASSOC);
    	$guid = trim($row["guid"]);
    	if (!empty($guid)) {
    	  $url = $guid;
    	}
          }
    
          // Free the result set.
          $result->free();
    
          // Close the connection.
          $mysqli->close();
        }
      }
      
      //var_dump($url);
      
      // Write the header.
      header("Location: " . $url, true, 301);
    ?>

    Schoelje
    Participant

    @schoelje

    I’ve imported phpBB 3.1.9 into bbPress 2.6 alpha without problems.
    I suggest you to create a development machine if you haven’t done so already and give it a try.


    Schoelje
    Participant

    @schoelje

    You’ll need bbPress 2.6: https://bbpress.org/download/


    Schoelje
    Participant

    @schoelje

    In the sp_cleanup_replies and sp_cleanup_topics stored procedures you’ll find “dev.solydxk.com”.
    Obviously, you need to change that to the development domain you’re working on.

    It seems I cannot edit my own OPs 🙁

Viewing 7 replies - 1 through 7 (of 7 total)