• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Captcha for other usergroups

#1
Hello. Is it possible to add captcha-posting to other usergroup. I would like to add a few members to the usergroup "autoposters" to check if they pass the captcha...

Thanks,
 

Jake Bunce

XenForo moderator
Staff member
#2
Right now it's a hard-coded function:

library/XenForo/Visitor.php

Code:
	/**
	 * Returns true if the visitor should be shown a CAPTCHA.
	 *
	 * @return boolean
	 */
	public function showCaptcha()
	{
		return ($this->_user['user_id'] == 0); // TODO: permission
	}
You can modify this function to check groups. Example, add the red code:

Code:
	/**
	 * Returns true if the visitor should be shown a CAPTCHA.
	 *
	 * @return boolean
	 */
	public function showCaptcha()
	{
		return ($this->_user['user_id'] == 0 OR $this->isMemberOf(6)); // TODO: permission
	}
That should force members of group id 6 to fill out a captcha.