• 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_render_customer_view() – Renders the customer view wrapper

You appear to be a bot. Output may be restricted

Description

Renders the customer view wrapper

Usage

$void = edd_render_customer_view( $view, $callbacks );

Parameters

$view
( string ) required – The View being requested
$callbacks
( array ) required – The Registered views and their callback functions

Returns

void

Source

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

1 to 90 of 90
function edd_render_customer_view( $view, $callbacks ) {

  $render = true;

  $customer_view_role = apply_filters( 'edd_view_customers_role', 'view_shop_reports' );

  if ( ! current_user_can( $customer_view_role ) ) {
    edd_set_error( 'edd-no-access', __( 'You are not permitted to view this data.', 'easy-digital-downloads' ) );
    $render = false;
  }

  if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
    edd_set_error( 'edd-invalid_customer', __( 'Invalid Customer ID Provided.', 'easy-digital-downloads' ) );
    $render = false;
  }

  $customer_id = (int)$_GET['id'];
  $customer    = new EDD_Customer( $customer_id );

  if ( empty( $customer->id ) ) {
    edd_set_error( 'edd-invalid_customer', __( 'Invalid Customer ID Provided.', 'easy-digital-downloads' ) );
    $render = false;
  }

  $customer_tabs = edd_customer_tabs();
  ?>

	<div class='wrap'>
		<h2>
			<?php _e( 'Customer Details', 'easy-digital-downloads' ); ?>
			<?php do_action( 'edd_after_customer_details_header', $customer ); ?>
		</h2>
		<?php if ( edd_get_errors() ) :?>
			<div class="error settings-error">
				<?php edd_print_errors(); ?>
			</div>
		<?php endif; ?>

		<?php if ( $customer && $render ) : ?>

			<div id="edd-item-wrapper" class="edd-item-has-tabs edd-clearfix">
				<div id="edd-item-tab-wrapper" class="customer-tab-wrapper">
					<ul id="edd-item-tab-wrapper-list" class="customer-tab-wrapper-list">
						<?php foreach ( $customer_tabs as $key => $tab ) : ?>
							<?php $active = $key === $view ? true : false; ?>
							<?php $class  = $active ? 'active' : 'inactive'; ?>

							<li class="<?php echo sanitize_html_class( $class ); ?>">

								<?php
                // prevent double "Customer" output from extensions
                $tab['title'] = preg_replace("(^Customer )","",$tab['title']);

                // edd item tab full title
                $tab_title = sprintf( _x( 'Customer %s', 'Customer Details page tab title', 'easy-digital-downloads' ), esc_attr( $tab[ 'title' ] ) );

                // aria-label output
                $aria_label = ' aria-label="' . $tab_title . '"';
                ?>

								<?php if ( ! $active ) : ?>
									<a href="<?php echo esc_url( admin_url( 'edit.php?post_type=download&page=edd-customers&view=' . $key . '&id=' . $customer->id . '#wpbody-content' ) ); ?>"<?php echo $aria_label; ?>>
								<?php endif; ?>

									<span class="edd-item-tab-label-wrap"<?php echo $active ? $aria_label : ''; ?>>
										<span class="dashicons <?php echo sanitize_html_class( $tab['dashicon'] ); ?>" aria-hidden="true"></span>
										<span class="edd-item-tab-label"><?php echo esc_attr( $tab['title'] ); ?></span>
									</span>

								<?php if ( ! $active ) : ?>
									</a>
								<?php endif; ?>

							</li>

						<?php endforeach; ?>
					</ul>
				</div>

				<div id="edd-item-card-wrapper" class="edd-customer-card-wrapper" style="float: left">
					<?php call_user_func( $callbacks[ $view ], $customer ); ?>
				</div>
			</div>

		<?php endif; ?>

	</div>
	<?php

}
 

 View on GitHub View on Trac

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

Primary Sidebar

Information

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

Footer

Easy Digital Downloads a2z
Easy Digital Downloads a2z
Easy Digital Downloads a2z
WordPress 5.9.3
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-2022. All rights reserved.


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

  • Home
  • Blog
  • Sitemap
  • Sites