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