• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Import Thanks from vBulletin

#1
Hi,

I wrote a simple script to read thanks from vbulletin and then insert into xenforo tables.

PHP:
<?php


@mysql_connect("localhost","root","");
@mysql_select_db("xen");

$q1 = mysql_query("SELECT * FROM tmp_like
                   WHERE id > ".$_GET['next']."
                     AND id <= ".($_GET['next']+40000)."
                   ORDER BY id ASC");
while($r1 = mysql_fetch_assoc($q1)) {
    mysql_query("INSERT INTO xf_liked_content
                 VALUES (null,
                          'post',
                          '".$r1['postid']."',
                          '".$r1['userid']."',
                          '".$r1['date']."',
                          '".$r1['content_userid']."'
                          )");

    mysql_query("UPDATE xf_user
                SET like_count = like_count + 1
                WHERE user_id = ".$r1['content_userid']);

    $lastid = $r1['id'];
}

    echo "Last import id : <a href=\"like.php?next=".$lastid."\">".$lastid."</a>";

Is it sufficient for importing thanks from vbulletin to xenforo likes ?
 

MtoR

Well-known member
#2
Hello,

This does seem fine if you get a look at the XenForo_Model_Like and the function likeContent.
Which is called with params 'post / post id / post user id when liking a post.

One question though, in your code you are sure that the post id while be the one in xf ?

Clément