X

Add Username To Customer Details in Easy Digital Downloads

Themify Landing featured

We can thank Andrew Munro for this Easy Digital Downloads snippet that will add the customer’s username to the "Customer Details" section on the payment screen, and links it through to the user’s profile.



Code Snippet:


function sumobi_edd_customer_details_username( $payment_id ) {
$user_info = edd_get_payment_meta_user_info( $payment_id );
$customer_id = $user_info['id'];

if ( ! $customer_id ) {
return;
}

$user_data = get_userdata( $customer_id );
$user_name = $user_data->user_login;
?>
<div class="column-container" style="margin-top: 20px;">
<div class="column">
<strong><?php _e( 'Username:', 'edd' ); ?></strong><br />
<a href="<?php echo get_edit_user_link( $customer_id ); ?>"><?php echo $user_name; ?></a>
</div>
</div>
<?php
}
add_action( 'edd_payment_view_details', 'sumobi_edd_customer_details_username' );

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!