Thanks Lynnne. We started work on that last night but we are not MYSQL experts by any means. We have managed to fill all fields except one. We can't figure out how to do it.
This is what we have so far using a temporary reputation table named rep_final. Once we have the last bit. transferring the records from rep_final to the permanent reputation table is straight forward.
Code:
INSERT INTO rep_final (whoadded, dateline, postid)
SELECT userid, date, postid
FROM post_thanks;
UPDATE rep_final SET reputation = "1";
UPDATE rep_final SET reason = "Thanked Post";
The final field userid is obtained by reading the field postid in table post_thanks then finding the postid record in table posts and selecting the field userid from that record. This value should the be written as the userid field in rep_final.
I don't know how to write that query. If anyone could help me with it would be really great. Thanks.
--------------- Added 25 Mar 2011 at 15:15 ---------------
We figured it out finally. We also found out how to restore an emptied table from a backup, but that is another story. :erm:
If anybody is interested this is the final code. Please don't be tempted to do this unless you have some basic experience.
First we turned off the Post Thanks hack and the Reputation System via the AdminCP. Next using phpAdmin we emptied the reputation table. Then we ran this code.
Code:
INSERT INTO reputation (whoadded, dateline, postid)
SELECT userid, date, postid
FROM post_thanks;
UPDATE reputation SET reputation = "1";
UPDATE reputation SET reason = "Thanked Post";
UPDATE reputation, post
SET reputation.userid = post.userid
WHERE post.postid = reputation.postid;
When it was finished we turned the Rep system back on and ran the update reputation counter in the AdminCP->Maintenance. Job done.
Thanks again for your help Lynne.