Skip to:
Content
Pages
Categories
Search
Top
Bottom

SMF Import to bbPress

  • Introduce Forum Importer template for use with importing from SMF v2.0.x(Tested on v2.0.4)

    http://codex.bbpress.org/import-forums/ & ​​http://codex.bbpress.org/import-forums/smf

    Working: Forums, Topics, Replies, Users & User Passwords
    Partial: Custom BBCode for Topic & Reply Content
    Not Working Yet: Categories

    Attached to bbPress Trac Ticket #2380 is the 1st pass patch for SMF importing into bbPress.

    To test the importer download the latest patch from the link above and copy/ftp the file into the /includes/admin/converters/ folder of your bbPress plugin.

    I hope to get the remaining outstanding items done ASAP.
    (User passwords will be a little trickier and will take a bit more time)

    Any feedback and/or testing that you can provide will help me out tremendously.

    Cheers,

    Stephen 🙂

Viewing 25 replies - 101 through 125 (of 155 total)

  • exposedplanet
    Participant

    @exposedplanet

    I just did a conversion and all went quite well. @landshark: all external images (linked within posts) are showing up here, so that seems to work.

    I wonder if there is any way to convert/transfer the attachments so that they will work as well?

    Cheers.

    I wonder if there is any way to convert/transfer the attachments so that they will work as well?

    I haven’t seen any particular effective ways to do this yet, I have a few ideas on how to add support to import the attachments into the WordPress media library but it only exists in imagination at this stage, once I get the time to take a look I most certainly will have a crack at it.


    landshark
    Participant

    @landshark

    @landshark: all external images (linked within posts) are showing up here, so that seems to work.

    Yeah I’m sure there mus be something unique about my situation that is causing the conversion to choke but I’ve run out of ideas as to how to figure it out. I was hoping for some help but alas, nothing.

    Being completely ignored for 2 weeks is frustrating to say the least.

    @landshark I wouldn’t say you were being ignored, we are all volunteers here and if and when people have the time to help others they do, myself included.

    What is the BBCode for images on your SMF forum?

    bbPress converts these default BBCode [img] to `<img src=”…”>
    [img]http://www.google.com/intl/en_ALL/images/logo.gif[/img]
    [img=http://www.google.com/intl/en_ALL/images/logo.gif]
    If you have any custom BBCodes this will not work and you could either fix this in your SMF forum before importing or if your comfortable with MySQL you could update these in your database directly.


    mlduclos
    Participant

    @mlduclos

    Hello.

    I’m trying to convert an SMF forum using the importer, but the conversion stops at some time. I’ve tried stop and start with one row per time, but the error occurs again after some rows.
    There’s any working around to it?
    My SMF is portuguese, do I need to make any change in the installation to increase successful rate?
    Thanks…!


    pooledge
    Participant

    @pooledge

    Dear Edgar, soon after Kolya fixed the issue with permalinks I tried the SMF to bbPress converter feeding him an >5K replies forum with 381 user accounts. Loaded 10 rows/sec, ran fine with no errors and here is a miss: clearly imported 380-389 users, there are only 281 of them actually imported, and a bunch of messages’ authors replaced by a key master now. Moreover, many messages are cut inconsequently, word-wide. Topics/forums qty pass confirmed. Now reset the forums and starting over, for now 380-389 imported, still 281 in /users

    Any suggestions on it?

    Thank you!
    Oleg


    pooledge
    Participant

    @pooledge

    Dear Stephen, I apologize for this inconvenience with your name =)
    It’s 241 users, not 281. And yes, I’ve tried it 3 times in a row for now with different load but same result.

    Thank you for developing the converter, it’s nearly perfect!
    Oleg

    @mlduclos See https://codex.bbpress.org/import-forums/import-troubleshooting/ for troubleshooting rows not imported, I haven’t ever tested a ‘Non English” import but I expect it should work just fine 🙂


    @pooledge
    Thanks and that is weird, do any of the imported user names have a prefix imported_ e.g. imported_pooledge? If so you’ll need to make sure you also delete any existing imported users before you try reimporting again otherwise the user ID’s will not match the imported posts.

    If they don’t have the imported_ prefix is there any common reason as to why some usernames are not imported? Do the users that are not imported have special characters, hyphens, whitespace in their username or anything else in common with each other, maybe they were all moderators or a different role on your SMF forum.


    pooledge
    Participant

    @pooledge

    Dear Stephen,

    Thank you for your response. It’s most likely because of the fact, that those usernames are written in cyrillic. Cyrillic posts and replies are fine though, only cut from time to time.
    imported_ prefix is applied to my username only, no problem with that. Conversion always starts from scratch.

    Best regards,
    O

    @pooledge Oh! That is not good and would most likely be the cause 🙁

    I just created a user Вук Стефановић Караџић (WikiPedia: Vuk Stefanović Karadžić) and indeed the user was not imported.

    A quick look around and all we need to do is sanitize the username, I’ll look to add this to bbPress Core in a future release, probably quite a few bits of testing for other language scripts.

    For now though install and activate @SergeyBiryukov‘s Allow Cyrillic Usernames WordPress plugin and these will import perfectly. 🙂

    Also added this to our codex https://codex.bbpress.org/import-forums/import-troubleshooting/#cyrillic-usernames

    Cloudup 3du0ztz2hyh

    хаве а нице даи 🙂

    Edit: This plugin is a slightly improved version allowing with better support for Cyrillic and Arabic usernames in WordPress.


    tehred
    Participant

    @tehred

    I hate to sound like a newb, but I am one when it comes to this.
    As you probably guessed, I’m trying to convert a SMF database file over to bbPress.

    I looked at the db, and it appears to be fine – I can see tons of old stuff in it. It’s about 122mb. I copied it into the same folder as the converter, and I think I had everything set up correctly, except that the converter does not appear to be finding the database. Here is what I’m seeing:

    View post on imgur.com

    All I have been able to guess is that I have the database in the wrong folder and that is why the converter is not starting?

    Any help is appreciated. Thanks!

    @ tehredThe database needs to be exported from any existing MySQL install and imported into the same MySQL server you are using for WordPress, you should be able to find details on importing and exporting MySQL databases from your webhost support or knowledgebase help sections of their website.


    Bestru
    Participant

    @bestru

    Hello,

    i’ve the same problem as tehred.

    The database from the smf forum and from the wordpress / bbpress is on the same mysql server.

    What make i wrong?


    Bestru
    Participant

    @bestru

    in the attachment are two screenshots.
    one is from wordpress
    the other is from my mysql database.

    http://epvpimg.com/FQxTe
    http://epvpimg.com/s34Pg


    tehred
    Participant

    @tehred

    @stephen, a couple things to know:
    – I am using a backup from SMF. I no longer have access to the server that SMF was installed on. I don’t know if a backup and an export are the same thing. I feel like they probably are not.

    – Assuming they are not, I am looking at instructions on how to install SMF on a temp server so I can import the backup, and then export the database.

    – Assuming I get the export done, what I feel like you are telling me is that I need to import that file into the MySQL running on the server WordPress is on. I am assuming that I create a new database to import the data into. Once that is done, i run the converter on that new database.
    – Does this convert that new database, or create a new database that has the bbPress info in it?

    @bestru Your database table name is bestru_smf and that looks correct, your table prefix does not look correct, in the screenshot you are using _smf, I think you will find it should be smf_, see this screenshot showing the table names inside my import_smf database https://cloudup.com/cTo5XoXDEBn

    @tehred Go to SMF’s website to find details on how to install SMF, you probably want to install the same version that the database backup is from (if you know it).

    You should have a MySQL database backup, typically these are named filename.sql, filename.sql.zip or filename.gz, this is an actual export of the database data rather than the actual files used as part of the website.

    You should be able to import (once you find it) that file into MySQL as a new database, then you point bbPress’ import to that database name in the import settings along with username and password and table prefix (most likely smf_).

    Once you start running the import it copies the data from your old SMF database into the WordPress database you are using with bbPress, your original SMF database is not altered in anyway, it is still best practice to make sure you have backups of your SMF and WordPress database all the same.


    Bestru
    Participant

    @bestru

    Hello,

    thanks Stephen it’s works now.

    what still bothers me is, that the text has been imported without blank and formatting.
    See the following picture with the orange box with my comments

    http://epvpimg.com/gtbRb

    @bestru Thanks, there is a minor bug in the SMF, it has been fixed for the next release.

    If you take a look at this https://bbpress.trac.wordpress.org/changeset/5332 and change that mistaken <tt> for <br> in the SMF.php file things should work just fine.

    Let me know how that goes for you 🙂


    Bestru
    Participant

    @bestru

    @netweb

    Thanks, it works 🙂

    I noticed that, the attachments from old smf board are not migrated.
    Also, the post date is displayed for two hours in the past.
    Will Private Message with imported or need i use a plugin for bbpress?
    And can i get the Avatars from the Users?

    I know many Questions :))

    If this is resolved, the import works perfectly 🙂

    @bestru, to your four questions, no, no, oh, and no 🙁

    Attachments are on the drawing board for a future release, it is a complex request because as attachments can be various file types and in particular size is the killer here, during import waiting for a file from what could be a remote source is what breaks this for us, I have a solution planned and have started testing this but at this stage it is a no go for now, avatars are also in this same boat.

    For private message you will need a plugin as bbPress does not suppoort private messages out of the box, maybe BuddyPress would do the trick for you here, I’d like to be able to import private messages as BuddyPress private messages in a furture version though.

    The post date should be accurate, you should have your WordPress install using the same timezone offset as your existing forum used and then times should match.


    DeanPnet
    Participant

    @deanpnet

    Hello all. Just a couple questions, because clearly I’m doing something wrong.

    1) Is SMF.3.php on this page the correct final revision of the file needed to import?
    https://bbpress.trac.wordpress.org/ticket/2380

    2) Is that name of SMF.3.php correct, or should I rename it to SMF.php?

    3) In what directory should I place the file?

    4) In Tools > Forums > Import Forums > Select Platform, I have SMF, SMF.2, and SMF.3 available. I want SMF.3.php correct?

    When I put SMF.3.php in /public_html/wp-content/plugins/bbpress/includes/admin/converters and select “SMF.3” as the platform in the import tool, I get this message:

    Fatal error: Class ‘SMF.3’ not found in /home/dark/public_html/wp-content/plugins/bbpress/includes/admin/converter.php on line 1475

    Would someone please set me straight on all this?


    DeanPnet
    Participant

    @deanpnet

    Disregard my previous post. I got it all figured out. Odd how that always happens as soon as you ask for help, right? 🙂


    Robin W
    Moderator

    @robin-w

    @deanpnet No problem ! Happens to me all the time !


    curvemeister
    Participant

    @curvemeister

    I want to offer this php script in exchange for the help Stephen’s script provided. It ran successfully on my installation, going from SMF 2.0.4 to bbPress 2.5.6 / GD bbPress Attachments 2.2. Most of my time is taken up with consulting, and I regret that I will not be providing much in the way of support for this script.

    This is a stand-alone php script that you must modify to target your SMF install. I suggest using notepad++ to edit for readability, and something like FileZilla to transfer your file to your host. Install and run the script in the root folder of your WordPress folder. I used Putty configured for an SSHconnection. Do not try to run it via http – the script will time out.

    Thanks to Stephen Edgar for providing the original php on which this is based.

    Mike Russell – final result at: http://www.curvemeister.com/forums
    ==============================================================================

    
    <?php
    //Standalone script to import smf attachments for the GD bbPress Attachments plugin
    //Execute after you have imported smf into bbPress
    require( 'wp-load.php' );
    require( 'wp-admin/includes/image.php' );
    
    $verbose = false;
    //$limit = " LIMIT 0,1";
    $limit = " LIMIT 0,99999";
    
    // source database connection
    $host="localhost";
    $uname="xxx";
    $pass="xxx";
    $database = "xxx";
    $site_url = 'http://xxx/forum';
    $forum_path = 'forum/attachments/';
    
    echo "start smf_attachments-to-bbpress\n"; flush();
    
    //get the attachment rows from SMF
    $smf_db = new wpdb($uname, $pass, $database, $host);
    $smf_rows = $smf_db->get_results("
    								SELECT * FROM <code>smf_attachments</code> 
    								WHERE file_hash != '' 
    									AND filename NOT LIKE '%thumb' 
    								ORDER BY <code>id_attach</code>"
    								.$limit);
    								
    echo "processing ".$smf_rows->num_rows." rows total\n";
    
    // process each row
    $count = 0;
    foreach ($smf_rows as $smf_attachment_row) {
    	if($verbose) { echo 'next row, id_attach = '.$smf_attachment_row->id_attach."\n"; flush(); }
    
    	//look for both a new and old style filename.  If neither exists, skip this attachment
    	$smf_filename = $forum_path.$smf_attachment_row->id_attach.'_'.$smf_attachment_row->file_hash;
    	if(!file_exists($smf_filename))
    		$smf_filename = $forum_path.$smf_attachment_row->id_attach.'_'.$smf_attachment_row->filename.$smf_attachment_row->file_hash;
    	
    	if(!file_exists($smf_filename))
    	{
    		echo "no file, skipping attachment for ".$smf_attachment_row->id_attach.", missing SMF file: ".$smf_filename."\n"; flush();
    		continue;
    	}
    	
    	$uploads = wp_upload_dir('SMF');
    	$new_upload_dir = $uploads['path'];
    	$new_full_filename = $new_upload_dir.'/'.$smf_attachment_row->filename;
    	if($verbose) { echo('old->new = '.$smf_filename.' -> '.$new_full_filename."\n"); flush(); }
    	
    	//copy the enclosed file if necessary
    	if(!file_exists($new_full_filename) && !copy($smf_filename, $new_full_filename) ) {
    		echo "cannot copy: ".$smf_filename."->".$new_full_filename."\n";
    	} else {
    		//look for bbPress's previously imported topic or reply for the current attachment
    		$parent_args = array(
    			'post_type' => array('topic', 'reply'),
    			'meta_key' => '_bbp_post_id',
    			'meta_value' => $smf_attachment_row->id_msg
    		);
    		//echo "$parent_args = ".print_r($parent_args)."\n";
    		
    		$parent_query = new WP_Query($parent_args);
    		$parent_query->get_posts();
    		if($verbose) { echo $parent_query->post_count." posts found for smf_post id ".$smf_attachment_row->id_msg."\n"; flush(); }
    
    		//normally only one post references a given enclosure, but handle possible multiples anyway ...
    		while($parent_query->have_posts()) {
    			$parent_query->the_post();
    			$post_id = get_the_ID();
    			$attachment_data = array(
    				'guid' => $uploads['url'] . '/' . basename( $new_full_filename ),
    				'post_mime_type'	=> 'image/'.$smf_attachment_row->fileext,
    				'post_title'		=> $smf_attachment_row->filename,
    				'post_status'		=> null,
    				'post_content'		=> '',
    			);
    			//if($verbose) { echo "attachment_data = ".print_r($attachment_data)."\n"; flush(); }
    			
    			$attach_id = wp_insert_attachment($attachment_data, $new_full_filename, $post_id);
    
    			//echo "attach_id = ".$attach_id."\n"; flush();
    			if($attach_id) {
    				//update_post_meta($attach_id, '_bbp_attachment', 1);
    				if($attach_metadata = wp_generate_attachment_metadata($attach_id, $new_full_filename)) {
    					//echo 'attach_metadata = '.print_r($attach_metadata)."\n"; flush();
    					wp_update_attachment_metadata( $attach_id,  $attach_metadata );
    					set_post_thumbnail( $post_id, $attach_id );				
    				} else {
    					echo 'wp_generate_attachment_metadata failed, fname = '.$new_full_filename."\n"; flush();
    				}
    			}
    			wp_reset_postdata();
    		}
    	}
    	$count++;
    	if($count%100 == 0)
    	{
    		echo $count." attachments processed\r";
    		flush();
    	}
    }
    echo "Done, processed ".$count." records\n\n";
    
    //clean up message body text
    //convert <tt> -> <br />
    mysql_query("UPDATE wp_posts SET post_content = REPLACE (post_content, \'<tt>\', \'<br />\') WHERE post_content LIKE \'%<tt>%\'");
    
    mysql_close($connection);
    exit;
    ?>
    
Viewing 25 replies - 101 through 125 (of 155 total)
  • The topic ‘SMF Import to bbPress’ is closed to new replies.
Skip to toolbar