Calling the maybe_switch_user function
-
We have built a function that uses the
woocommerce_shop_order_search_resultshook to search for something in a custom table that then returns thecustomer_id, get theWP_User objectfor thatidand are attempting to use javascriptconfirm()to callmaybe_swith_userbut are getting the ‘Could not switch users’ response. We’re thinking it is because it’s rebuilding the DOM and we don’t have the necessary info forold_user, but aren’t sure.if ( method_exists( 'user_switching', 'maybe_switch_url' ) ) { $url = user_switching::maybe_switch_url( $target_user ); if ( $url ) { echo "<script>if ( confirm('This is a historical Opencart serial number. Click OK to jump to his customer') ) document.location='$url';</script>"; } }Is there a way you can think of to make this work?
Thanks
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘Calling the maybe_switch_user function’ is closed to new replies.