• 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.

Bulk Import

atminside

Member
XFtoWP
Messages
17
Reaction score
1
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?
 

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,195
Reaction score
1,745
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

Member
XFtoWP
Messages
17
Reaction score
1
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,195
Reaction score
1,745
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,195
Reaction score
1,745
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

Member
XFtoWP
Messages
17
Reaction score
1
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,195
Reaction score
1,745
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

Member
XFtoWP
Messages
17
Reaction score
1
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,195
Reaction score
1,745
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
Top