'',
'id' => null,
'index' => null,
'default_address' => false,
)
);
$address_id = $address_args['type'];
// Bailout.
if ( empty( $address ) || ! is_array( $address ) ) {
return $address_html;
}
// Address html.
$address_html = '';
$address_html .= sprintf(
'%1$s %2$s',
$address['line1'],
( ! empty( $address['line2'] ) ? ' ' : '' )
);
$address_html .= sprintf(
'%1$s %2$s',
$address['line2'],
( ! empty( $address['city'] ) ? ' ' : '' )
);
$address_html .= sprintf(
'%1$s %2$s %3$s %4$s',
$address['city'],
( ! empty( $address['state'] ) ? ", {$address['state']}" : '' ),
( ! empty( $address['zip'] ) ? " {$address['zip']}" : '' ),
( ! empty( $address['country'] ) ? ' ' : '' )
);
$address_html .= sprintf(
'%s ',
$address['country']
);
// Address action.
$address_html .= sprintf(
'%1$s | %2$s ',
__( 'Edit', 'give' ),
__( 'Remove', 'give' )
);
/**
* Filter the address label
*
* @since 2.0
*/
$address_label = apply_filters( "give_donor_{$address_args['type']}_address_label", ucfirst( $address_args['type'] ), $address_args );
// Set unique id and index for multi type address.
if ( isset( $address_args['index'] ) ) {
$address_label = "{$address_label} #{$address_args['index']}";
}
if ( isset( $address_args['id'] ) ) {
$address_id = "{$address_id}_{$address_args['id']}";
}
// Add address wrapper.
$address_html = sprintf(
'
',
$address_id,
$address_label,
$address_html
);
return $address_html;
}
/**
* Donors Page.
*
* Renders the donors page contents.
*
* @since 1.0
* @return void
*/
function give_donors_page() {
$default_views = give_donor_views();
$requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'donors';
if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) {
give_render_donor_view( $requested_view, $default_views );
} else {
give_donors_list();
}
}
/**
* Register the views for donor management.
*
* @since 1.0
* @return array Array of views and their callbacks.
*/
function give_donor_views() {
$views = array();
return apply_filters( 'give_donor_views', $views );
}
/**
* Register the tabs for donor management.
*
* @since 1.0
* @return array Array of tabs for the donor.
*/
function give_donor_tabs() {
$tabs = array();
return apply_filters( 'give_donor_tabs', $tabs );
}
/**
* List table of donors.
*
* @since 1.0
* @return void
*/
function give_donors_list() {
include GIVE_PLUGIN_DIR . 'includes/admin/donors/class-donor-table.php';
$donors_table = new Give_Donor_List_Table();
$donors_table->prepare_items();
?>
$reconnect_user_id ), array() );
}
if ( empty( $donor->id ) ) {
give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) );
$render = false;
}
$donor_tabs = give_donor_tabs();
?>
notices->render_frontend_notices( 0 ); ?>
get_first_name(),
$donor->get_last_name()
);
?>
$tab ) :
$active = $key === $view ? true : false;
$class = $active ? 'nav-tab nav-tab-active' : 'nav-tab';
printf(
' %4$s ' . "\n",
esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $donor->id ) ),
esc_attr( $class ),
sanitize_html_class( $tab['dashicon'] ),
esc_html( $tab['title'] )
);
endforeach;
?>
user_id ) {
$read_only = 'readonly="readonly"';
}
// List of title prefixes.
$title_prefixes = give_get_name_title_prefixes();
// Prepend title prefix to name if it is set.
$title_prefix = Give()->donor_meta->get_meta( $donor->id, '_give_donor_title_prefix', true );
$donor->name = give_get_donor_name_with_title_prefixes( $title_prefix, $donor->name );
?>
address ) ) :
// Default address always will be at zero array index.
$is_set_as_default = null;
foreach ( $donor->address as $address_type => $addresses ) {
switch ( true ) {
case is_array( end( $addresses ) ):
$index = 1;
foreach ( $addresses as $id => $address ) {
echo __give_get_format_address(
$address,
array(
'type' => $address_type,
'id' => $id,
'index' => $index,
)
);
$index ++;
}
break;
case is_string( end( $addresses ) ):
echo __give_get_format_address(
$addresses,
array(
'type' => $address_type,
)
);
break;
}
}
endif;
?>
payment_ids );
$payments = give_get_payments( array(
'post__in' => $payment_ids,
) );
$payments = array_slice( $payments, 0, 10 );
?>
seq_donation_number->get_serial_code( $payment->ID ); ?>
ID, array(
'currency' => true,
'amount' => true,
'type' => 'donor'
) ); ?>
post_date ) ); ?>
%3$s',
admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment->ID ),
sprintf(
/* translators: %s: Donation ID */
esc_attr__( 'View Donation %s.', 'give' ),
$payment->ID
),
__( 'View Donation', 'give' )
);
?>
email );
?>
post_title; ?>
%3$s',
esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ),
sprintf(
/* translators: %s: form name */
esc_attr__( 'View Form %s.', 'give' ),
$donation->post_title
),
__( 'View Form', 'give' )
);
?>
get_notes_count();
$per_page = apply_filters( 'give_donor_notes_per_page', 20 );
$total_pages = ceil( $note_count / $per_page );
$donor_notes = $donor->get_notes( $per_page, $paged );
?>
'%_%',
'format' => '?paged=%#%',
'total' => $total_pages,
'current' => $paged,
'show_all' => true,
);
echo paginate_links( $pagination_args );
?>