vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Change "Thanks" into Rep Points - Can it be done? (https://vborg.vbsupport.ru/showthread.php?t=260875)

Zylantex 03-24-2011 09:39 AM

Change "Thanks" into Rep Points - Can it be done?
 
I am considering changing from a "Thanks" based merit system to the standard Reputation points system.

The thing is, I don't want users to loose their current perceived status.
Is there any way to translate thanks into rep points to start users off with their current standing?

Lynne 03-24-2011 03:13 PM

If I recall, the thanks mod has it's own tables. So you would need to write a query to transfer all those 'points' to 'rep' points and also transfer any other necessary information from the thanks table to the reputation table. You are going to have to get a good understanding of his tables. So, I'd suggest getting into your database and seeing what is what in the Thanks tables and then doing the same in the Reputation tables.

Zylantex 03-25-2011 05:43 AM

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: :D

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.

Lynne 03-25-2011 03:14 PM

Glad you got that sorted. :)


All times are GMT. The time now is 05:15 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01158 seconds
  • Memory Usage 1,717KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete