4 Replies Latest reply on Mar 7, 2009 12:40 PM by David Wu

    How to stop transaction

    David Wu
      function Trigger_CheckOldPassword(&$tNG) {
      return Trigger_UpdatePassword_CheckOldPassword($tNG);
      }

      This is check old password function in ADDT, I want to know what it return to break the transaction, because sometimes I want to do some check through custom trigger by myself, and I don't know how to stop the transaction if the result of my check means to stop.
        • 1. Re: How to stop transaction
          Günter Schenk Level 4
          Hi chan,

          the function "Trigger_UpdatePassword_CheckOldPassword" sits in the file "includes/tng/triggers/tNG_defTrigg.inc.php".

          Excerpt from the function documentation:

          --------
          Check the old password in the database; In case of error return an error object;
          If no error and the old password match the password entered by the user return null
          -------

          So it seems that this function performs an either/or thing: you either get a variety of error messages returned, or the function just returns "null" aka "false" in case the passwords do match.

          ------
          to break the transaction
          ------

          breaking the transaction would actually mean to terminate the execution of the function "Trigger_UpdatePassword_CheckOldPassword", and you could try with using PHP´s native functions "exit" (or "die", what´s actually the same) in place of the original...

          return null;

          ... line.

          However, I´m not sure if trying this would have any advantage to you, because the only thing this function does is returning some error messages and otherwise just "die" anyway.

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: How to stop transaction
            David Wu Level 1
            I know the process of the function, but I don't think exit or die will work, because both it will stop everything, in this case, if you stop everything, display transaction error should not work, because it's in the body area, and transaction function is above head area, how do you think?
            • 3. Re: How to stop transaction
              Günter Schenk Level 4
              -------
              how do you think?
              -------

              I don´t have any opinion, because it´s weekend :-)

              -------
              I want to do some check through custom trigger by myself
              -------

              and what exactly do you want to check ?

              Cheers,
              Günter Schenk
              Adobe Community Expert, Dreamweaver
              • 4. Re: How to stop transaction
                David Wu Level 1
                ok, let's find it out together, and thanks for your help :)