PluginProbe
GDPR / 1.4.7
GDPR v1.4.7
trunk 1.4.7 2.0.0 2.0.1 2.0.10 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1 2.1.2
gdpr / admin / partials / requests.php

requests.php in GDPR 1.4.7, at admin/partials/requests.php

324 lines 14.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Provide a admin area view for the plugin
5 *
6 * This file is used to markup the admin-facing aspects of the plugin.
7 *
8 * @link https://trewknowledge.com
9 * @since 1.0.0
10 *
11 * @package GDPR
12 * @subpackage admin/partials
13 */
14
15 ?>
16
17 <div class="wrap gdpr">
18 <h1><?php esc_html_e( 'Requests', 'gdpr' ); ?></h1>
19 <?php settings_errors(); ?>
20 <div class="nav-tab-wrapper">
21 <?php foreach ( $tabs as $key => $value ) : ?>
22 <a href="<?php echo '#' . $key; ?>" class="nav-tab">
23 <?php echo esc_html( $value['name'] ); ?>
24 <?php if ( $value['count'] ): ?>
25 <span class="gdpr-pending-requests-badge"><?php echo esc_html( $value['count'] ); ?></span>
26 <?php endif ?>
27 </a>
28 <?php endforeach; ?>
29 </div>
30
31 <div class="gdpr-tab hidden" data-id="rectify">
32 <h2><?php esc_html_e( 'Rectify Data', 'gdpr' ) ?></h2>
33 <table class="widefat gdpr-request-table">
34 <thead>
35 <tr>
36 <th><?php esc_html_e( 'Email', 'gdpr' ); ?></th>
37 <th class="text-center"><?php esc_html_e( 'Date of Request', 'gdpr' ); ?></th>
38 <th class="text-center"><?php esc_html_e( 'Information', 'gdpr' ); ?></th>
39 <th class="text-center"><?php esc_html_e( 'Actions', 'gdpr' ); ?></th>
40 </tr>
41 </thead>
42 <tbody>
43 <?php if ( isset( $rectify ) && ! empty( $rectify ) ): ?>
44 <?php foreach ( $rectify as $i => $request ): ?>
45 <tr>
46 <td class="row-title"><?php echo esc_html( $request['email'] ); ?></td>
47 <td class="text-center"><?php echo esc_html( $request['date'] ); ?></td>
48 <td class="text-center"><?php echo wp_kses( wpautop( wp_unslash( $request['data'] ) ), array( 'p' => true, 'br' => true ) ); ?></td>
49 <td class="text-center">
50 <form class="frm-process-rectification" action="<?php echo esc_url( admin_url('admin-post.php') ); ?>" method="post">
51 <?php wp_nonce_field( 'gdpr-request-nonce', 'gdpr_cancel_rectify_nonce' ); ?>
52 <input type="hidden" name="action" value="gdpr_cancel_request">
53 <input type="hidden" name="type" value="rectify">
54 <input type="hidden" name="index" value="<?php echo esc_attr( $i ); ?>">
55 <input type="hidden" name="user_email" value="<?php echo esc_attr( $request['email'] ) ?>">
56 <?php submit_button( esc_html__( 'Cancel Request', 'gdpr' ), 'delete', '', false ) ?>
57 </form>
58 <form class="frm-process-rectification" action="<?php echo esc_url( admin_url('admin-post.php') ); ?>" method="post">
59 <?php wp_nonce_field( 'gdpr-mark-as-resolved', 'gdpr_rectify_mark_resolved_nonce' ); ?>
60 <input type="hidden" name="action" value="gdpr_mark_resolved">
61 <input type="hidden" name="type" value="rectify">
62 <input type="hidden" name="index" value="<?php echo esc_attr( $i ); ?>">
63 <input type="hidden" name="user_email" value="<?php echo esc_attr( $request['email'] ) ?>">
64 <?php submit_button( esc_html__( 'Mark as Resolved', 'gdpr' ), 'primary', '', false ) ?>
65 </form>
66 </td>
67 </tr>
68 <?php endforeach ?>
69 <?php else: ?>
70 <tr>
71 <td colspan="4" class="text-center">
72 <?php esc_html_e( 'No pending requests', 'gdpr' ); ?>
73 </td>
74 </tr>
75 <?php endif ?>
76 </tbody>
77 <tfoot>
78 <tr>
79 <th><?php esc_html_e( 'Email', 'gdpr' ); ?></th>
80 <th class="text-center"><?php esc_html_e( 'Date of Request', 'gdpr' ); ?></th>
81 <th class="text-center"><?php esc_html_e( 'Information', 'gdpr' ); ?></th>
82 <th class="text-center"><?php esc_html_e( 'Actions', 'gdpr' ); ?></th>
83 </tr>
84 </tfoot>
85 </table>
86 </div>
87
88 <div class="gdpr-tab hidden" data-id="complaint">
89 <h2><?php esc_html_e( 'Complaints', 'gdpr' ) ?></h2>
90 <table class="widefat gdpr-request-table">
91 <thead>
92 <tr>
93 <th><?php esc_html_e( 'Email', 'gdpr' ); ?></th>
94 <th class="text-center"><?php esc_html_e( 'Date of Complaint', 'gdpr' ); ?></th>
95 <th class="text-center"><?php esc_html_e( 'Information', 'gdpr' ); ?></th>
96 <th class="text-center"><?php esc_html_e( 'Actions', 'gdpr' ); ?></th>
97 </tr>
98 </thead>
99 <tbody>
100 <?php if ( isset( $complaint ) && ! empty( $complaint ) ): ?>
101 <?php foreach ( $complaint as $i => $request ): ?>
102 <tr>
103 <td class="row-title"><?php echo esc_html( $request['email'] ); ?></td>
104 <td class="text-center"><?php echo esc_html( $request['date'] ); ?></td>
105 <td class="text-center"><?php echo esc_html( wp_unslash( $request['data'] ) ); ?></td>
106 <td class="text-center">
107 <form class="frm-process-complaint" action="<?php echo esc_url( admin_url('admin-post.php') ); ?>" method="post">
108 <?php wp_nonce_field( 'gdpr-request-nonce', 'gdpr_cancel_complaint_nonce' ); ?>
109 <input type="hidden" name="action" value="gdpr_cancel_request">
110 <input type="hidden" name="type" value="complaint">
111 <input type="hidden" name="index" value="<?php echo esc_attr( $i ); ?>">
112 <input type="hidden" name="user_email" value="<?php echo esc_attr( $request['email'] ) ?>">
113 <?php submit_button( esc_html__( 'Cancel Request', 'gdpr' ), 'delete', '', false ) ?>
114 </form>
115 <form class="frm-process-complaint" action="<?php echo esc_url( admin_url('admin-post.php') ); ?>" method="post">
116 <?php wp_nonce_field( 'gdpr-mark-as-resolved', 'gdpr_complaint_mark_resolved_nonce' ); ?>
117 <input type="hidden" name="action" value="gdpr_mark_resolved">
118 <input type="hidden" name="type" value="complaint">
119 <input type="hidden" name="index" value="<?php echo esc_attr( $i ); ?>">
120 <input type="hidden" name="user_email" value="<?php echo esc_attr( $request['email'] ) ?>">
121 <?php submit_button( esc_html__( 'Mark as Resolved', 'gdpr' ), 'primary', '', false ) ?>
122 </form>
123 </td>
124 </tr>
125 <?php endforeach ?>
126 <?php else: ?>
127 <tr>
128 <td colspan="4" class="text-center">
129 <?php esc_html_e( 'No pending requests', 'gdpr' ); ?>
130 </td>
131 </tr>
132 <?php endif ?>
133 </tbody>
134 <tfoot>
135 <tr>
136 <th><?php esc_html_e( 'Email', 'gdpr' ); ?></th>
137 <th class="text-center"><?php esc_html_e( 'Date of Complaint', 'gdpr' ); ?></th>
138 <th class="text-center"><?php esc_html_e( 'Information', 'gdpr' ); ?></th>
139 <th class="text-center"><?php esc_html_e( 'Actions', 'gdpr' ); ?></th>
140 </tr>
141 </tfoot>
142 </table>
143 </div>
144
145 <div class="gdpr-tab hidden" data-id="delete">
146 <h2><?php esc_html_e( 'Right to erasure', 'gdpr' ) ?></h2>
147 <div class="postbox not-full">
148 <form class="gdpr-manual-email-lookup" method="post" action="<?php echo esc_url( admin_url('admin-post.php') ); ?>">
149 <div class="inside">
150 <input type="hidden" name="action" value="gdpr_add_to_deletion_requests">
151 <?php wp_nonce_field( 'gdpr-add-to-deletion-requests', 'gdpr_deletion_requests_nonce' ); ?>
152 <h4>
153 <label for="gdpr-request-email-lookup"><?php esc_html_e( 'Manually add a user', 'gdpr' ); ?></label>
154 </h4>
155 <input type="email" name="user_email" class="gdpr-request-email-lookup regular-text" placeholder="<?php esc_attr_e( 'email@domain.com', 'gdpr' ); ?>" required>
156 <?php submit_button( esc_html__( 'Submit', 'gdpr' ), 'primary', '', false ); ?>
157 </div>
158 </form>
159 </div>
160 <table class="widefat gdpr-request-table">
161 <thead>
162 <tr>
163 <th><?php esc_html_e( 'Email', 'gdpr' ); ?></th>
164 <th class="text-center"><?php esc_html_e( 'Date of Request', 'gdpr' ); ?></th>
165 <th class="text-center"><?php esc_html_e( 'Review', 'gdpr' ); ?></th>
166 <th class="text-center"><?php esc_html_e( 'Actions', 'gdpr' ); ?></th>
167 </tr>
168 </thead>
169 <tbody>
170 <?php if ( isset( $delete ) && ! empty( $delete ) ): ?>
171 <?php $index = 0; ?>
172 <?php foreach ( $delete as $i => $request ): ?>
173 <?php $user = get_user_by( 'email', $request['email'] ) ?>
174 <tr class="<?php echo ( $index % 2 == 0 ? '' : 'alternate' ); ?>">
175 <td class="row-title"><?php echo esc_html( $request['email'] ); ?></td>
176 <td class="text-center"><?php echo esc_html( $request['date'] ); ?></td>
177 <td class="text-center">
178 <?php
179 if ( GDPR_Requests::user_has_content( $user ) ) {
180 echo '<button class="button gdpr-review" data-index="' . esc_attr( $index ) . '">' . esc_html__( 'Review', 'gdpr' ) . '</button>';
181 } else {
182 esc_html_e( 'No content to review', 'gdpr' );
183 }
184 ?>
185 <?php if ( GDPR_Requests::user_has_content( $user ) ): ?>
186 <?php else: ?>
187 <?php ?>
188 <?php endif; ?>
189 </td>
190 <td class="text-center">
191 <form class="frm-process-user-deletion" action="<?php echo esc_url( admin_url('admin-post.php') ); ?>" method="post">
192 <?php wp_nonce_field( 'gdpr-request-nonce', 'gdpr_cancel_delete_nonce' ); ?>
193 <input type="hidden" name="action" value="gdpr_cancel_request">
194 <input type="hidden" name="type" value="delete">
195 <input type="hidden" name="user_email" value="<?php echo esc_attr( $request['email'] ) ?>">
196 <input type="hidden" name="index" value="<?php echo esc_attr( $i ); ?>">
197 <?php submit_button( esc_html__( 'Cancel Request', 'gdpr' ), 'delete', '', false ) ?>
198 </form>
199 <form class="frm-process-user-deletion" action="<?php echo esc_url( admin_url('admin-post.php') ); ?>" method="post">
200 <?php wp_nonce_field( 'gdpr-request-delete-user', 'gdpr_delete_user' ); ?>
201 <input type="hidden" name="action" value="gdpr_delete_user">
202 <input type="hidden" name="user_email" value="<?php echo esc_attr( $request['email'] ) ?>">
203 <input type="hidden" name="index" value="<?php echo esc_attr( $i ); ?>">
204 <?php submit_button( esc_html__( 'Delete User', 'gdpr' ), 'primary', '', false ) ?>
205 </form>
206 </td>
207 </tr>
208 <?php if ( GDPR_Requests::user_has_content( $user ) ): ?>
209 <tr class="review" data-index="<?php echo esc_attr( $index ); ?>">
210 <td colspan="4">
211 <div class="hidden">
212 <table class="widefat">
213 <thead>
214 <tr>
215 <th><?php esc_html_e( 'Content Type', 'gdpr' ); ?></th>
216 <th class="text-center"><?php _e( 'Count', 'gdpr' ); ?></th>
217 <th class="text-center"><?php _e( 'Review', 'gdpr' ); ?></th>
218 <th class="text-center"><?php _e( 'Reassign', 'gdpr' ); ?></th>
219 <th class="text-center"><?php _e( 'Action', 'gdpr' ); ?></th>
220 </tr>
221 </thead>
222 <tbody>
223 <?php $post_types = get_post_types( array( 'public' => true ), 'objects' ); ?>
224 <?php foreach ( $post_types as $pt ): ?>
225 <?php
226 $uid = get_user_by( 'email', $request['email'] );
227 if ( $uid && $uid instanceof WP_User ) {
228 $uid = $uid->ID;
229 }
230 $count = count_user_posts( $uid, $pt->name );
231 if ( '0' === $count) {
232 continue;
233 }
234 ?>
235 <tr>
236 <td class="row-title"><?php echo esc_attr( $pt->label ) ?></td>
237 <td class="text-center"><?php echo esc_attr( $count ) ?></td>
238 <td class="text-center">
239 <a href="<?php echo admin_url('edit.php?post_type=' . $pt->name . '&author=' . $uid); ?>" target="_blank" class="button"><?php echo esc_html( $pt->labels->view_items ); ?></a>
240 </td>
241 <td class="text-center">
242 <select name="reassign" class="gdpr-reassign">
243 <option value="0"></option>
244 <?php $admins = get_users( array( 'role' => 'administrator' ) ); ?>
245 <?php foreach ( $admins as $admin ): ?>
246 <option value="<?php echo esc_attr( $admin->ID ) ?>"><?php echo esc_html( $admin->display_name ) ?></option>
247 <?php endforeach; ?>
248 </select>
249 </td>
250 <td class="text-center">
251 <form method="post" class="gdpr-reassign-content">
252 <?php wp_nonce_field( 'gdpr-reassign-content-action', 'gdpr_reassign_content_nonce' ) ?>
253 <input type="hidden" name="user_email" value="<?php echo esc_attr( $request['email'] ) ?>">
254 <input type="hidden" name="reassign_to" value="">
255 <input type="hidden" name="post_type" value="<?php echo esc_attr( $pt->name ); ?>">
256 <input type="hidden" name="post_count" value="<?php echo esc_attr( $count ); ?>">
257 <?php submit_button( esc_html__( 'Reassign', 'gdpr' ), 'primary', '', false, array( 'disabled' => true ) ); ?>
258 <span class="spinner"></span>
259 <p class="hidden"><strong><?php esc_html_e( 'Resolved', 'gdpr' ); ?></strong></p>
260 </form>
261 <span class="spinner"></span>
262 </td>
263 </tr>
264 <?php endforeach; ?>
265 <?php
266 $comment_count = get_comments( array(
267 'author_email' => $request['email'],
268 'include_unapproved' => true,
269 'count' => true,
270 ) );
271
272 if ( $comment_count ) {
273 ?>
274 <tr>
275 <td class="row-title"><?php esc_html_e( 'Comments', 'gdpr' ); ?></td>
276 <td class="text-center"><?php echo esc_html( $comment_count ); ?></td>
277 <td class="text-center"><a href="<?php echo admin_url( 'edit-comments.php?comment_status=all&s=' . urlencode( $request['email'] ) ); ?>" target="_blank" class="button"><?php _e( 'View Comments', 'gdpr' ); ?></a></td>
278 <td></td>
279 <td class="text-center">
280 <form method="post" class="gdpr-anonymize-comments">
281 <?php wp_nonce_field( 'gdpr-anonymize-comments-action', 'gdpr_anonymize_comments_nonce' ) ?>
282 <input type="hidden" name="user_email" value="<?php echo esc_attr( $request['email'] ) ?>">
283 <input type="hidden" name="comment_count" value="<?php echo esc_attr( $comment_count ) ?>">
284 <?php submit_button( esc_html__( 'Anonymize', 'gdpr' ), 'primary', '', false ) ?>
285 <span class="spinner"></span>
286 <p class="hidden"><strong><?php esc_html_e( 'Resolved', 'gdpr' ); ?></strong></p>
287 </form>
288 </td>
289 </tr>
290 <?php
291 }
292 ?>
293 </tbody>
294 <tr>
295 </tr>
296 </table>
297 </div>
298 </td>
299 </tr>
300 <?php endif ?>
301 <?php $index++; ?>
302 <?php endforeach; ?>
303 <?php else: ?>
304 <tr>
305 <td colspan="4" class="text-center">
306 <?php esc_html_e( 'No pending requests', 'gdpr' ); ?>
307 </td>
308 </tr>
309 <?php endif ?>
310 </tbody>
311 <tfoot>
312 <tr>
313 <th><?php esc_html_e( 'Email', 'gdpr' ); ?></th>
314 <th class="text-center"><?php esc_html_e( 'Date of Request', 'gdpr' ); ?></th>
315 <th class="text-center"><?php esc_html_e( 'Review', 'gdpr' ); ?></th>
316 <th class="text-center"><?php esc_html_e( 'Actions', 'gdpr' ); ?></th>
317 </tr>
318 </tfoot>
319 </table>
320 </div>
321
322 <!-- #poststuff -->
323 </div>
324