XF 2.0 setIsAutomated() in Creator class


Well-known member
I'm curious about setIsAutomated() and whether it is important to include when a thread is created from outside XenForo 2. Currently, it is not in the code and everything works. Reading the method in the class shows it is setting two items false. The $performValidations property is set to true and this sets it to false.

Is it best to include the method or proper to leave it off?

Chris D

XenForo developer
Staff member
It sort of depends. If the thread is being created on behalf of another user or in an automated context (such as within a Cron entry) then you must setIsAutomated() to true. This will disable logging IP addresses (which will be just wrong, if it's running as another user or via a cron). What it will also do is disable performing various validation tasks such as forcing a thread title to be the right length (by shortening it), disable checking a message is valid, whether the right amount of thread tags meets the minimum for the forum, or the thread prefixes are valid etc.

So short answer is, if the user is in WordPress, and they are authenticated as themselves, and therefore the thread creator is running as that user, then you probably don't need to set it as automated. It will therefore log their IPs correctly and perform all the required validity checks, which seems sensible in this case.