Authenticated users can not see own Ubercart order detail Using Drupal 7, Ubercart 7.x-3.10.

A user purchases product, gets a user id and logs in. He clicks on Orders tab in My Order History and sees the last order. But, when he clicks on the order number or View order icon, he gets HTTP 500 error (not access denied) instead of seeing order detail.

As admin, I can click on same link and see order detail.

In permissions, Authenticated user has checked:

View own orders
View own invoices

They can see uc_orders_user view /user/606/orders but get page not found error when they click on link to view individual order /user/606/orders/15. Oddly enough, Print order user/606/orders/15/print does work.

Rebuilt permissions, same error.

In order settings, admin/store/settings/orders, I use the Customer On-site invoice template, but I don't see any options to allow users to view orders/invoices (as referred to in this answer to similar question: User cannot view their Orders in Ubercart)

Any suggestions?
I found the offending code. It was the code for a block to display a link to "My Orders" if the user had any orders. I removed this code from the block, and the order detail now displays for authenticated user.

The offending code:

global $user;

$uid = $user-&gt;uid;

// print 'This is my user id ' . $uid;

        $count = 0;
        $args = array($uid);
        $view = views_get_view('uc_orders_user');
        $view-&gt;preview('page', $args);
        $count = sizeof($view-&gt;result);

// drupal_set_message($count);

  if ($count &gt; 0) {
    return TRUE;
  } else {
    return FALSE;
  }


Do not know why this code causes the error, but it does.  If I find a way to tweak it to work, I'll post it here.