MySQL + PHP - Get action from xf_moderator_log

Sonam

Member
Hey everyone!

I want to display all Actions a moderator has done. I currently have the Addon Staff Activity installed for some easy things like replies. I now want to display the table a bit more detailed so you will see how often a moderator has locked a thread as an example.

Please help because it is not working currently.

Thanks!
 
Hello,

Moderator logs is available in your ACP in the "Tools" tab (admin.php?logs/moderator)

You could take this as an example and see how this is managed.
 
The main issue currently is that I get an error when using this:
select * from xf_moderator_log where `action` = 'lock'
 
Can you post the entire lines of your request please ? (including PHP code)
$modLockCount = $db->fetchAll("SELECT COUNT(action) FROM xf_moderator_log WHERE `action` = 'lock'
", array($v['user_id'],$datelineStart,$datelineEnd));

Copied from Addon which stated above, other things like this work:

$moderationCount = $db->fetchOne("
SELECT COUNT(moderator_log_id)
FROM xf_moderator_log
WHERE user_id = ?
AND log_date >= ?
AND log_date <= ?
", array($v['user_id'],$datelineStart,$datelineEnd));
 
$modLockCount = $db->fetchAll("SELECT COUNT(action) FROM xf_moderator_log WHERE `action` = 'lock'
", array($v['user_id'],$datelineStart,$datelineEnd));
Should be:
PHP:
$modLockCount = $db->fetchOne("SELECT COUNT(action) FROM xf_moderator_log WHERE `action` = 'lock'
");
 
Top Bottom