Fixed Cant pass additional extraData to user spam checker from user registration service

Kirby

Well-known member
Affected version
2.3.6
PHP:
public function checkForSpam()
{
    $user = $this->user;

    $userChecker = $this->app->spam()->userChecker();
    $userChecker->check($user, ['preRegActionKey' => $this->preRegActionKey]);

As can be seen, $extraData is kinda hardcoded which makes it somewaht difficult to pass additonal data to user checkers without overwriting the whole method.

Could this be changed to smth. like
PHP:
protected function getSpamCheckExtraData(): array
{
    return ['preRegActionKey' => $this->preRegActionKey];
}

public function checkForSpam()
{
    $user = $this->user;

    $userChecker = $this->app->spam()->userChecker();
    $userChecker->check($user, $this->getSpamCheckExtraData());
?

This would allow extending the class to easily pass additional data in a clean way.
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.3.8).

Change log:
Support passing extra spam check data in the user registration service
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom