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