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

Require people register on forums with minecraft username

Require members to register with a valid minecraft username

  1. Sway

    Sway Active Member

    Sway submitted a new resource:

    Make people register on forums with minecraft username - Require members to register with a valid minecraft username

    Read more about this resource...
     
    jflory7 and Matthew Hawley like this.
  2. iJerbo

    iJerbo New Member

  3. tyteen4a03

    tyteen4a03 Well-Known Member

    Why not a full-fledged addon?
     
  4. Sway

    Sway Active Member

    /library/MinecraftAvatar/ControllerPublic/Register.php You're going to have to do the same thing.
    It's 4 lines of code.
     
  5. tyteen4a03

    tyteen4a03 Well-Known Member

    4 lines of code which you need to apply again and again for each update, and cannot be easily disabled.

    Writing a full-fledged addon isn't that hard, especially since you've already written this.
     
  6. Sway

    Sway Active Member

  7. tyteen4a03

    tyteen4a03 Well-Known Member

    Here is a repackaged full-fledged addon. It also fixes a bug where it is not throwing errors correctly ($errors array does not exist in that function).

    This only works with 1.2.

    I don't really want to maintain it, but I suggest putting the username check on a Deferred task in case MC.net derps (which happens more than you think)
     

    Attached Files:

    Sway likes this.
  8. Sway

    Sway Active Member

    The only reason i have not made an add-on is 1. because i don't know php. and 2. because i cbf to get into XF development. I only released this because i had permission from the two credited in OP. I just wanted to share with others that may run minecraft related forums.
     
  9. tyteen4a03

    tyteen4a03 Well-Known Member

    You don't? Since you released the code I thought you did.

    Oh well. I'll maintain it in my spare time I guess.
     
  10. Sway

    Sway Active Member

    I can try and maintain it.. Been meaning to learn php :p
     
  11. tyteen4a03

    tyteen4a03 Well-Known Member

    You have full rights to the addon's codes.
     
    Sway likes this.
  12. Nicky Vermeersch

    Nicky Vermeersch Active Member

    Hmm, I added these four lines of code to Register.php on the right location, and added the phrase. I still can register an account where the username would return false on minecraft.net. I cleared my opcode cache, but it still seems to not work, am I forgetting something?

    This is the code from Register.php:

    Code:
            /**
            * Gets data from the registration form
            *
            * @return array [$data, $passwords]
            */
            protected function _getRegistrationDataFromInput()
            {
                    $data = $this->_input->filter(array(
                            'username'  => XenForo_Input::STRING,
                            'email'      => XenForo_Input::STRING,
                            'timezone'  => XenForo_Input::STRING,
                            'gender'    => XenForo_Input::STRING,
                            'dob_day'    => XenForo_Input::UINT,
                            'dob_month'  => XenForo_Input::UINT,
                            'dob_year'  => XenForo_Input::UINT,
                    ));
    
            $sRes= file_get_contents( 'http://www.minecraft.net/haspaid.jsp?user='. rawurlencode( $data['username'] ) );
            if( strpos( $sRes, 'true' )=== FALSE )
            {
                    $errors[] = new XenForo_Phrase('invalid_minecraft_user');
            }
    
    
                    $passwords = $this->_input->filter(array(
                            'password' => XenForo_Input::STRING,
                            'password_confirm' => XenForo_Input::STRING,
                    ));
    
                    return array($data, $passwords);
            }
    
     
  13. Sway

    Sway Active Member

    If you have another add-on that has a Register.php that would do it. You need to make sure any other add-ons with a Register.php have those 4 lines of code as well. MinecraftAvatar add-on has it's own Register.php, so if you're using that, you need to add those 4 lines.
     
  14. Nicky Vermeersch

    Nicky Vermeersch Active Member

    To my knowledge I don't have addons that costumize the Register.php (I checked by doing a File Health Integrity check from xenforo, it didn't show up in the list)
     
  15. tyteen4a03

    tyteen4a03 Well-Known Member

    It is actually a bug in your code mod. See my repackaged add on for fix.
     

Share This Page