• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Easy Digital Downloads a2z

Easy Digital Downloads a2z

Easy Digital Downloads a2z

  • Home
  • Plugins
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / edd_customer_notes_view() – View the notes of a customer

You appear to be a bot. Output may be restricted

Description

View the notes of a customer

Usage

$void = edd_customer_notes_view( $customer );

Parameters

$customer
( mixed ) required –

Returns

void

Source

File name: easy-digital-downloads/includes/admin/customers/customers.php
Lines:

1 to 100 of 144
function edd_customer_notes_view( $customer ) {

  $paged       = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1;
  $paged       = absint( $paged );
  $note_count  = $customer->get_notes_count();
  $per_page    = apply_filters( 'edd_customer_notes_per_page', 20 );
  $total_pages = ceil( $note_count / $per_page );

  $customer_notes = $customer->get_notes( $per_page, $paged );
  ?>

	<div id="edd-item-notes-wrapper">
		<div class="edd-item-notes-header">
			<?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span>
		</div>
		<?php
    $show_agree_to_terms   = edd_get_option( 'show_agree_to_terms', false );
    $show_agree_to_privacy = edd_get_option( 'show_agree_to_privacy_policy', false );

    $agreement_timestamps = $customer->get_meta( 'agree_to_terms_time', false );
    $privacy_timestamps   = $customer->get_meta( 'agree_to_privacy_time', false );

    $payments = edd_get_payments( array(
      'output'         => 'payments',
      'post__in'       => explode( ',', $customer->payment_ids ),
      'orderby'        => 'date',
      'posts_per_page' => 1
    ));

    $last_payment_date = '';

    foreach ( $payments as $payment ) {
      if ( empty( $payment->gateway ) ) {
        continue;
      }

      // We should be using `date` here, as that is the date the button was clicked.
      $last_payment_date = strtotime( $payment->date );
      break;
    }

    if ( is_array( $agreement_timestamps ) ) {
      $agreement_timestamp = array_pop( $agreement_timestamps );
    }

    if ( is_array( $privacy_timestamps ) ) {
      $privacy_timestamp = array_pop( $privacy_timestamps );
    }

    ?>

		<h3><?php _e( 'Agreements', 'easy-digital-downloads' ); ?></h3>

		<span class="customer-terms-agreement-date info-item">
			<?php _e( 'Last Agreed to Terms', 'easy-digital-downloads' ); ?>:
			<?php if ( ! empty( $agreement_timestamp ) ) : ?>
				<?php echo date_i18n( get_option( 'date_format' ) . ' H:i:s', $agreement_timestamp ); ?>
				<?php if ( ! empty( $agreement_timestamps ) ) : ?>
					<span alt="f223" class="edd-help-tip dashicons dashicons-editor-help" title="<strong><?php _e( 'Previous Agreement Dates', 'easy-digital-downloads' ); ?></strong><br /><?php foreach ( $agreement_timestamps as $timestamp ) { echo date_i18n( get_option( 'date_format' ) . ' H:i:s', $timestamp ); } ?>"></span>
				<?php endif; ?>
			<?php else: ?>
				<?php
        if ( empty( $last_payment_date ) ) {
          _e( 'No date found.', 'easy-digital-downloads' );
        } else {
          echo date_i18n( get_option( 'date_format' ) . ' H:i:s', $last_payment_date );
          ?>
					<span alt="f223" class="edd-help-tip dashicons dashicons-editor-help" title="<strong><?php _e( 'Estimated Privacy Policy Date', 'easy-digital-downloads' ); ?></strong><br /><?php _e( 'This customer made a purchase prior to agreement dates being logged, this is the date of their last purchase. If your site was displaying the agreement checkbox at that time, this is our best estimate as to when they last agreed to your terms.', 'easy-digital-downloads' ); ?>"></span>
					<?php
        }
        ?>
			<?php endif; ?>
		</span>

		<span class="customer-privacy-policy-date info-item">
			<?php _e( 'Last Agreed to Privacy Policy', 'easy-digital-downloads' ); ?>:
			<?php if ( ! empty( $privacy_timestamp ) ) : ?>
				<?php echo date_i18n( get_option( 'date_format' ) . ' H:i:s', $privacy_timestamp ); ?>
				<?php if ( ! empty( $privacy_timestamps ) ) : ?>
					<span alt="f223" class="edd-help-tip dashicons dashicons-editor-help" title="<strong><?php _e( 'Previous Agreement Dates', 'easy-digital-downloads' ); ?></strong><br /><?php foreach ( $privacy_timestamps as $timestamp ) { echo date_i18n( get_option( 'date_format' ) . ' H:i:s', $timestamp ); } ?>"></span>
				<?php endif; ?>
			<?php else: ?>
				<?php
        if ( empty( $last_payment_date ) ) {
          _e( 'No date found.', 'easy-digital-downloads' );
        } else {
          echo date_i18n( get_option( 'date_format' ) . ' H:i:s', $last_payment_date );
          ?>
					<span alt="f223" class="edd-help-tip dashicons dashicons-editor-help" title="<strong><?php _e( 'Estimated Privacy Policy Date', 'easy-digital-downloads' ); ?></strong><br /><?php _e( 'This customer made a purchase prior to privacy policy dates being logged, this is the date of their last purchase. If your site was displaying the privacy policy checkbox at that time, this is our best estimate as to when they last agreed to your privacy policy.', 'easy-digital-downloads' ); ?>"></span>
					<?php
        }
        ?>
			<?php endif; ?>
		</span>

		<h3><?php _e( 'Notes', 'easy-digital-downloads' ); ?></h3>

		<?php if ( 1 == $paged ) : ?>
		<div style="display: block; margin-bottom: 35px;">
			<form id="edd-add-customer-note" method="post" action="<?php echo admin_url( 'edit.php?post_type=download&page=edd-customers&view=notes&id=' . $customer->id ); ?>">
 
[1] [2] Next »

 View on GitHub View on Trac

Published: 26th November 2019 | Last updated: 26th November 2019

Primary Sidebar

Information

Function name: edd_customer_notes_view
Plugin ref: Easy Digital Downloads
Version: 2.9.20
Sourcefile: includes/admin/customers/customers.php
File ref: includes/admin/customers/customers.php
Deprecated?: No
API Letters: C,E,N,V

Footer

Easy Digital Downloads a2z Easy Digital Downloads a2z
Easy Digital Downloads a2z
WordPress 5.3.1
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  edd.wp-a2z.org
© Copyright Easy Digital Downloads a2z 2014-2019. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites