Title: Change _customer_user
Last modified: August 31, 2016

---

# Change _customer_user

 *  [sandeo](https://wordpress.org/support/users/sandeo/)
 * (@sandeo)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/change-_customer_user/)
 * Heya guys,
 * I am working on a solution to add B2B customer acvcounts to wordpress. To facilitate
   that, the main account should be able to view the orders of its employees (which
   are other wordpress users). I succeeded to make a table with the necessary orders
   on the my account page, but I am stuck on view-order page. I found out that if
   I would change _customer_user in wp_postmeta, I would be able to view the order.
 * I have tried putting the following code at the beginning of view-order.php:
 * global $wpdb;
    $sql=”UPDATE `wp_postmeta` SET `meta_value` = ‘9’ WHERE `meta_key`
   =4683″; $wpdb->query($sql);
 * The problem is that it executes after all the necessary details are loaded, so
   I am getting an invalid order error. Of course, in a later point, I would change
   9 tot get_current_user and meta_key to order_id and meta_key. So my question 
   is where should I put this function for it to work correctly?
 * Thanks.

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/change-_customer_user/#post-7449453)
 * You can put it in functions.php of your theme, or better yet, that of a child
   theme. You should put it inside a conditional that checks `$_SERVER['REQUEST_URI']`
   for the proper request so that meta is not needlessly changed for unrelated requests.
 * Maybe it doesn’t matter, but you might consider storing the original value in
   a global or transient, then restoring it in post meta after the desired information
   is output. The restoration part can be placed near the end of view-order.php.

Viewing 1 replies (of 1 total)

The topic ‘Change _customer_user’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [9 years, 11 months ago](https://wordpress.org/support/topic/change-_customer_user/#post-7449453)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
