Support » Plugin: WP e-Commerce Style Email » Insert user ID

  • Resolved myaor

    (@myaor)


    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/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jacob Schwartz

    (@mightyturtle)

    Would this work for you?

    Thread Starter myaor

    (@myaor)

    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.