XF 2.2 List of all users with at least one warning point

daimpa

Active member
Hello, where can I find the list of all users of the forum with at least one warning point?
I want to reset them all to 0 warnig points, but I don't understand how to do it.
 
Wooops.

That data is not exposed to the UI so you would have to query the database directly.
Thanks for your reply. Do anyone of the staff could help me with this? I'm not sure which could be the query.
Also, I think it would be really important to add such feature. So strange it's missing.
 
This sets all expired warning points to zero.


This will reset all user's warning points to be derived from the XF warning system, counting non-expired warnings. Note: if there are warnings past their expiry time but not explicitly expired they will be included so XF's warning expiry system works properly.

SQL:
update xf_user
set warning_points = COALESCE(
   (select sum(xf_warning.points) from xf_warning where xf_warning.user_id = xf_user.user_id and is_expired = 0)
, 0);

Added: Just noticed a possible type in the above SQL. Should is_expired = 0 actually be is_expired = 1? Check with @Xon
 
SQL:
SELECT user_id, username
FROM xf_user
WHERE warning_points > 0
This query list you all members with any warning points. Queries in post above help you reset him to zero.
 
Back
Top Bottom