This is how you can display a personal greeting to the customer on the Easy Digital Downloads Purchase History page. When your Easy Digital Downloads customer is logged in to their purchase history, they will see a greeting that says, “Welcome, username.” The username displayed will be their user login. The second example, below, shows you how to instead display the customer’s first name, or their email address.
add_action( 'edd_before_purchase_history', 'before_purchase_history' ); function before_purchase_history() { $user = wp_get_current_user(); if ( ! empty( $user->user_login ) ) { echo 'Welcome, ' . $user->user_login; } }
To show the customer’s first name instead of their login user name, replace lines 5-7 with the following.
if ( ! empty( $user->user_firstname ) ) { echo 'Welcome, ' . $user->user_firstname; }
To add also the customer’s email address in parenthesis next to their first name, add this to the end of the previous snippet for first name.
if ( ! empty( $user->user_email ) ) { echo ' (' . $user->user_email . ')'; }
Questions and Comments are Welcome