Title: Insert user ID
Last modified: August 21, 2016

---

# Insert user ID

 *  Resolved [myaor](https://wordpress.org/support/users/myaor/)
 * (@myaor)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/insert-user-id/)
 * Hi,
 * I am trying to insert account #, which is their user name they use to login, 
   on the subject line of the purchase report email.
 * So I am modified wpsc-email_style_purchase_report.php and added following:
 *     ```
       <html><body>
       	<?php
       		$sub1 = " - Order # ";
       		$sub2 = ECSE_purchase::$purchase_id;
       		$sub3 = " - Acc # ";
       		$sub4 = ECSE_purchase::get_the_purchase_prop('user_ID');
       		$sub5 = $sub1 . $sub2. $sub3. $sub4;
       	?>
           <h2><?php echo ecse_get_email_subject(); echo $sub5?></h2>
           <?php // echo ecse_get_email_content(); ?>
           Please click <a href="<?php echo admin_url( 'index.php?page=wpsc-purchase-logs&c=item_details&id=' .ECSE_purchase::$purchase_id ); ?>">here</a> to view the purchase details or follow the link below.<br />
           <?php echo admin_url( 'index.php?page=wpsc-purchase-logs&c=item_details&id=' .ECSE_purchase::$purchase_id ); ?>
       </body></html>
       ```
   
 * This works but I am getting 4 digit “user ID” instead of user name. What do i
   need to change to get the username in place of user id.
 * Thanks.
    Sushil
 * [https://wordpress.org/plugins/wp-e-commerce-style-email/](https://wordpress.org/plugins/wp-e-commerce-style-email/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Jacob Schwartz](https://wordpress.org/support/users/mightyturtle/)
 * (@mightyturtle)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/insert-user-id/#post-4681862)
 * Would [this](http://codex.wordpress.org/Function_Reference/get_userdata) work
   for you?
 *  Thread Starter [myaor](https://wordpress.org/support/users/myaor/)
 * (@myaor)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/insert-user-id/#post-4681881)
 * Awesome, it works. Just in case if someone is looking for an answer, here is 
   the code.
 *     ```
       <html><body>
       	<?php
       		$sub1 = " - Order # ";
       		$sub2 = ECSE_purchase::$purchase_id;
       		$sub3 = " - Acc # ";
       		$sub4 = ECSE_purchase::get_the_purchase_prop('user_ID');
       		$user = get_user_by( 'id', $sub4 );
       		$sub5 = $user->user_login;
       		$sub6 = $sub1 . $sub2. $sub3. $sub5;
       	?>
           <h2><?php echo ecse_get_email_subject(); echo $sub6?></h2>
           <?php // echo ecse_get_email_content(); ?>
           Please click <a href="<?php echo admin_url( 'index.php?page=wpsc-purchase-logs&c=item_details&id=' .ECSE_purchase::$purchase_id ); ?>">here</a> to view the purchase details or follow the link below.<br />
           <?php echo admin_url( 'index.php?page=wpsc-purchase-logs&c=item_details&id=' .ECSE_purchase::$purchase_id ); ?>
       </body></html>
       ```
   
 * I know you can make it shorter in couple lines, but this way its less confusing
   to read and understand for the php beginners.
 * Cheers!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Insert user ID’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-e-commerce-style-email_f39d82.
   svg)
 * [WP e-Commerce Style Email](https://wordpress.org/plugins/wp-e-commerce-style-email/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-e-commerce-style-email/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-e-commerce-style-email/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-e-commerce-style-email/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-e-commerce-style-email/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-e-commerce-style-email/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [myaor](https://wordpress.org/support/users/myaor/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/insert-user-id/#post-4681881)
 * Status: resolved