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

Other Run PHP code on user upgrade

#1
I need to modify the user upgrade code to run a PHP code upon upgrade, which is different depending on selected upgrade.

Something like this.
Code:
try{
      $Rcon = new MinecraftRcon;
 
      $Rcon->Connect( MR_SERVER_ADDR, MR_SERVER_PORT, MR_SERVER_PASS, MR_TIMEOUT );
 
      //Add to the group
      if($upgrade == 'Diamond Member') {
            $data = $Rcon->Command( "pex user $username group set Diamond" );
      }
 
      if( $data == false) {
              echo "false";
              throw new MinecraftRconException( "Failed to get command result." );
      } else if( StrLen( $data ) == 0 ) {
              echo "false";
              throw new MinecraftRconException( "Got command result, but it's empty." );
      } else {
              echo $data;
      }
      } catch( MinecraftRconException $e ) {
              echo $e->getMessage( );
              echo "false";
      }
Is this possible somehow?
 

tyteen4a03

Well-known member
#2
Extend XenForo_Model_UserUpgrade::upgradeUser to add your own code after the parent function has been run. Note that you will need to rewrite the error handling part, and the Rcon API might block.
 
Top