0 Replies Latest reply on Sep 17, 2007 2:20 PM by eokorie

    Custom Trigger Issues

    eokorie
      I am trying to create a PM messaging system with ADDT. So far, things are going pretty well. But I have a problem with a custom trigger i am trying to write. Before a message is sent, I want the recipients private message count to be checked. If it equals 2, an error message is displayed and the message does not get sent. This is the code that I have at the moment.

      //start checkPM_Count trigger
      function checkPM_Count(&$tNG) {
      $username_pmcount = $_POST['msg_reciever'];
      $checkPMCount_SQL = "SELECT u_pmcount from members WHERE u_name='$username_pmcount'";
      $result1 = mysql_query($checkPMCount_SQL) or die($checkPMCount_SQL."
      ".mysql_error());
      $pm_count = $result1['u_pmcount'];
      if ($pm_count == '2') {
      $tNG->setError(new tNG_error('The user you are trying to send a message to has 2 private messages, sorry but we cant send your message until that user deletes some of their messages.', array(), array()));
      }

      }

      Can anyone tell me if there is something wrong with the code above. No error message is shown and the message is still being sent regardless.

      Thanks