Skip to:
Content

BuddyPress.org

Changeset 8049


Ignore:
Timestamp:
03/05/2014 07:40:34 PM (10 years ago)
Author:
imath
Message:

Make sure a deleted message thread is no more viewable by the user

When a user deletes a message thread, the message is no more shown in its inbox or outbox, but typing the url of the message thread will load the message giving the impression, it has not been deleted. Reason is a message is completely deleted as soon as all recipients and senders deleted it. So we need to make sure the user will be redirected to his inbox if he tries to view a message thread he deleted.

Props henrywright

Fixes #5254

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-messages/bp-messages-classes.php

    r7995 r8049  
    422422            $user_id = bp_loggedin_user_id();
    423423
    424         return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d AND user_id = %d", $thread_id, $user_id ) );
     424        return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d AND is_deleted = 0 AND user_id = %d", $thread_id, $user_id ) );
    425425    }
    426426
Note: See TracChangeset for help on using the changeset viewer.