Marko I.
Marko I.

Reputation: 562

Hyperlink not displaying correctly

I have table column "Profile" that needs to output a hyperlink, specifically profile link of a customer that bought a product.

Updated

It's a "user_link" in question, here's how it is now:

$new_row->ID            = $order->get_order_number(); 
                $new_row->order_number  = $order->get_order_number(); 
                $new_row->customer      = $customer_details; 
                $new_row->products      = $products_html;
                $new_row->total         = $total_text;
                $new_row->status        = $shipped;
                 $new_row->user_link  = print '<p><a class="author-link" href="'. $order->user_link .'">'. __( 'Click here to view user profile' ) . '</a><p>';
                $new_row->order_date    = date_i18n( wc_date_format(), strtotime( $order->order_date ) ) . '<br /><strong>' . ucfirst( $order->get_status() ) . '</strong>'; 
                $new_row->row_actions   = $row_actions; 
                $new_row->action_after  = $this->order_details_template( $_order ) . $this->order_note_template( $order->get_order_number() ) . $this->tracking_number_template( $order->get_order_number(), get_current_user_id() ); 

                do_action( 'wcv_orders_add_new_row', $new_row ); 

                $rows[] = $new_row; 

Table columns:

public function table_columns( ) {

        $columns = apply_filters( 'wcv_order_table_columns', array( 
                    'ID'            => __( 'ID',            'wcvendors-pro' ), 
                    'order_number'  => __( 'Purchase ID',       'wcvendors-pro' ),
                    'customer'      => __( 'Customer',      'wcvendors-pro' ),
                    'products'      => __( 'Product)',      'wcvendors-pro' ), 
                    'total'         => __( 'Total',         'wcvendors-pro' ), 
                    'order_date'    => __( 'Sale Date',     'wcvendors-pro' ),
                    'user_link'     => __( 'Profile', 'wcvendors-pro'),
        ) ); 

What I tried: In the $new_row->user_link I tried adding print:

$new_row->user_link  = print '<p><a class="author-link" href="'. $order->user_link .'">'. __( 'Click here to view user profile' ) . '</a><p>';

Upvotes: 0

Views: 57

Answers (1)

Jamhead
Jamhead

Reputation: 311

Change this:

$new_row->user_link  = print '<p><a class="author-link" href="'. $order->user_link .'">'. __( 'Click here to view user profile' ) . '</a><p>';

to:

print('<p><a class="author-link" href="'. $order->user_link .'">Click here to view user profile</a><p>');

Upvotes: 1

Related Questions