Error in Sent message (I cant delete message)

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • New

      amamoslavida wrote:

      I am not familiar to version you use but

      if you cannot see message button then try changing class

      from "fas fa -times to "fa fa-times" meaning remove the "s" letter.

      other than this you need to send AJAX request to delete message

      example and not forgot to exit at the end of ajax..
      In my opinion problem is the ShowMessagesPage.class.php.
      Why do I think that?
      When I changed this file and copy @Ala code - I can't deleted received messages. Change of this file breake trash button(he is not clickable)

      In normal - error with only sent message. And that's what I want to fix
    • New

      $sql = "SELECT COUNT(*) as state FROM %%MESSAGES%% WHERE message_owner = :userId AND message_id = :message_id;";
      $MessageCount = database::get()->selectSingle($sql, array(
      ':userId' => $USER['id'],
      ':message_id' => $MsgID,
      ), 'state');


      this part of code causing the problem / with this function you can only delete messages that you have from other users, you cannot delete messages that you send to others.

      but dont delete thid because if you delete probably works, but an user can manipulate and can delete other users' messages by html..

      Actually it is working as intended, if you are ablo to delete message that you send, they will be removed from receiver as well, and it is not intended.

      but if you still want to delete messages (from both of the users) copy the function, replace message_owner with message_sender, copy javascript and link it to send messages.

      The post was edited 2 times, last by amamoslavida ().

    • New

      a better aproach might be, adding 2 columns to uni1_messages table such as

      ALTER TABLE uni1_messages ADD COLUMN message_owner_status BOOLEAN DEFAULT 0;
      ALTER TABLE uni1_messages ADD COLUMN message_receiver_status BOOLEAN DEFAULT 0;

      if an user want to delete the message that he send to other user, than manipulate message_owner_status from 0 to 1;

      and at the page of send messages you need to select from messages WHERE message_owner_status = 0 by this way user's deleted ( send ) message not shown to user but it stays in inbox of other user.

      The post was edited 1 time, last by amamoslavida ().