|
@@ -8,19 +8,19 @@ discard block |
|
|
block discarded – undo |
|
8
|
8
|
* @subpackage modules |
|
9
|
9
|
*/ |
|
10
|
10
|
|
|
11
|
|
-if ( ! defined( 'ABSPATH' ) ) { |
|
|
11
|
+if (!defined('ABSPATH')) { |
|
12
|
12
|
exit; |
|
13
|
13
|
} |
|
14
|
14
|
|
|
15
|
|
-if ( ! defined( 'WPSHOP_VERSION' ) ) { |
|
16
|
|
- die( __( 'You are not allowed to use this service.', 'wpshop' ) ); |
|
|
15
|
+if (!defined('WPSHOP_VERSION')) { |
|
|
16
|
+ die(__('You are not allowed to use this service.', 'wpshop')); |
|
17
|
17
|
} |
|
18
|
18
|
|
|
19
|
19
|
/** Test if userswithcing module is active */ |
|
20
|
|
-if ( class_exists( 'user_switching' ) ) { |
|
21
|
|
- add_filter( 'wps_filter_customer_action_metabox', 'wps_display_user_switching_link', 10, 2 ); |
|
22
|
|
- add_filter( 'wps_filter_customer_list_actions', 'wps_display_user_switching_link', 10, 2 ); |
|
23
|
|
- add_filter( 'wps_filter_customer_in_order', 'wps_display_user_switching_link', 10, 2 ); |
|
|
20
|
+if (class_exists('user_switching')) { |
|
|
21
|
+ add_filter('wps_filter_customer_action_metabox', 'wps_display_user_switching_link', 10, 2); |
|
|
22
|
+ add_filter('wps_filter_customer_list_actions', 'wps_display_user_switching_link', 10, 2); |
|
|
23
|
+ add_filter('wps_filter_customer_in_order', 'wps_display_user_switching_link', 10, 2); |
|
24
|
24
|
|
|
25
|
25
|
/** |
|
26
|
26
|
* Display the link allowing to switch to another user everywhere it is possible |
|
@@ -29,12 +29,12 @@ discard block |
|
|
block discarded – undo |
|
29
|
29
|
* @param integer $wp_user_id Corresponding user id. |
|
30
|
30
|
* @param boolean $need_separator Add an automatic separator to output. |
|
31
|
31
|
*/ |
|
32
|
|
- function wps_display_user_switching_link( $customer_id, $wp_user_id, $need_separator = true ) { |
|
|
32
|
+ function wps_display_user_switching_link($customer_id, $wp_user_id, $need_separator = true) { |
|
33
|
33
|
$output = ''; |
|
34
|
34
|
|
|
35
|
|
- $user = get_user_by( 'id', $wp_user_id ); |
|
36
|
|
- if ( false !== $user ) { |
|
37
|
|
- $output = '<a href="' . esc_url( user_switching::switch_to_url( $user ) ) . '" >' . esc_html( 'Switch to user', 'wpshop' ) . '</a>'; |
|
|
35
|
+ $user = get_user_by('id', $wp_user_id); |
|
|
36
|
+ if (false !== $user) { |
|
|
37
|
+ $output = '<a href="' . esc_url(user_switching::switch_to_url($user)) . '" >' . esc_html('Switch to user', 'wpshop') . '</a>'; |
|
38
|
38
|
} |
|
39
|
39
|
|
|
40
|
40
|
echo $output; |