Making WordPress.org


Ignore:
Timestamp:
10/12/2020 06:02:38 AM (5 years ago)
Author:
dd32
Message:

Trac: Add an internal API to retrieve details from Trac for items related to a specific user.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/trac-notifications/trac-notifications-db.php

    r2258 r10364  
    193193        }
    194194    }
     195
     196    function get_user_anonymization_items( $username ) {
     197        $ticket_subscriptions = $this->get_trac_ticket_subscriptions_for_user( $username );
     198        $ticket_notifications = $this->get_trac_notifications_for_user( $user );
     199
     200        $ticket_reporter = $this->db->get_col( $this->db->prepare(
     201            "SELECT id FROM ticket WHERE reporter = %s",
     202            $username
     203        ) );
     204
     205        $ticket_owner = $this->db->get_col( $this->db->prepare(
     206            "SELECT id FROM ticket WHERE owner = %s",
     207            $username
     208        ) );
     209
     210        $attachments = $this->db->get_results( $this->db->prepare(
     211            "SELECT type, id, filename FROM attachment WHERE author = %s",
     212            $username
     213        ), ARRAY_A );
     214
     215        $comments = $this->db->get_results( $this->db->prepare(
     216            "SELECT ticket, time FROM ticket_change WHERE author = %s",
     217            $username
     218        ), ARRAY_A );
     219
     220        return compact(
     221            'ticket_subscriptions',
     222            'ticket_notifications',
     223            'ticket_reporter',
     224            'ticket_owner',
     225            'attachments',
     226            'comments',
     227        );
     228    }
    195229}
Note: See TracChangeset for help on using the changeset viewer.