| 1 |
<?php |
| 2 |
/** |
| 3 |
* Donors. |
| 4 |
* |
| 5 |
* @package Give |
| 6 |
* @subpackage Admin/Donors |
| 7 |
* @copyright Copyright (c) 2016, GiveWP |
| 8 |
* @license https://opensource.org/licenses/gpl-license GNU Public License |
| 9 |
* @since 1.0 |
| 10 |
*/ |
| 11 |
|
| 12 |
use Give\Donors\DonorsAdminPage; |
| 13 |
use Give\Donors\Models\Donor; |
| 14 |
use Give\Helpers\IntlTelInput; |
| 15 |
|
| 16 |
// Exit if accessed directly. |
| 17 |
if ( ! defined( 'ABSPATH' ) ) { |
| 18 |
exit; |
| 19 |
} |
| 20 |
|
| 21 |
|
| 22 |
/** |
| 23 |
* Get formatted address |
| 24 |
* |
| 25 |
* @since 4.9.0 rename function - PHP 8 compatibility |
| 26 |
* @since 2.0 |
| 27 |
* |
| 28 |
* @param array $address |
| 29 |
* @param array $address_args |
| 30 |
* |
| 31 |
* @return string |
| 32 |
*/ |
| 33 |
function give_get_format_address( $address, $address_args = array() ) { |
| 34 |
$address_html = ''; |
| 35 |
$address_args = wp_parse_args( |
| 36 |
$address_args, |
| 37 |
array( |
| 38 |
'type' => '', |
| 39 |
'id' => null, |
| 40 |
'index' => null, |
| 41 |
'default_address' => false, |
| 42 |
) |
| 43 |
); |
| 44 |
|
| 45 |
$address_id = $address_args['type']; |
| 46 |
|
| 47 |
// Bailout. |
| 48 |
if ( empty( $address ) || ! is_array( $address ) ) { |
| 49 |
return $address_html; |
| 50 |
} |
| 51 |
|
| 52 |
// Address html. |
| 53 |
$address_html = ''; |
| 54 |
$address_html .= sprintf( |
| 55 |
'<span data-address-type="line1">%1$s</span>%2$s', |
| 56 |
$address['line1'], |
| 57 |
( ! empty( $address['line2'] ) ? '<br>' : '' ) |
| 58 |
); |
| 59 |
$address_html .= sprintf( |
| 60 |
'<span data-address-type="line2">%1$s</span>%2$s', |
| 61 |
$address['line2'], |
| 62 |
( ! empty( $address['city'] ) ? '<br>' : '' ) |
| 63 |
); |
| 64 |
$address_html .= sprintf( |
| 65 |
'<span data-address-type="city">%1$s</span><span data-address-type="state">%2$s</span><span data-address-type="zip">%3$s</span>%4$s', |
| 66 |
$address['city'], |
| 67 |
( ! empty( $address['state'] ) ? ", {$address['state']}" : '' ), |
| 68 |
( ! empty( $address['zip'] ) ? " {$address['zip']}" : '' ), |
| 69 |
( ! empty( $address['country'] ) ? '<br>' : '' ) |
| 70 |
); |
| 71 |
$address_html .= sprintf( |
| 72 |
'<span data-address-type="country">%s</span><br>', |
| 73 |
$address['country'] |
| 74 |
); |
| 75 |
|
| 76 |
// Address action. |
| 77 |
$address_html .= sprintf( |
| 78 |
'<br><a href="#" class="js-edit">%1$s</a> | <a href="#" class="js-remove">%2$s</a>', |
| 79 |
__( 'Edit', 'give' ), |
| 80 |
__( 'Remove', 'give' ) |
| 81 |
); |
| 82 |
|
| 83 |
/** |
| 84 |
* Filter the address label |
| 85 |
* |
| 86 |
* @since 2.0 |
| 87 |
*/ |
| 88 |
$address_label = apply_filters( "give_donor_{$address_args['type']}_address_label", ucfirst( $address_args['type'] ), $address_args ); |
| 89 |
|
| 90 |
// Set unique id and index for multi type address. |
| 91 |
if ( isset( $address_args['index'] ) ) { |
| 92 |
$address_label = "{$address_label} #{$address_args['index']}"; |
| 93 |
} |
| 94 |
|
| 95 |
if ( isset( $address_args['id'] ) ) { |
| 96 |
$address_id = "{$address_id}_{$address_args['id']}"; |
| 97 |
} |
| 98 |
|
| 99 |
// Add address wrapper. |
| 100 |
$address_html = sprintf( |
| 101 |
'<div class="give-grid-col-4"><div data-address-id="%s" class="address"><span class="alignright address-number-label">%s</span>%s</div></div>', |
| 102 |
$address_id, |
| 103 |
$address_label, |
| 104 |
$address_html |
| 105 |
); |
| 106 |
|
| 107 |
return $address_html; |
| 108 |
} |
| 109 |
|
| 110 |
/** |
| 111 |
* Donors Page. |
| 112 |
* |
| 113 |
* Renders the donors page contents. |
| 114 |
* |
| 115 |
* @since 4.13.1 add early return if showing new details page |
| 116 |
* @since 1.0 |
| 117 |
* @return void |
| 118 |
*/ |
| 119 |
function give_donors_page() { |
| 120 |
if (DonorsAdminPage::isShowingNewDetailsPage()) { |
| 121 |
return; |
| 122 |
} |
| 123 |
|
| 124 |
$default_views = give_donor_views(); |
| 125 |
$requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'donors'; |
| 126 |
if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) { |
| 127 |
give_render_donor_view( $requested_view, $default_views ); |
| 128 |
} |
| 129 |
else { |
| 130 |
$userId = get_current_user_id(); |
| 131 |
$showLegacy = get_user_meta($userId, '_give_donors_archive_show_legacy', true); |
| 132 |
if ($showLegacy == 1) |
| 133 |
{ |
| 134 |
give_donors_list(); |
| 135 |
} |
| 136 |
} |
| 137 |
} |
| 138 |
|
| 139 |
/** |
| 140 |
* Register the views for donor management. |
| 141 |
* |
| 142 |
* @since 1.0 |
| 143 |
* @return array Array of views and their callbacks. |
| 144 |
*/ |
| 145 |
function give_donor_views() { |
| 146 |
|
| 147 |
$views = array(); |
| 148 |
|
| 149 |
return apply_filters( 'give_donor_views', $views ); |
| 150 |
|
| 151 |
} |
| 152 |
|
| 153 |
/** |
| 154 |
* Register the tabs for donor management. |
| 155 |
* |
| 156 |
* @since 1.0 |
| 157 |
* @return array Array of tabs for the donor. |
| 158 |
*/ |
| 159 |
function give_donor_tabs() { |
| 160 |
|
| 161 |
$tabs = array(); |
| 162 |
|
| 163 |
return apply_filters( 'give_donor_tabs', $tabs ); |
| 164 |
|
| 165 |
} |
| 166 |
|
| 167 |
/** |
| 168 |
* List table of donors. |
| 169 |
* |
| 170 |
* @since 1.0 |
| 171 |
* @return void |
| 172 |
*/ |
| 173 |
function give_donors_list() { |
| 174 |
|
| 175 |
include GIVE_PLUGIN_DIR . 'includes/admin/donors/class-donor-table.php'; |
| 176 |
|
| 177 |
$donors_table = new Give_Donor_List_Table(); |
| 178 |
$donors_table->prepare_items(); |
| 179 |
?> |
| 180 |
<div class="wrap"> |
| 181 |
<h1 class="wp-heading-inline"><?php echo get_admin_page_title(); ?></h1> |
| 182 |
<?php |
| 183 |
/** |
| 184 |
* Fires in donors screen, above the table. |
| 185 |
* |
| 186 |
* @since 1.0 |
| 187 |
*/ |
| 188 |
do_action( 'give_donors_table_top' ); |
| 189 |
?> |
| 190 |
|
| 191 |
<hr class="wp-header-end"> |
| 192 |
<form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>"> |
| 193 |
<?php |
| 194 |
$donors_table->advanced_filters(); |
| 195 |
$donors_table->display(); |
| 196 |
?> |
| 197 |
<input type="hidden" name="post_type" value="give_forms"/> |
| 198 |
<input type="hidden" name="page" value="give-donors"/> |
| 199 |
<input type="hidden" name="view" value="donors"/> |
| 200 |
</form> |
| 201 |
<?php |
| 202 |
/** |
| 203 |
* Fires in donors screen, below the table. |
| 204 |
* |
| 205 |
* @since 1.0 |
| 206 |
*/ |
| 207 |
do_action( 'give_donors_table_bottom' ); |
| 208 |
?> |
| 209 |
</div> |
| 210 |
<?php |
| 211 |
} |
| 212 |
|
| 213 |
/** |
| 214 |
* Renders the donor view wrapper. |
| 215 |
* |
| 216 |
* @since 4.16.8 Relinking donors is handled only through the nonce-protected edit action. |
| 217 |
* @since 1.0 |
| 218 |
* |
| 219 |
* @param string $view The View being requested. |
| 220 |
* @param array $callbacks The Registered views and their callback functions. |
| 221 |
* |
| 222 |
* @return void |
| 223 |
*/ |
| 224 |
function give_render_donor_view( $view, $callbacks ) { |
| 225 |
|
| 226 |
$render = true; |
| 227 |
|
| 228 |
$donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' ); |
| 229 |
|
| 230 |
if ( ! current_user_can( $donor_view_role ) ) { |
| 231 |
give_set_error( 'give-no-access', __( 'You are not permitted to view this data.', 'give' ) ); |
| 232 |
$render = false; |
| 233 |
} |
| 234 |
|
| 235 |
if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
| 236 |
give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) ); |
| 237 |
$render = false; |
| 238 |
} |
| 239 |
|
| 240 |
$donor_id = (int) $_GET['id']; |
| 241 |
$donor = new Give_Donor( $donor_id ); |
| 242 |
|
| 243 |
if ( empty( $donor->id ) ) { |
| 244 |
give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) ); |
| 245 |
$render = false; |
| 246 |
} |
| 247 |
|
| 248 |
?> |
| 249 |
|
| 250 |
<div class='wrap'> |
| 251 |
|
| 252 |
<h1 class="wp-heading-inline"> |
| 253 |
<?php |
| 254 |
printf( |
| 255 |
/* translators: %s: donor first name */ |
| 256 |
__( 'Edit Donor: %1$s %2$s', 'give' ), |
| 257 |
$donor->get_first_name(), |
| 258 |
$donor->get_last_name() |
| 259 |
); |
| 260 |
?> |
| 261 |
</h1> |
| 262 |
|
| 263 |
<hr class="wp-header-end"> |
| 264 |
|
| 265 |
<?php if ( give_get_errors() ) : ?> |
| 266 |
<div class="error settings-error"> |
| 267 |
<?php Give()->notices->render_frontend_notices( 0 ); ?> |
| 268 |
</div> |
| 269 |
<?php endif; ?> |
| 270 |
|
| 271 |
<?php if ( $donor && $render ) : ?> |
| 272 |
|
| 273 |
<div class="nav-tab-wrapper give-nav-tab-wrapper"> |
| 274 |
<?php |
| 275 |
|
| 276 |
$donor_tabs = give_donor_tabs(); |
| 277 |
|
| 278 |
foreach ( $donor_tabs as $key => $tab ) : |
| 279 |
$active = $key === $view ? true : false; |
| 280 |
$class = $active ? 'nav-tab nav-tab-active' : 'nav-tab'; |
| 281 |
printf( |
| 282 |
'<a href="%1$s" class="%2$s">%3$s</a>' . "\n", |
| 283 |
esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $donor->id ) ), |
| 284 |
esc_attr( $class ), |
| 285 |
esc_html( $tab['title'] ) |
| 286 |
); |
| 287 |
endforeach; |
| 288 |
?> |
| 289 |
</div> |
| 290 |
|
| 291 |
<div id="give-donor-card-wrapper"> |
| 292 |
<?php $callbacks[ $view ]( $donor ); ?> |
| 293 |
</div> |
| 294 |
|
| 295 |
<?php endif; ?> |
| 296 |
|
| 297 |
</div> |
| 298 |
<?php |
| 299 |
|
| 300 |
} |
| 301 |
|
| 302 |
|
| 303 |
/** |
| 304 |
* View a donor |
| 305 |
* |
| 306 |
* @since 4.16.4 Escaped the donor company and phone output. |
| 307 |
* @since 3.7.0 Add "phone" field |
| 308 |
* @since 1.0 |
| 309 |
* |
| 310 |
* @param Give_Donor $donor The Donor object being displayed. |
| 311 |
* |
| 312 |
* @return void |
| 313 |
*/ |
| 314 |
function give_donor_view( $donor ) { |
| 315 |
|
| 316 |
$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
| 317 |
|
| 318 |
/** |
| 319 |
* Fires in donor profile screen, above the donor card. |
| 320 |
* |
| 321 |
* @since 1.0 |
| 322 |
* |
| 323 |
* @param object $donor The donor object being displayed. |
| 324 |
*/ |
| 325 |
do_action( 'give_donor_card_top', $donor ); |
| 326 |
|
| 327 |
// Set Read only to the fields which needs to be locked. |
| 328 |
$read_only = ''; |
| 329 |
if ( $donor->user_id ) { |
| 330 |
$read_only = 'readonly="readonly"'; |
| 331 |
} |
| 332 |
|
| 333 |
// List of title prefixes. |
| 334 |
$title_prefixes = give_get_name_title_prefixes(); |
| 335 |
|
| 336 |
// Prepend title prefix to name if it is set. |
| 337 |
$title_prefix = Give()->donor_meta->get_meta( $donor->id, '_give_donor_title_prefix', true ); |
| 338 |
$donor_name_without_prefix = $donor->name; |
| 339 |
$donor->name = give_get_donor_name_with_title_prefixes( $title_prefix, $donor->name ); |
| 340 |
?> |
| 341 |
<div id="donor-summary" class="info-wrapper donor-section postbox"> |
| 342 |
<form id="edit-donor-info" method="post" |
| 343 |
action="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=legacy-overview&id=' . $donor->id ) ); ?>"> |
| 344 |
<div class="donor-info"> |
| 345 |
<div class="donor-bio-header clearfix"> |
| 346 |
<div class="avatar-wrap left" id="donor-avatar"> |
| 347 |
<?php |
| 348 |
|
| 349 |
// Check whether a Gravatar exists for a donor or not. |
| 350 |
$validate_gravatar_image = give_validate_gravatar( $donor->email ); |
| 351 |
|
| 352 |
// Get donor's initials for non-gravatars |
| 353 |
$donor_name_array = explode( ' ', $donor_name_without_prefix ); |
| 354 |
$donor_name_args['firstname'] = ! empty( $donor_name_array[0] ) ? $donor_name_array[0] : ''; |
| 355 |
$donor_name_args['lastname'] = ! empty( $donor_name_array[1] ) ? $donor_name_array[1] : ''; |
| 356 |
$donor_name_initial = give_get_name_initial( $donor_name_args ); |
| 357 |
|
| 358 |
// Gravatars image for donor |
| 359 |
if ( $validate_gravatar_image ) { |
| 360 |
$donor_gravatar_image = get_avatar( $donor->email ); |
| 361 |
} else { |
| 362 |
$donor_gravatar_image = '<div class="give-donor-admin-avatar">' . $donor_name_initial . '</div>'; |
| 363 |
} |
| 364 |
|
| 365 |
echo $donor_gravatar_image; |
| 366 |
?> |
| 367 |
</div> |
| 368 |
<div id="donor-name-wrap" class="left"> |
| 369 |
<span class="donor-name info-item edit-item"> |
| 370 |
<select name="donor_info[title]"> |
| 371 |
<option disabled value="0"><?php esc_html_e( 'Title', 'give' ); ?></option> |
| 372 |
<option value=""> </option> |
| 373 |
<?php |
| 374 |
if ( is_array( $title_prefixes ) && count( $title_prefixes ) > 0 ) { |
| 375 |
foreach ( $title_prefixes as $title ) { |
| 376 |
echo sprintf( |
| 377 |
'<option %1$s value="%2$s">%2$s</option>', |
| 378 |
selected( $title_prefix, $title, false ), |
| 379 |
esc_html( $title ) |
| 380 |
); |
| 381 |
} |
| 382 |
} |
| 383 |
?> |
| 384 |
</select> |
| 385 |
<input <?php echo $read_only; ?> size="15" data-key="first_name" |
| 386 |
name="donor_info[first_name]" type="text" |
| 387 |
value="<?php echo esc_html( $donor->get_first_name() ); ?>" |
| 388 |
placeholder="<?php esc_html_e( 'First Name', 'give' ); ?>"/> |
| 389 |
<?php if ( $donor->user_id ) : ?> |
| 390 |
<a href="#" class="give-lock-block"> |
| 391 |
<i class="give-icon give-icon-locked"></i> |
| 392 |
</a> |
| 393 |
<?php endif; ?> |
| 394 |
<input <?php echo $read_only; ?> size="15" data-key="last_name" |
| 395 |
name="donor_info[last_name]" type="text" |
| 396 |
value="<?php echo esc_html( $donor->get_last_name() ); ?>" |
| 397 |
placeholder="<?php esc_html_e( 'Last Name', 'give' ); ?>"/> |
| 398 |
<?php if ( $donor->user_id ) : ?> |
| 399 |
<a href="#" class="give-lock-block"> |
| 400 |
<i class="give-icon give-icon-locked"></i> |
| 401 |
</a> |
| 402 |
<?php endif; ?> |
| 403 |
</span> |
| 404 |
<span class="donor-name info-item editable"> |
| 405 |
<span data-key="name"><?php echo esc_html( $donor->name ); ?></span> |
| 406 |
</span> |
| 407 |
</div> |
| 408 |
<p class="donor-since info-item"> |
| 409 |
<?php esc_html_e( 'Donor since', 'give' ); ?> |
| 410 |
<?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ); ?> |
| 411 |
</p> |
| 412 |
<?php if ( current_user_can( $donor_edit_role ) ) : ?> |
| 413 |
<a href="#" id="edit-donor" class="button info-item editable donor-edit-link"> |
| 414 |
<?php esc_html_e( 'Edit Donor', 'give' ); ?> |
| 415 |
</a> |
| 416 |
<?php endif; ?> |
| 417 |
</div> |
| 418 |
<!-- /donor-bio-header --> |
| 419 |
|
| 420 |
<div class="donor-main-wrapper"> |
| 421 |
|
| 422 |
<table class="widefat striped"> |
| 423 |
<tbody> |
| 424 |
<tr> |
| 425 |
<th scope="col"><label for="tablecell"><?php esc_html_e( 'Donor ID:', 'give' ); ?></label> |
| 426 |
</th> |
| 427 |
<td><?php echo intval( $donor->id ); ?></td> |
| 428 |
</tr> |
| 429 |
<tr> |
| 430 |
<th scope="col"><label for="tablecell"><?php esc_html_e( 'User ID:', 'give' ); ?></label> |
| 431 |
</th> |
| 432 |
<td> |
| 433 |
<span class="donor-user-id info-item edit-item"> |
| 434 |
<?php |
| 435 |
|
| 436 |
$user_id = $donor->user_id > 0 ? $donor->user_id : ''; |
| 437 |
|
| 438 |
$data_atts = array( |
| 439 |
'key' => 'user_login', |
| 440 |
'search-type' => 'user', |
| 441 |
); |
| 442 |
$user_args = array( |
| 443 |
'name' => 'donor_info[user_id]', |
| 444 |
'class' => 'give-user-dropdown', |
| 445 |
'data' => $data_atts, |
| 446 |
); |
| 447 |
|
| 448 |
if ( ! empty( $user_id ) ) { |
| 449 |
$userdata = get_userdata( $user_id ); |
| 450 |
$user_args['selected'] = $user_id; |
| 451 |
} |
| 452 |
|
| 453 |
echo Give()->html->ajax_user_search( $user_args ); |
| 454 |
?> |
| 455 |
</span> |
| 456 |
|
| 457 |
<span class="donor-user-id info-item editable"> |
| 458 |
<?php if ( ! empty( $userdata ) ) : ?> |
| 459 |
<span |
| 460 |
data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span> |
| 461 |
<?php else : ?> |
| 462 |
<span |
| 463 |
data-key="user_id"><?php esc_html_e( 'Unregistered', 'give' ); ?></span> |
| 464 |
<?php endif; ?> |
| 465 |
<?php |
| 466 |
if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ) : |
| 467 |
|
| 468 |
echo sprintf( |
| 469 |
'- <span class="disconnect-user"> |
| 470 |
<a id="disconnect-donor" href="#disconnect" aria-label="%1$s">%2$s</a> |
| 471 |
</span> | |
| 472 |
<span class="view-user-profile"> |
| 473 |
<a id="view-user-profile" href="%3$s" aria-label="%4$s">%5$s</a> |
| 474 |
</span>', |
| 475 |
esc_html__( 'Disconnects the current user ID from this donor record.', 'give' ), |
| 476 |
esc_html__( 'Disconnect User', 'give' ), |
| 477 |
esc_url( 'user-edit.php?user_id=' . $donor->user_id ), |
| 478 |
esc_html__( 'View User Profile of current user ID.', 'give' ), |
| 479 |
esc_html__( 'View User Profile', 'give' ) |
| 480 |
); |
| 481 |
|
| 482 |
endif; |
| 483 |
?> |
| 484 |
</span> |
| 485 |
</td> |
| 486 |
</tr> |
| 487 |
|
| 488 |
<?php |
| 489 |
|
| 490 |
$donor_phone_number = Donor::find($donor->id)->phone; |
| 491 |
?> |
| 492 |
<tr class="alternate"> |
| 493 |
<th scope="col"> |
| 494 |
<label for="tablecell"><?php |
| 495 |
esc_html_e('Phone:', 'give'); ?></label> |
| 496 |
</th> |
| 497 |
<td> |
| 498 |
<span class="donor-user-id info-item edit-item"> |
| 499 |
<?php |
| 500 |
echo IntlTelInput::getHtmlInput($donor_phone_number, "give_donor_phone_number"); ?> |
| 501 |
</span> |
| 502 |
|
| 503 |
<span class="donor-user-id info-item editable"> |
| 504 |
<?php |
| 505 |
echo esc_html( $donor_phone_number ); ?> |
| 506 |
</span> |
| 507 |
</td> |
| 508 |
</tr> |
| 509 |
<?php |
| 510 |
$donor_company = $donor->get_meta( '_give_donor_company', true ); |
| 511 |
?> |
| 512 |
<tr class=""> |
| 513 |
<th scope="col"> |
| 514 |
<label for="tablecell"><?php esc_html_e( 'Company Name:', 'give' ); ?></label> |
| 515 |
</th> |
| 516 |
<td> |
| 517 |
<span class="donor-user-id info-item edit-item"> |
| 518 |
<input name="give_donor_company" value="<?php echo esc_attr( $donor_company ); ?>" type="text"> |
| 519 |
</span> |
| 520 |
|
| 521 |
<span class="donor-user-id info-item editable"> |
| 522 |
<?php echo esc_html( $donor_company ); ?> |
| 523 |
</span> |
| 524 |
</td> |
| 525 |
</tr> |
| 526 |
</tbody> |
| 527 |
</table> |
| 528 |
</div> |
| 529 |
|
| 530 |
</div> |
| 531 |
|
| 532 |
<span id="donor-edit-actions" class="edit-item"> |
| 533 |
<input type="hidden" data-key="id" name="donor_info[id]" value="<?php echo intval( $donor->id ); ?>"/> |
| 534 |
<?php wp_nonce_field( 'edit-donor', '_wpnonce', false, true ); ?> |
| 535 |
<input type="hidden" name="give_action" value="edit-donor"/> |
| 536 |
<input type="submit" id="give-edit-donor-save" class="button-secondary" |
| 537 |
value="<?php esc_html_e( 'Update Donor', 'give' ); ?>"/> |
| 538 |
<a id="give-edit-donor-cancel" href="" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
| 539 |
</span> |
| 540 |
|
| 541 |
</form> |
| 542 |
|
| 543 |
</div> |
| 544 |
|
| 545 |
<?php |
| 546 |
/** |
| 547 |
* Fires in donor profile screen, above the stats list. |
| 548 |
* |
| 549 |
* @since 1.0 |
| 550 |
* |
| 551 |
* @param Give_Donor $donor The donor object being displayed. |
| 552 |
*/ |
| 553 |
do_action( 'give_donor_before_stats', $donor ); |
| 554 |
?> |
| 555 |
|
| 556 |
<div id="donor-stats-wrapper" class="donor-section postbox clear"> |
| 557 |
<ul> |
| 558 |
<li> |
| 559 |
<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( $donor->id ) ); ?>"> |
| 560 |
<span class="dashicons dashicons-heart"></span> |
| 561 |
<?php |
| 562 |
// Completed Donations. |
| 563 |
$completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give' ), $donor->purchase_count ); |
| 564 |
echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $donor ); |
| 565 |
?> |
| 566 |
</a> |
| 567 |
</li> |
| 568 |
<li> |
| 569 |
<span class="dashicons dashicons-chart-area"></span> |
| 570 |
<?php echo give_currency_filter( give_format_amount( $donor->get_total_donation_amount(), array( 'sanitize' => false ) ) ); ?> <?php _e( 'Lifetime Donations', 'give' ); ?> |
| 571 |
</li> |
| 572 |
<?php |
| 573 |
/** |
| 574 |
* Fires in donor profile screen, in the stats list. |
| 575 |
* |
| 576 |
* Allows you to add more list items to the stats list. |
| 577 |
* |
| 578 |
* @since 1.0 |
| 579 |
* |
| 580 |
* @param object $donor The donor object being displayed. |
| 581 |
*/ |
| 582 |
do_action( 'give_donor_stats_list', $donor ); |
| 583 |
?> |
| 584 |
</ul> |
| 585 |
</div> |
| 586 |
|
| 587 |
<?php |
| 588 |
/** |
| 589 |
* Fires in donor profile screen, above the address list. |
| 590 |
* |
| 591 |
* @since 1.8.14 |
| 592 |
* |
| 593 |
* @param Give_Donor $donor The donor object being displayed. |
| 594 |
*/ |
| 595 |
do_action( 'give_donor_before_address', $donor ); |
| 596 |
?> |
| 597 |
|
| 598 |
<div id="donor-address-wrapper" class="donor-section clear"> |
| 599 |
<h3><?php _e( 'Addresses', 'give' ); ?></h3> |
| 600 |
|
| 601 |
<div class="postbox give-donor-addresses"> |
| 602 |
<div class="give-spinner-wrapper"> |
| 603 |
<span class="give-spinner spinner aligncenter"></span> |
| 604 |
</div> |
| 605 |
<div class="inside"> |
| 606 |
<div class="all-address"> |
| 607 |
<div class="give-grid-row"> |
| 608 |
<?php |
| 609 |
if ( ! empty( $donor->address ) ) : |
| 610 |
// Default address always will be at zero array index. |
| 611 |
$is_set_as_default = null; |
| 612 |
|
| 613 |
foreach ( $donor->address as $address_type => $addresses ) { |
| 614 |
|
| 615 |
switch ( true ) { |
| 616 |
case is_array( end( $addresses ) ): |
| 617 |
$index = 1; |
| 618 |
foreach ( $addresses as $id => $address ) { |
| 619 |
echo give_get_format_address( |
| 620 |
$address, |
| 621 |
array( |
| 622 |
'type' => $address_type, |
| 623 |
'id' => $id, |
| 624 |
'index' => $index, |
| 625 |
) |
| 626 |
); |
| 627 |
|
| 628 |
$index ++; |
| 629 |
} |
| 630 |
break; |
| 631 |
|
| 632 |
case is_string( end( $addresses ) ): |
| 633 |
echo give_get_format_address( |
| 634 |
$addresses, |
| 635 |
array( |
| 636 |
'type' => $address_type, |
| 637 |
) |
| 638 |
); |
| 639 |
break; |
| 640 |
} |
| 641 |
} |
| 642 |
endif; |
| 643 |
?> |
| 644 |
</div> |
| 645 |
<span class="give-no-address-message |
| 646 |
<?php |
| 647 |
if ( ! empty( $donor->address ) ) { |
| 648 |
echo ' give-hidden'; |
| 649 |
} |
| 650 |
?> |
| 651 |
"> |
| 652 |
<?php _e( 'This donor does not have any addresses saved.', 'give' ); ?> |
| 653 |
</span> |
| 654 |
<button class="button add-new-address"> |
| 655 |
<?php _e( 'Add Address', 'give' ); ?> |
| 656 |
</button> |
| 657 |
</div> |
| 658 |
|
| 659 |
<div class="address-form add-new-address-form-hidden"> |
| 660 |
<form action="" method="post"> |
| 661 |
<table class="widefat striped"> |
| 662 |
<tbody> |
| 663 |
<tr> |
| 664 |
<th class="col"> |
| 665 |
<label class="country"><?php esc_html_e( 'Country:', 'give' ); ?></label> |
| 666 |
</th> |
| 667 |
<td> |
| 668 |
<?php |
| 669 |
echo Give()->html->select( |
| 670 |
array( |
| 671 |
'options' => give_get_country_list(), |
| 672 |
'name' => 'country', |
| 673 |
'selected' => give_get_option( 'base_country' ), |
| 674 |
'show_option_all' => false, |
| 675 |
'show_option_none' => false, |
| 676 |
'chosen' => true, |
| 677 |
'placeholder' => esc_attr__( 'Select a country', 'give' ), |
| 678 |
'data' => array( 'search-type' => 'no_ajax' ), |
| 679 |
'autocomplete' => 'country', |
| 680 |
) |
| 681 |
); |
| 682 |
?> |
| 683 |
</td> |
| 684 |
</tr> |
| 685 |
<tr> |
| 686 |
<th class="col"> |
| 687 |
<label for="line1"><?php esc_html_e( 'Address 1:', 'give' ); ?></label> |
| 688 |
</th> |
| 689 |
<td> |
| 690 |
<input id="line1" name="line1" type="text" class="medium-text"/> |
| 691 |
</td> |
| 692 |
</tr> |
| 693 |
<tr> |
| 694 |
<th class="col"> |
| 695 |
<label for="line2"><?php esc_html_e( 'Address 2:', 'give' ); ?></label> |
| 696 |
</th> |
| 697 |
<td> |
| 698 |
<input id="line2" type="text" name="line2" value="" class="medium-text"/> |
| 699 |
|
| 700 |
</td> |
| 701 |
</tr> |
| 702 |
<tr> |
| 703 |
<th class="col"> |
| 704 |
<label for="city"><?php esc_html_e( 'City:', 'give' ); ?></label> |
| 705 |
</th> |
| 706 |
<td> |
| 707 |
<input id="city" type="text" name="city" value="" class="medium-text"/> |
| 708 |
</td> |
| 709 |
</tr> |
| 710 |
<?php |
| 711 |
$no_states_country = give_no_states_country_list(); |
| 712 |
$base_country = give_get_option( 'base_country' ); |
| 713 |
if ( ! array_key_exists( $base_country, $no_states_country ) ) { |
| 714 |
?> |
| 715 |
<tr class="give-field-wrap"> |
| 716 |
<th class="col"> |
| 717 |
<label |
| 718 |
for="state"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label> |
| 719 |
</th> |
| 720 |
<td> |
| 721 |
<?php |
| 722 |
$states = give_get_states( $base_country ); |
| 723 |
$state_args = array( |
| 724 |
'name' => 'state', |
| 725 |
'class' => 'regular-text', |
| 726 |
'autocomplete' => 'address-level1', |
| 727 |
); |
| 728 |
|
| 729 |
if ( empty( $states ) ) { |
| 730 |
|
| 731 |
// Show Text field, if empty states. |
| 732 |
$state_args = wp_parse_args( |
| 733 |
$state_args, |
| 734 |
array( |
| 735 |
'value' => give_get_option( 'base_state' ), |
| 736 |
) |
| 737 |
); |
| 738 |
echo Give()->html->text( $state_args ); |
| 739 |
} else { |
| 740 |
|
| 741 |
// Show Chosen DropDown, if states are not empty. |
| 742 |
$state_args = wp_parse_args( |
| 743 |
$state_args, |
| 744 |
array( |
| 745 |
'options' => $states, |
| 746 |
'selected' => give_get_option( 'base_state' ), |
| 747 |
'show_option_all' => false, |
| 748 |
'show_option_none' => false, |
| 749 |
'chosen' => true, |
| 750 |
'placeholder' => __( 'Select a state', 'give' ), |
| 751 |
'data' => array( 'search-type' => 'no_ajax' ), |
| 752 |
) |
| 753 |
); |
| 754 |
echo Give()->html->select( $state_args ); |
| 755 |
} |
| 756 |
?> |
| 757 |
</td> |
| 758 |
</tr> |
| 759 |
<?php |
| 760 |
} |
| 761 |
?> |
| 762 |
<tr> |
| 763 |
<th class="col"> |
| 764 |
<label for="zip"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label> |
| 765 |
</th> |
| 766 |
<td> |
| 767 |
<input id="zip" type="text" name="zip" value="" class="medium-text"/> |
| 768 |
</td> |
| 769 |
</tr> |
| 770 |
<tr> |
| 771 |
<td colspan="2"> |
| 772 |
<?php wp_nonce_field( 'give-manage-donor-addresses', '_wpnonce', false ); ?> |
| 773 |
<input type="hidden" name="address-action" value="add"> |
| 774 |
<input type="hidden" name="address-id" value=""> |
| 775 |
<input type="submit" class="button button-primary js-save" |
| 776 |
value="<?php _e( 'Save', 'give' ); ?>"> <button |
| 777 |
class="button js-cancel"><?php _e( 'Cancel', 'give' ); ?></button> |
| 778 |
</td> |
| 779 |
</tr> |
| 780 |
</tbody> |
| 781 |
</table> |
| 782 |
</form> |
| 783 |
</div> |
| 784 |
</div> |
| 785 |
</div> |
| 786 |
</div> |
| 787 |
|
| 788 |
<?php |
| 789 |
/** |
| 790 |
* Fires in donor profile screen, above the tables wrapper. |
| 791 |
* |
| 792 |
* @since 1.0 |
| 793 |
* |
| 794 |
* @param Give_Donor $donor The donor object being displayed. |
| 795 |
*/ |
| 796 |
do_action( 'give_donor_before_tables_wrapper', $donor ); |
| 797 |
?> |
| 798 |
|
| 799 |
<div id="donor-tables-wrapper" class="donor-section"> |
| 800 |
|
| 801 |
<?php |
| 802 |
/** |
| 803 |
* Fires in donor profile screen, above the tables. |
| 804 |
* |
| 805 |
* @since 1.0 |
| 806 |
* |
| 807 |
* @param object $donor The donor object being displayed. |
| 808 |
*/ |
| 809 |
do_action( 'give_donor_before_tables', $donor ); |
| 810 |
?> |
| 811 |
|
| 812 |
<h3><?php _e( 'Donor Emails', 'give' ); ?></h3> |
| 813 |
|
| 814 |
<table class="wp-list-table widefat striped emails"> |
| 815 |
<thead> |
| 816 |
<tr> |
| 817 |
<th><?php _e( 'Email', 'give' ); ?></th> |
| 818 |
<th><?php _e( 'Actions', 'give' ); ?></th> |
| 819 |
</tr> |
| 820 |
</thead> |
| 821 |
|
| 822 |
<tbody> |
| 823 |
<?php if ( ! empty( $donor->emails ) ) { ?> |
| 824 |
|
| 825 |
<?php foreach ( $donor->emails as $key => $email ) : ?> |
| 826 |
<tr data-key="<?php echo $key; ?>"> |
| 827 |
<td> |
| 828 |
<?php echo esc_html( $email ); ?> |
| 829 |
<?php if ( 'primary' === $key ) : ?> |
| 830 |
<span class="dashicons dashicons-star-filled primary-email-icon"></span> |
| 831 |
<?php endif; ?> |
| 832 |
</td> |
| 833 |
<td> |
| 834 |
<?php if ( 'primary' !== $key ) : ?> |
| 835 |
<?php |
| 836 |
$base_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=legacy-overview&id=' . $donor->id ); |
| 837 |
$promote_url = wp_nonce_url( |
| 838 |
add_query_arg( |
| 839 |
array( |
| 840 |
'email' => rawurlencode( $email ), |
| 841 |
'give_action' => 'set_donor_primary_email', |
| 842 |
), |
| 843 |
$base_url |
| 844 |
), |
| 845 |
'give-set-donor-primary-email' |
| 846 |
); |
| 847 |
$remove_url = wp_nonce_url( |
| 848 |
add_query_arg( |
| 849 |
array( |
| 850 |
'email' => rawurlencode( $email ), |
| 851 |
'give_action' => 'remove_donor_email', |
| 852 |
), |
| 853 |
$base_url |
| 854 |
), |
| 855 |
'give-remove-donor-email' |
| 856 |
); |
| 857 |
?> |
| 858 |
<a href="<?php echo esc_url( $promote_url ); ?>"><?php _e( 'Make Primary', 'give' ); ?></a> |
| 859 |
| |
| 860 |
<a href="<?php echo esc_url( $remove_url ); ?>" class="delete"><?php _e( 'Remove', 'give' ); ?></a> |
| 861 |
<?php endif; ?> |
| 862 |
</td> |
| 863 |
</tr> |
| 864 |
<?php endforeach; ?> |
| 865 |
|
| 866 |
<tr class="add-donor-email-row"> |
| 867 |
<td colspan="2" class="add-donor-email-td"> |
| 868 |
<div class="add-donor-email-wrapper"> |
| 869 |
<input type="hidden" name="donor-id" value="<?php echo $donor->id; ?>"/> |
| 870 |
<?php wp_nonce_field( 'give_add_donor_email', 'add_email_nonce', false, true ); ?> |
| 871 |
<input type="email" name="additional-email" value="" |
| 872 |
placeholder="<?php _e( 'Email Address', 'give' ); ?>"/> |
| 873 |
<input type="checkbox" name="make-additional-primary" value="1" |
| 874 |
id="make-additional-primary"/> <label |
| 875 |
for="make-additional-primary"><?php _e( 'Make Primary', 'give' ); ?></label> |
| 876 |
<button class="button-secondary give-add-donor-email" |
| 877 |
id="add-donor-email"><?php _e( 'Add Email', 'give' ); ?></button> |
| 878 |
<span class="spinner"></span> |
| 879 |
</div> |
| 880 |
<div class="notice-wrap"></div> |
| 881 |
</td> |
| 882 |
</tr> |
| 883 |
<?php } else { ?> |
| 884 |
<tr> |
| 885 |
<td colspan="2"><?php _e( 'No Emails Found', 'give' ); ?></td> |
| 886 |
</tr> |
| 887 |
<?php |
| 888 |
}// End if(). |
| 889 |
?> |
| 890 |
</tbody> |
| 891 |
</table> |
| 892 |
|
| 893 |
<h3><?php _e( 'Recent Donations', 'give' ); ?></h3> |
| 894 |
<?php |
| 895 |
$payment_ids = explode( ',', $donor->payment_ids ); |
| 896 |
$payments = give_get_payments( |
| 897 |
array( |
| 898 |
'post__in' => $payment_ids, |
| 899 |
) |
| 900 |
); |
| 901 |
$payments = array_slice( $payments, 0, 10 ); |
| 902 |
?> |
| 903 |
<table class="wp-list-table widefat striped payments"> |
| 904 |
<thead> |
| 905 |
<tr> |
| 906 |
<th scope="col"><?php _e( 'ID', 'give' ); ?></th> |
| 907 |
<th scope="col"><?php _e( 'Amount', 'give' ); ?></th> |
| 908 |
<th scope="col"><?php _e( 'Date', 'give' ); ?></th> |
| 909 |
<th scope="col"><?php _e( 'Status', 'give' ); ?></th> |
| 910 |
<th scope="col"><?php _e( 'Actions', 'give' ); ?></th> |
| 911 |
</tr> |
| 912 |
</thead> |
| 913 |
<tbody> |
| 914 |
<?php if ( ! empty( $payments ) ) { ?> |
| 915 |
<?php foreach ( $payments as $payment ) : ?> |
| 916 |
<tr> |
| 917 |
<td><?php echo Give()->seq_donation_number->get_serial_code( $payment->ID ); ?></td> |
| 918 |
<td> |
| 919 |
<?php |
| 920 |
echo give_donation_amount( |
| 921 |
$payment->ID, |
| 922 |
array( |
| 923 |
'currency' => true, |
| 924 |
'amount' => true, |
| 925 |
'type' => 'donor', |
| 926 |
) |
| 927 |
); |
| 928 |
?> |
| 929 |
</td> |
| 930 |
<td><?php echo date_i18n( give_date_format(), strtotime( $payment->post_date ) ); ?></td> |
| 931 |
<td><?php echo give_get_payment_status( $payment, true ); ?></td> |
| 932 |
<td> |
| 933 |
<?php |
| 934 |
printf( |
| 935 |
'<a href="%1$s" aria-label="%2$s">%3$s</a>', |
| 936 |
admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment->ID ), |
| 937 |
sprintf( |
| 938 |
/* translators: %s: Donation ID */ |
| 939 |
esc_attr__( 'View Donation %s.', 'give' ), |
| 940 |
$payment->ID |
| 941 |
), |
| 942 |
__( 'View Donation', 'give' ) |
| 943 |
); |
| 944 |
?> |
| 945 |
|
| 946 |
<?php |
| 947 |
/** |
| 948 |
* Fires in donor profile screen, in the recent donations tables action links. |
| 949 |
* |
| 950 |
* Allows you to add more action links for each donation, after the 'View Donation' action link. |
| 951 |
* |
| 952 |
* @since 1.0 |
| 953 |
* |
| 954 |
* @param object $donor The donor object being displayed. |
| 955 |
* @param object $payment The payment object being displayed. |
| 956 |
*/ |
| 957 |
do_action( 'give_donor_recent_purchases_actions', $donor, $payment ); |
| 958 |
?> |
| 959 |
</td> |
| 960 |
</tr> |
| 961 |
<?php endforeach; ?> |
| 962 |
<?php } else { ?> |
| 963 |
<tr> |
| 964 |
<td colspan="5"><?php _e( 'No donations found.', 'give' ); ?></td> |
| 965 |
</tr> |
| 966 |
<?php |
| 967 |
}// End if(). |
| 968 |
?> |
| 969 |
</tbody> |
| 970 |
</table> |
| 971 |
|
| 972 |
<h3><?php _e( 'Completed Forms', 'give' ); ?></h3> |
| 973 |
<?php |
| 974 |
$donations = give_get_users_completed_donations( $donor->email ); |
| 975 |
?> |
| 976 |
<table class="wp-list-table widefat striped donations"> |
| 977 |
<thead> |
| 978 |
<tr> |
| 979 |
<th scope="col"><?php _e( 'Form', 'give' ); ?></th> |
| 980 |
<th scope="col" width="120px"><?php _e( 'Actions', 'give' ); ?></th> |
| 981 |
</tr> |
| 982 |
</thead> |
| 983 |
<tbody> |
| 984 |
<?php if ( ! empty( $donations ) ) { ?> |
| 985 |
<?php foreach ( $donations as $donation ) : ?> |
| 986 |
<tr> |
| 987 |
<td><?php echo $donation->post_title; ?></td> |
| 988 |
<td> |
| 989 |
<?php |
| 990 |
printf( |
| 991 |
'<a href="%1$s" aria-label="%2$s">%3$s</a>', |
| 992 |
esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ), |
| 993 |
sprintf( |
| 994 |
/* translators: %s: form name */ |
| 995 |
esc_attr__( 'View Form %s.', 'give' ), |
| 996 |
$donation->post_title |
| 997 |
), |
| 998 |
__( 'View Form', 'give' ) |
| 999 |
); |
| 1000 |
?> |
| 1001 |
</td> |
| 1002 |
</tr> |
| 1003 |
<?php endforeach; ?> |
| 1004 |
<?php } else { ?> |
| 1005 |
<tr> |
| 1006 |
<td colspan="2"><?php _e( 'No completed donations found.', 'give' ); ?></td> |
| 1007 |
</tr> |
| 1008 |
<?php } ?> |
| 1009 |
</tbody> |
| 1010 |
</table> |
| 1011 |
<?php |
| 1012 |
/** |
| 1013 |
* Fires in donor profile screen, below the tables. |
| 1014 |
* |
| 1015 |
* @since 1.0 |
| 1016 |
* |
| 1017 |
* @param object $donor The donor object being displayed. |
| 1018 |
*/ |
| 1019 |
do_action( 'give_donor_after_tables', $donor ); |
| 1020 |
?> |
| 1021 |
|
| 1022 |
</div> |
| 1023 |
|
| 1024 |
<?php |
| 1025 |
/** |
| 1026 |
* Fires in donor profile screen, below the donor card. |
| 1027 |
* |
| 1028 |
* @since 1.0 |
| 1029 |
* |
| 1030 |
* @param object $donor The donor object being displayed. |
| 1031 |
*/ |
| 1032 |
do_action( 'give_donor_card_bottom', $donor ); |
| 1033 |
|
| 1034 |
} |
| 1035 |
|
| 1036 |
/** |
| 1037 |
* View the notes of a donor. |
| 1038 |
* |
| 1039 |
* @since 4.16.6 Escaped the donor name output in the donor notes header. |
| 1040 |
* @since 4.6.0 Escape donor note |
| 1041 |
* @since 1.0 |
| 1042 |
* |
| 1043 |
* @param Give_Donor $donor The donor object being displayed. |
| 1044 |
* |
| 1045 |
* @return void |
| 1046 |
*/ |
| 1047 |
function give_donor_notes_view( $donor ) { |
| 1048 |
|
| 1049 |
$paged = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1; |
| 1050 |
$paged = absint( $paged ); |
| 1051 |
$note_count = $donor->get_notes_count(); |
| 1052 |
$per_page = apply_filters( 'give_donor_notes_per_page', 20 ); |
| 1053 |
$total_pages = ceil( $note_count / $per_page ); |
| 1054 |
$donor_notes = $donor->get_notes( $per_page, $paged ); |
| 1055 |
?> |
| 1056 |
|
| 1057 |
<div id="donor-notes-wrapper"> |
| 1058 |
<div class="donor-notes-header"> |
| 1059 |
<?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo esc_html( $donor->name ); ?></span> |
| 1060 |
</div> |
| 1061 |
<h3><?php _e( 'Notes', 'give' ); ?></h3> |
| 1062 |
|
| 1063 |
<?php if ( 1 == $paged ) : ?> |
| 1064 |
<div style="display: block; margin-bottom: 55px;"> |
| 1065 |
<form id="give-add-donor-note" method="post" |
| 1066 |
action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor->id ); ?>"> |
| 1067 |
<textarea id="donor-note" name="donor_note" class="donor-note-input" rows="10"></textarea> |
| 1068 |
<br/> |
| 1069 |
<input type="hidden" id="donor-id" name="customer_id" value="<?php echo $donor->id; ?>"/> |
| 1070 |
<input type="hidden" name="give_action" value="add-donor-note"/> |
| 1071 |
<?php wp_nonce_field( 'add-donor-note', 'add_donor_note_nonce', true, true ); ?> |
| 1072 |
<input id="add-donor-note" class="right button-primary" type="submit" value="Add Note"/> |
| 1073 |
</form> |
| 1074 |
</div> |
| 1075 |
<?php endif; ?> |
| 1076 |
|
| 1077 |
<?php |
| 1078 |
$pagination_args = array( |
| 1079 |
'base' => '%_%', |
| 1080 |
'format' => '?paged=%#%', |
| 1081 |
'total' => $total_pages, |
| 1082 |
'current' => $paged, |
| 1083 |
'show_all' => true, |
| 1084 |
); |
| 1085 |
|
| 1086 |
echo paginate_links( $pagination_args ); |
| 1087 |
?> |
| 1088 |
|
| 1089 |
<div id="give-donor-notes" class="postbox"> |
| 1090 |
<?php if ( count( $donor_notes ) > 0 ) { ?> |
| 1091 |
<?php foreach ( $donor_notes as $key => $note ) : ?> |
| 1092 |
<div class="donor-note-wrapper dashboard-comment-wrap comment-item"> |
| 1093 |
<span class="note-content-wrap"> |
| 1094 |
<?php echo stripslashes( esc_html( $note ) ); ?> |
| 1095 |
</span> |
| 1096 |
</div> |
| 1097 |
<?php endforeach; ?> |
| 1098 |
<?php } else { ?> |
| 1099 |
<div class="give-no-donor-notes"> |
| 1100 |
<?php _e( 'No donor notes found.', 'give' ); ?> |
| 1101 |
</div> |
| 1102 |
<?php } ?> |
| 1103 |
</div> |
| 1104 |
|
| 1105 |
<?php echo paginate_links( $pagination_args ); ?> |
| 1106 |
|
| 1107 |
</div> |
| 1108 |
|
| 1109 |
<?php |
| 1110 |
} |
| 1111 |
|
| 1112 |
/** |
| 1113 |
* The donor delete view. |
| 1114 |
* |
| 1115 |
* @since 4.16.6 Escaped the donor name output in the delete donor view. |
| 1116 |
* @since 1.0 |
| 1117 |
* |
| 1118 |
* @param object $donor The donor object being displayed. |
| 1119 |
* |
| 1120 |
* @return void |
| 1121 |
*/ |
| 1122 |
function give_donor_delete_view( $donor ) { |
| 1123 |
|
| 1124 |
$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
| 1125 |
|
| 1126 |
/** |
| 1127 |
* Fires in donor delete screen, above the content. |
| 1128 |
* |
| 1129 |
* @since 1.0 |
| 1130 |
* |
| 1131 |
* @param object $donor The donor object being displayed. |
| 1132 |
*/ |
| 1133 |
do_action( 'give_donor_delete_top', $donor ); |
| 1134 |
?> |
| 1135 |
|
| 1136 |
<div class="info-wrapper donor-section"> |
| 1137 |
|
| 1138 |
<form id="delete-donor" method="post" |
| 1139 |
action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor->id ); ?>"> |
| 1140 |
|
| 1141 |
<div class="donor-notes-header"> |
| 1142 |
<?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo esc_html( $donor->name ); ?></span> |
| 1143 |
</div> |
| 1144 |
|
| 1145 |
|
| 1146 |
<div class="donor-info delete-donor"> |
| 1147 |
|
| 1148 |
<span class="delete-donor-options"> |
| 1149 |
<p> |
| 1150 |
<?php |
| 1151 |
echo Give()->html->checkbox( |
| 1152 |
array( |
| 1153 |
'name' => 'give-donor-delete-confirm', |
| 1154 |
) |
| 1155 |
); |
| 1156 |
?> |
| 1157 |
<label |
| 1158 |
for="give-donor-delete-confirm"><?php _e( 'Are you sure you want to delete this donor?', 'give' ); ?></label> |
| 1159 |
</p> |
| 1160 |
|
| 1161 |
<p> |
| 1162 |
<?php |
| 1163 |
echo Give()->html->checkbox( |
| 1164 |
array( |
| 1165 |
'name' => 'give-donor-delete-records', |
| 1166 |
'options' => array( |
| 1167 |
'disabled' => true, |
| 1168 |
), |
| 1169 |
) |
| 1170 |
); |
| 1171 |
?> |
| 1172 |
<label |
| 1173 |
for="give-donor-delete-records"><?php _e( 'Delete all associated donations and records?', 'give' ); ?></label> |
| 1174 |
</p> |
| 1175 |
|
| 1176 |
<?php |
| 1177 |
/** |
| 1178 |
* Fires in donor delete screen, bellow the delete inputs. |
| 1179 |
* |
| 1180 |
* Allows you to add custom delete inputs. |
| 1181 |
* |
| 1182 |
* @since 1.0 |
| 1183 |
* |
| 1184 |
* @param object $donor The donor object being displayed. |
| 1185 |
*/ |
| 1186 |
do_action( 'give_donor_delete_inputs', $donor ); |
| 1187 |
?> |
| 1188 |
</span> |
| 1189 |
|
| 1190 |
<span id="donor-edit-actions"> |
| 1191 |
<input type="hidden" name="donor_id" value="<?php echo $donor->id; ?>"/> |
| 1192 |
<?php wp_nonce_field( 'give-delete-donor', '_wpnonce', false, true ); ?> |
| 1193 |
<input type="hidden" name="give_action" value="delete_donor"/> |
| 1194 |
<input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary" |
| 1195 |
value="<?php _e( 'Delete Donor', 'give' ); ?>"/> |
| 1196 |
<a id="give-delete-donor-cancel" |
| 1197 |
href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=legacy-overview&id=' . $donor->id ); ?>" |
| 1198 |
class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
| 1199 |
</span> |
| 1200 |
|
| 1201 |
</div> |
| 1202 |
|
| 1203 |
</form> |
| 1204 |
</div> |
| 1205 |
|
| 1206 |
<?php |
| 1207 |
/** |
| 1208 |
* Fires in donor delete screen, bellow the content. |
| 1209 |
* |
| 1210 |
* @since 1.0 |
| 1211 |
* |
| 1212 |
* @param object $donor The donor object being displayed. |
| 1213 |
*/ |
| 1214 |
do_action( 'give_donor_delete_bottom', $donor ); |
| 1215 |
} |
| 1216 |
|