IPB 2.3.x thanks points to IPB 3.0.x reputation

Status
Not open for further replies.

Hyperz

Active Member
Veteran
2,473
2009
604
20,225
Probably one of the most popular mods for IPB 2.3.x was the Thanks Mod Advanced/Lite. Unfortionatly for those that updated their board to 3.0.x they had to start over with IPB's native reputation system causing all members to loose their hard earned Thanks points.

I had the same issue so I created a little script to take the old Thanks points and add them to the users reputation points*. This will only work for those that updated from IPB 2 to 3. If you started fresh with IPB 3 the Thanks points are lost...

HOWTO:

1) Create a new php file in your forum root folder and call the file thanks_to_rep.php.

2) Open the file, add the following code to it and save the file:
PHP:
<?php

/************************************************/
/*  Thanks to Reputation script for IPB 3.0.x   */
/*  -----------------------------------------   */
/*    By Hyperz - http://code-projects.com/     */
/************************************************/


// Load DB config
require_once('./conf_global.php');

// Connect...
mysql_connect($INFO['sql_host'], $INFO['sql_user'], $INFO['sql_pass']) or die(mysql_error());
mysql_select_db($INFO['sql_database']) or die(mysql_error());

// Grab
$pre = $INFO['sql_tbl_prefix'];
$result = mysql_query("SELECT `member_id`, `thanks_point` FROM `" . $pre . "members` " .
                      "WHERE `thanks_point` > 0") or die(mysql_error());
$i = 0;

// Thanks points to reputation
while($row = mysql_fetch_array($result))
{
    // Add to user reputation
    mysql_query("UPDATE `" . $pre . "profile_portal` SET `pp_reputation_points`=`pp_reputation_points`+" . $row['thanks_point'] . "  " .
                "WHERE `pp_member_id`='" . $row['member_id'] . "'") or die(mysql_error());
    
    $i++;
}

// Drop the old column
mysql_query("ALTER TABLE `" . $pre . "members` DROP COLUMN `thanks_point`") or die(mysql_error());

// Done! You now owe Hyperz a cookie (:
echo '<span style="margin:5px;font-family:Verdana">All done! Added reputation for <i>' . $i . '</i> users.<br /><br />&nbsp;<a href="http://code-projects.com/" title="Script by Hyperz @ Code-Projects" target="_blank">http://code-projects.com/</a></span>'

?>
3) Point your browser to the file (I.E: http://myforum.com/forum_root/thanks_to_rep.php).

4) Done! Remove the thanks_to_rep.php file...


* Script tested on IPB 3.0.3, the Thanks Mod I used on my old IPB 2 board was Thanks Mod Advanced 2.3 (well, a modded propz version of it).


Enjoy peoples <3.
 
7 comments
By the way, if anyone uses the script could you be so kind to reply and tell me if it worked for you or not since I only got to test it @ my site. I'd like to know it it works in all cases like with the Lite and Ajax version of the Thanks mod. Thanks :).
 
Haven't tested it with the Lite version. I think it does, however, you won't know till you try. If you do try it let me know if it worked.
 
Status
Not open for further replies.
Back
Top