Silly question about looking up a user's banned state

Ridemonkey

Well-known member
I was trying to add some styling to one of my logs to indicate whether a user is banned while scrolling through the log.

This log has $username and $user_id but I am unsure how to query a user's banned state using these. In normal templates I can just use $user.is_banned.

I am quite obviously not a developer, just a guy trying to improve his admin workflow, so hopefully someone doesn't mind assisting in my newbie question :)
 
I'm using the Stop Human Spam plugin and I use the log to identify spammers who are attempting to spam via profile posts. I'm trying to add an easy way to identify spammers that I have already banned so I don't waste time re-banning them.

I have poked around the core logs (e.g. user change log) to see if any of them query the user's banned state but I can't find anything in there either.
 
Ive just had a very quick cursory look at the SHS plugin via TAC Free
https://xenforo.com/community/resou...-spam-collection-anti-spam-free-version.1474/
(The actual SHS Plugin isn't free), and with my very limited experience and knowledge I think you would need to do the following :

1: Add a new field to the database table sf_stophumanspam_log
Name it something like 'userstate', and of type text.

2: Add a new field to Datawriter/Log.php under function _getFields()
'userstate' => array('type' => self::TYPE_STRING, 'default' => ''),

3: Edit the code that writes to the log to actually add the user's state.
That seems to be in Model/StopHumanSpam.php (lines 545 to 562) under function logEvent,

just before $logWriter->save(); add the following line
$logWriter->set('userstate', $visitor['user_state']);

3: Edit the template shs_stophumanspam_log to add in the fields to display in the log.


Please bear in mind this was a very cursory look and I have very limited knowledge so this could be completely wrong.
 
Interesting... I figured I was overlooking something incredibly stupid but I guess not.

So there's no way to query the state of the user from XenForo? The state of the user may change in between writing the log event and my actually browsing the log. In fact, it's actually very likely that the state of the user will change, since spammers are going to do a number of actions in rapid succession, they will usually get banned once someone notices their post in the moderation queue, and I will review the SHS logs much later. Thus, I only really care about displaying the active state of the user at the time I view the log.

I appreciate your responses!
 
Ah. TBH I'm not sure if you can. When you're viewing the log, you're just reading a nicely formatted output direct from the database of the SHS log, which as you know doesn't log the user state.

So on a technical level you'll need some code to extract the username from the log and go and find out the user's banned state......per user.
That code at the moment, just doesn't exist as part of SHS (if that makes sense).
 
Ah. TBH I'm not sure if you can. When you're viewing the log, you're just reading a nicely formatted output direct from the database of the SHS log, which as you know doesn't log the user state.

So on a technical level you'll need some code to extract the username from the log and go and find out the user's banned state......per user.
That code at the moment, just doesn't exist as part of SHS (if that makes sense).

Thanks for looking into this for me - it's greatly appreciated.

If anyone else has a suggestion for an easy way to do this, I'm all ears!
 
editing the query* to reflect something like:

Code:
select log.*, user.user_state from sf_stophumanspam_log log left join xf_user user on user.user_id = log.user_id

*I haven't seen any of the files or db schema relating to this add-on so I'm not giving specific instructions but this is the type of method you should probably use.
 
editing the query* to reflect something like:

Code:
select log.*, user.user_state from sf_stophumanspam_log log left join xf_user user on user.user_id = log.user_id

*I haven't seen any of the files or db schema relating to this add-on so I'm not giving specific instructions but this is the type of method you should probably use.

Great idea. I'll poke around with that tonight.
 
Top Bottom