If admin user is logged in, link them to order notes. Closes #3433.

This commit is contained in:
Mike Jolley 2013-07-30 12:35:18 +01:00
parent 63b203955b
commit bf5716af3c
2 changed files with 13 additions and 6 deletions

View File

@ -41,7 +41,9 @@ function woocommerce_order_notes_meta_box() {
<?php echo wpautop( wptexturize( wp_kses_post( $note->comment_content ) ) ); ?>
</div>
<p class="meta">
<?php printf( __( 'added %s ago', 'woocommerce' ), human_time_diff( strtotime( $note->comment_date_gmt ), current_time( 'timestamp', 1 ) ) ); ?> <a href="#" class="delete_note"><?php _e( 'Delete note', 'woocommerce' ); ?></a>
<?php printf( __( 'added %s ago', 'woocommerce' ), human_time_diff( strtotime( $note->comment_date_gmt ), current_time( 'timestamp', 1 ) ) ); ?>
<?php if ( $note->comment_author !== __( 'WooCommerce', 'woocommerce' ) ) printf( ' ' . __( 'by %s', 'woocommerce' ), $note->comment_author ); ?>
<a href="#" class="delete_note"><?php _e( 'Delete note', 'woocommerce' ); ?></a>
</p>
</li>
<?php

View File

@ -1200,13 +1200,18 @@ class WC_Order {
$is_customer_note = intval( $is_customer_note );
if ( isset( $_SERVER['HTTP_HOST'] ) )
$comment_author_email = sanitize_email( strtolower( __( 'WooCommerce', 'woocommerce' ) ) . '@' . str_replace( 'www.', '', $_SERVER['HTTP_HOST'] ) );
else
$comment_author_email = sanitize_email( strtolower( __( 'WooCommerce', 'woocommerce' ) ) . '@noreply.com' );
if ( is_user_logged_in() && current_user_can( 'manage_woocommerce' ) ) {
$user = get_user_by( 'id', get_current_user_id() );
$comment_author = $user->display_name;
$comment_author_email = $user->user_email;
} else {
$comment_author = __( 'WooCommerce', 'woocommerce' );
$comment_author_email = strtolower( __( 'WooCommerce', 'woocommerce' ) ) . '@';
$comment_author_email .= isset( $_SERVER['HTTP_HOST'] ) ? str_replace( 'www.', '', $_SERVER['HTTP_HOST'] ) : 'noreply.com';
$comment_author_email = sanitize_email( $comment_author_email );
}
$comment_post_ID = $this->id;
$comment_author = __( 'WooCommerce', 'woocommerce' );
$comment_author_url = '';
$comment_content = $note;
$comment_agent = 'WooCommerce';