• Welcome to the all-new Kolakube support, the official place to get help for Marketers Delight, XFtoWP, CryptoWP, and other WordPress products! Please login with your account details to access private support forums.
  • Support reminder: Please do not use private messaging for product support. Post questions to the respective forums to get help.

Bulk Import migration from vBulletin Connector

atminside

Active member
XFtoWP
Messages
25
Reaction score
4
We recently migrated from vB to XF and had approx 2000 threads linked to WP. We have all the old thread IDs by post ID. Is there a way other than manually entering every thread ID on each post to sync these back?
 
Solution
Hi @atminside, thank you for your patience with me! I fell off this a bit but I have a script that I am confident should move your old vB Thread IDs to the format XFtoWP recognizes.

Here is an updated function as above that you will want to follow the same steps for (paste once, refresh frontend, delete code), the only difference being this will attempt to run a postmeta update to all of your blog posts.

I haven't tested this on thousands of entries like your site has and I highly encourage you to test this on a dev site or at the very least do a WordPress database backup before you run this function. I've tried to optimize this query the best I can by returning minimal data and only attempting to update a post if it has the...

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,490
Reaction score
1,821
Hi @atm, congrats on the move this is definitely possible. Can you provide an example of the postmeta data from the database?

Here is an example of how you could print it out to a page itself, if you enter the post ID:

PHP:
print_r( get_post_meta( XXX ) );
 
Comment

atminside

Active member
XFtoWP
Messages
25
Reaction score
4
Glad to hear this is possible! Here's the postmeta created by our old plugin which was scVBConnector. The field highlighted in blue is where we have the thread ID number, from vB, which matches our thread ID in XF.

1641991443610.png
 
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,490
Reaction score
1,821
Hi @atminside, thanks for the info. Let's test one page first to ensure the move works, then we can loop all your posts later.

---

Step 1: Paste to your child theme functions.php file or anywhere you execute custom functions:

PHP:
/**
 * Run this function once to set the Thread ID to
 * the post meta so XFtoWP can refresh the thread later.
 */

function convert_vb_to_xfwp() {
    $thread = array();
    $post_id = 99832;
    $thread_id = 337;
//$thread_id = get_post_meta( get_the_ID(), 'vbconnectorthreadid', true );
    $thread['comments']['thread_id'] = $thread_id;
    $thread['comments']['last_update'] = time();
    update_post_meta( $post_id, 'xfwp', $thread );
}

add_action( 'init', 'convert_vb_to_xfwp' );

Step 2: Change the $post_id variable to the test post/page in WordPress and change $thread_id to the thread ID in XenForo. The hidden $thread_id line is what should access the vB connector thread ID on all posts, which you should also test.

Step 3: Once the function is saved, refresh your test page once, then remove the function call from page load. You do not need this code anymore.

Step 4: Go to WP admin > XF > Site Setup > Refresh and change the interval to 1 minute. The function saves the thread ID to the post meta so XFtoWP now recognizes the thread ID, but it hasn't refreshed the thread data yet.
Screen Shot 2022-01-15 at 1.21.34 AM.png

Step 5: Wait about a minute or less and refresh the page again (make sure the function has been removed) and XFtoWP should have now refreshed the thread data and show the proper thread comments.

Let me know how this works!
 
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,490
Reaction score
1,821
Hey Alex! I tried this, but even though I can see the PHP execute, it is not storing the thread id into postmeta.
To confirm, did you paste this line with the function? I see it was cut off in my last post.

add_action( 'init', 'convert_vb_to_xfwp' );

maybe it will also help to make sure you are logged in with cache disabled when you run the function (only once, then remove the code).

After the function runs you should see:

1) the XF thread ID in Edit post > Post to XenForo meta box (same WP post ID used in the function)
2) A forum comments box is added to the post/page from your WP admin > XF > Thread comments settings. May be empty until page refresh
 
Comment

atminside

Active member
XFtoWP
Messages
25
Reaction score
4
Yes, I had that line in the function. I did not see either of those things afterward. I do not believe caching is the issue, as I did see the PHP execute on the page.

The edit post page showed the following still:
1642432504701.png
 
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,490
Reaction score
1,821
Yes, I had that line in the function. I did not see either of those things afterward. I do not believe caching is the issue, as I did see the PHP execute on the page.

The edit post page showed the following still:
View attachment 3801
If you select "Connect a thread" from here do you see the thread ID in the text field that appears? I just tested my function again and the thread ID linked to my post, so I'm a little surprised this hasn't worked for you.
 
Comment

atminside

Active member
XFtoWP
Messages
25
Reaction score
4
I see what happened. I was using my web-based file editor instead of SSH into the server. The code ended up outside the <?PHP ?> on functions.php so even though I saw the code on the page it wasn't actually executing.

I retried this morning and caught that error, now this method worked!
 
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,490
Reaction score
1,821
I see what happened. I was using my web-based file editor instead of SSH into the server. The code ended up outside the <?PHP ?> on functions.php so even though I saw the code on the page it wasn't actually executing.

I retried this morning and caught that error, now this method worked!
Excellent, allow me a little time to play around with a looped version and we can try a crude but effective method to move your old thread ID on all your blog posts. 😀
 
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,490
Reaction score
1,821
Hi @atminside, thank you for your patience with me! I fell off this a bit but I have a script that I am confident should move your old vB Thread IDs to the format XFtoWP recognizes.

Here is an updated function as above that you will want to follow the same steps for (paste once, refresh frontend, delete code), the only difference being this will attempt to run a postmeta update to all of your blog posts.

I haven't tested this on thousands of entries like your site has and I highly encourage you to test this on a dev site or at the very least do a WordPress database backup before you run this function. I've tried to optimize this query the best I can by returning minimal data and only attempting to update a post if it has the vBconnector post meta key already saved.

PHP:
/**
 * Run this function once to set the Thread ID to
 * the post meta so XFtoWP can refresh the thread later.
 */

function convert_vb_to_xfwp() {
    $thread = array();
    $posts = new WP_Query( array(
        'post_type' => 'post',
        'fields' => 'ids',
        'posts_per_page' => -1
    ) );
    if ( $posts->have_posts() )
        while( $posts->have_posts() ) {
            $posts->the_post();
            $post_id = get_the_ID();
            $vb_thread_id = get_post_meta( $post_id, 'vbconnectorthreadid', true );
            if ( empty( $vb_thread_id ) )
                continue;
            $thread['comments']['thread_id'] = $vb_thread_id;
            $thread['comments']['last_update'] = time();
            update_post_meta( $post_id, 'xfwp', $thread );
        }
    wp_reset_query();
}

add_action( 'init', 'convert_vb_to_xfwp' );

Let me know if you have any questions and please let me know how it goes!
 
Last edited:
Comment
Solution

atminside

Active member
XFtoWP
Messages
25
Reaction score
4
Hey @Alex,

For some reason, this didn't work. No data was added to the post_meta that I could find. We take nightly backups and have quite a lot of server overhead, so I don't have too many concerns about data or performance issues.
 
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,490
Reaction score
1,821
Hey @Alex,

For some reason, this didn't work. No data was added to the post_meta that I could find. We take nightly backups and have quite a lot of server overhead, so I don't have too many concerns about data or performance issues.
I wonder if I am correctly accessing the vB thread ID in this line. Since I don't have the data I wasn't able to test it, but this is the most important line:

PHP:
$vb_thread_id = get_post_meta( $post_id, 'vbconnectorthreadid', true );

I will verify now with the login details you sent me. But first, can you link me to a post/page that has the vB comments saved to it?
 
Comment

atminside

Active member
XFtoWP
Messages
25
Reaction score
4
This is one of our newest posts with XF connected:

This is one of the older posts with the vB data, but no thread connected at this moment (post 131790):

This is the post_meta for post 131790 which has any vB data:
1641991443610-png.3798
 
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,490
Reaction score
1,821
Ok, I've updated the function to add the posts_per_page parameter to the query so it ensures to query ALL posts. I had thought the parameter was set to unlimited by default but it is instead set to the number of posts your site is setup to show per blog page.

I also confirmed the vB thread ID is being correctly pulled, so try it again.
 
Comment

atminside

Active member
XFtoWP
Messages
25
Reaction score
4
Looks like that got it linked now! Waiting for the comments to show up on the article now, but it shows in the Edit Post widget now, and clicking the "Start the discussion" link takes me to the XF thread. I think this is a caching issue, I'm purging caches in a few places to see if they show up. I'll update you after they show on each post.
 
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,490
Reaction score
1,821
Looks like that got it linked now! Waiting for the comments to show up on the article now, but it shows in the Edit Post widget now, and clicking the "Start the discussion" link takes me to the XF thread. I think this is a caching issue, I'm purging caches in a few places to see if they show up. I'll update you after they show on each post.
That's GREAT news!

Yes, once the thread_id and last_update are saved the threads will fall into XFtoWP's normal syncing routines. Once a visitor goes to any page it will trigger the comments to refresh on the same page load so over time your pages will populate with comments as they are visited.
 
Comment

atminside

Active member
XFtoWP
Messages
25
Reaction score
4
For anyone else who might make this same migration as we did, the vB plugin was called SolidCoding Wordpress-vBulletin Connector or sometimes SCvBConnector. After this short troubleshooting with Alex, this was absolutely a cakewalk to re-connect a few thousand connected threads!
 
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,490
Reaction score
1,821
For anyone else who might make this same migration as we did, the vB plugin was called SolidCoding Wordpress-vBulletin Connector or sometimes SCvBConnector. After this short troubleshooting with Alex, this was absolutely a cakewalk to re-connect a few thousand connected threads!
This is just fantastic news and a big milestone for our plugin. Thank you for working with me and for getting your hands a little dirty with some custom functions!
 
Comment
Top