Other Run PHP code on user upgrade

ibab

Member
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?
 
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.
 
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.
Never done that. How do you extend it?
 
Top Bottom