XF 2.1 Recalculating (Rebuilding) trophy points (database queries inside)

BruceW

Member
It appears that trophy points are awarded when a trophy is awarded and may be removed if a trophy is deleted but I could not find any way to rebuild the trophy points.

This query was my solution

SQL:
select concat("update Database.xf_user set trophy_points=", sum(trophy_points), " where user_id=", user_id,";") from Database.xf_user_trophy u inner join Database.xf_trophy t on u.trophy_id=t.trophy_id group by user_id

You would replace Database with the name of your database.

This query creates an update statement for each user that has points.

I saved the query to a file named ReCalcTrophyPoints.sql

Then ran

Bash:
mysql -u root -p -N <ReCalcTrophyPoints.sql >ReCalcTrophyPoints.do

mysql -u root -p <ReCalcTrophyPoints.do
 
Back
Top Bottom