Reset Messages, Likes, Trophy Points

Статус
В этой теме нельзя размещать новые ответы.

HDTechVideo

Проверенные
Сообщения
46
Реакции
60
Баллы
8,115
Is there any way to reset the manually changed message count, likes and Trophy points according to his/her original message count and likes.
 
I do not get exactly what you need. :)
Here You have 835 post, 179 Likes. Suppose if you changed to 5000 Post, 500 Likes. and now you want to get back the actual message count and likes but you dont know the actual value. Is there any way to automatically count the total message and likes.
 
This is Rebuild user post counts.

This will recalculate and update the post counts for all users at once. This is a large query that may take a while to finish.
Код:
UPDATE xf_user AS user
SET message_count = (
    SELECT COUNT(*)
    FROM xf_post AS post
    LEFT JOIN xf_thread AS thread ON (thread.thread_id = post.thread_id)
    WHERE post.user_id = user.user_id
    AND post.message_state = 'visible' AND thread.discussion_state = 'visible'
    GROUP BY post.user_id
);


If you have forums you wish to exclude from the count then use this query, where 1,2,3 is a comma-list of node_ids that are excluded from the count:
Код:
UPDATE xf_user AS user
SET message_count = (
    SELECT COUNT(*)
    FROM xf_post AS post
    LEFT JOIN xf_thread AS thread ON (thread.thread_id = post.thread_id)
    WHERE post.user_id = user.user_id
    AND thread.node_id NOT IN (1,2,3)
    AND post.message_state = 'visible' AND thread.discussion_state = 'visible'
    GROUP BY post.user_id
);


Backup first.

Because this query is so large you may encounter errors relating to these MySQL settings:

wait_timeout
innodb_lock_wait_timeout

You need to ask your host or server person to increase these settings if you encounter such errors.
 
Статус
В этой теме нельзя размещать новые ответы.
Современный облачный хостинг провайдер | Aéza
Назад
Сверху Снизу