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 }