Help with code

Hmm how did you guys do this? I was trying to set up the same thing for my forum.
ftp in to your web host and go to where you installed xenforo.
then go to library/xenforo/datawriter/user.php

open it in your favorite texteditor
scroll down and find:
PHP:
    /**
    * Verification callback to check that a username is valid
    *
    * @param string Username
    *
    * @return bool
    */
    protected function _verifyUsername(&$username)
at the end of this function i placed my code above the TRUE return
like this
PHP:
        // compare against romanized name to help reduce confusable issues
        $romanized = utf8_deaccent(utf8_romanize($username));
        if ($romanized != $username)
        {
            $existingUser = $this->_getUserModel()->getUserByName($romanized);
            if ($existingUser && $existingUser['user_id'] != $this->get('user_id'))
            {
                $this->error(new XenForo_Phrase('usernames_must_be_unique'), 'username');
                return false;
            }
        }
 
              //Alo minecraft verification
              /*** 2012-01-07 BEGIN AmigoJack
                Check username: has Minecraft nick paid? ***/
 
              $sRes= file_get_contents( 'http://www.minecraft.net/haspaid.jsp?user='. rawurlencode($username) );
              {           
                    if( strpos( $sRes, 'true' )=== FALSE )
                    {
                          $this->error(new XenForo_Phrase('The username must be a valid Minecraft ID. Check your spelling, name is Case Sensitive.'), 'username');
                          return false;
                    }
              }
 
           
              //End alo code
 
        return true;
    }
 
    /**
    * Verification callback to check the email address is in a valid form
    *
    * @param string Email Address
    *
    * @return bool
    */
    protected function _verifyEmail(&$email)

Once you do that you need to go to your web host and modify the php to allow_url_fopen or you will get a server error.

this is easy to do with most hosts.
test out the code here: http://fsrminecraft.com/index.php?login/
 
I think I see what you mean, but where do you put the second part of code? I found the first one, but I'm not sure exactly where you put it.
 
I think I see what you mean, but where do you put the second part of code? I found the first one, but I'm not sure exactly where you put it.
there is only one part of code. do you mean the allow url fopen?
what is your web host? i use 1and1.com
 
Do you mean you place this:
Code:
  // compare against romanized name to help reduce confusable issues
        $romanized = utf8_deaccent(utf8_romanize($username));
        if ($romanized != $username)
        {
            $existingUser = $this->_getUserModel()->getUserByName($romanized);
            if ($existingUser && $existingUser['user_id'] != $this->get('user_id'))
            {
                $this->error(new XenForo_Phrase('usernames_must_be_unique'), 'username');
                return false;
            }
        }
 
              //Alo minecraft verification
              /*** 2012-01-07 BEGIN AmigoJack
                Check username: has Minecraft nick paid? ***/
 
              $sRes= file_get_contents( 'http://www.minecraft.net/haspaid.jsp?user='. rawurlencode($username) );
              {         
                    if( strpos( $sRes, 'true' )=== FALSE )
                    {
                          $this->error(new XenForo_Phrase('The username must be a valid Minecraft ID. Check your spelling, name is Case Sensitive.'), 'username');
                          return false;
                    }
              }
 
         
              //End alo code
 
        return true;
    }
 
    /**
    * Verification callback to check the email address is in a valid form
    *
    * @param string Email Address
    *
    * @return bool
    */
    protected function _verifyEmail(&$email)
Above the top of this? Just making sure.
10fm2



My host is actually MPServ.net, because I have a E3-1240 16Gb RAM server for Minecraft, and web hosting. It works out well. I have CloudFlare as well to speed it up. :)
 
My host is actually MPServ.net, because I have a E3-1240 16Gb RAM server for Minecraft, and web hosting. It works out well. :)

you need to contact your host and ask them if they can make a Local PHP Setting for your website folder enabling "allow_url_fopen"
 
Alright sounds good, I'll have to try this out. I think it would reduce spam by a lot.

Do the antispam engines get polled before or after the username is checked if it's valid?
 
Top Bottom