1. 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

Discussion in 'Resource and Add-on Requests' started by ibab, May 26, 2013.

  1. ibab

    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.
          $Rcon = new MinecraftRcon;
          //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?
  2. tyteen4a03

    tyteen4a03 Well-Known Member

    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.
  3. ibab

    ibab Member

    Never done that. How do you extend it?
  4. tyteen4a03

    tyteen4a03 Well-Known Member

    Whoops, thought this was the dev forum. Nevermind.
    silence likes this.

Share This Page