File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed
Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -48,18 +48,15 @@ public function onInit(): void
4848 {
4949 $ tracking = ! $ this ->trackingRules ->hasExcludedIp () && ! $ this ->trackingRules ->hasExcludedUserRole ();
5050
51- if ($ tracking && $ this ->settings ->get (SettingName::NOSCRIPT )) {
52- AddNoScriptTag::register ();
53- }
54-
55- if (! $ tracking ) {
56- AddInactiveComment::register ();
57- }
58-
5951 if ($ tracking ) {
6052 $ this ->scripts ->push (new AnalyticsScript );
6153 } else {
6254 $ this ->scripts ->push (new InactiveScript );
55+ AddInactiveComment::register ();
56+ }
57+
58+ if ($ tracking && $ this ->settings ->get (SettingName::NOSCRIPT )) {
59+ AddNoScriptTag::register ();
6360 }
6461
6562 if ($ this ->settings ->boolean (SettingName::AUTOMATED_EVENTS )) {
Original file line number Diff line number Diff line change @@ -24,9 +24,16 @@ public function hasExcludedIp(): bool
2424
2525 public function hasExcludedUserRole (): bool
2626 {
27- if (! is_user_logged_in ()) return false ;
27+ if (! is_user_logged_in ()) {
28+ return false ;
29+ }
2830
2931 $ needle = $ this ->settings ->array (SettingName::EXCLUDED_ROLES );
32+
33+ if ($ needle === []) {
34+ return true ;
35+ }
36+
3037 $ current = wp_get_current_user ()->roles ;
3138
3239 return array_intersect ($ needle , $ current ) !== [];
You can’t perform that action at this time.
0 commit comments