Skip to content

Commit 7534f24

Browse files
committed
fixed issue #1 : Fatal error při pokusu o aktivaci
1 parent 8118234 commit 7534f24

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

src/admin/Admin.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ private function initHooks() {
3232
add_action( 'admin_enqueue_scripts', [ $this, 'enqueueScripts' ] );
3333
}
3434

35-
if ( $this->skautisGateway->getSkautisInstance()->getUser()->isLoggedIn() ) {
36-
add_action( 'admin_bar_menu', [ $this, 'addLogoutLinkToAdminBar' ], 20 );
35+
if ( $this->skautisGateway->isInitialized() ) {
36+
if ( $this->skautisGateway->getSkautisInstance()->getUser()->isLoggedIn() ) {
37+
add_action( 'admin_bar_menu', [ $this, 'addLogoutLinkToAdminBar' ], 20 );
38+
}
3739
}
3840
}
3941

src/admin/UsersManagement.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,6 @@ private function initHooks() {
3030
$this,
3131
'setupUsersManagementPage'
3232
], 10 );
33-
34-
if ( ! $this->skautisGateway->isInitialized() ) {
35-
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
36-
throw new \Exception( 'SkautIS connection not established yet.' );
37-
}
38-
39-
return;
40-
}
4133
}
4234
}
4335

src/auth/SkautisGateway.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function getEnv() {
5050
}
5151

5252
public function getSkautisInstance() {
53-
if ( ! $this->isInitialized() ) {
53+
if ( ! $this->isInitialized() && defined( 'WP_DEBUG' ) && WP_DEBUG ) {
5454
throw new \Exception( __( 'Pro správnou funkčnost zadejte v nastavení pluginu SkautIS přidělené APP ID', 'skautis-integration' ) );
5555
}
5656

0 commit comments

Comments
 (0)