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

Captcha for other usergroups

Discussion in 'XenForo Questions and Support' started by multibam, Apr 9, 2013.

  1. multibam

    multibam Member

    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,
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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.
     
    Epi and Tracy Perry like this.

Share This Page