Skip to content

Commit

Permalink
Removed checks from ancient WP versions
Browse files Browse the repository at this point in the history
  • Loading branch information
marekdedic committed Nov 19, 2024
1 parent 5e0db87 commit f7d900e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 24 deletions.
15 changes: 3 additions & 12 deletions src/php/src/admin/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,22 +118,13 @@ public function add_logout_link_to_admin_bar( \WP_Admin_Bar $wp_admin_bar ) {
if ( ! is_admin_bar_showing() ) {
return;
}

if ( method_exists( $wp_admin_bar, 'get_node' ) ) {
if ( ! is_null( $wp_admin_bar->get_node( 'user-actions' ) ) ) {
$parent = 'user-actions';
} else {
return;
}
} elseif ( 1 === get_option( 'show_avatars' ) ) {
$parent = 'my-account-with-avatar';
} else {
$parent = 'my-account';
if ( is_null( $wp_admin_bar->get_node( 'user-actions' ) ) ) {
return;
}

$wp_admin_bar->add_menu(
array(
'parent' => $parent,
'parent' => 'user-actions',
'id' => SKAUTIS_INTEGRATION_NAME . '_adminBar_logout',
'title' => esc_html__( 'Log Out (too from skautIS)', 'skautis-integration' ),
'href' => $this->wp_login_logout->get_logout_url(),
Expand Down
15 changes: 3 additions & 12 deletions src/php/src/frontend/class-frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,13 @@ public function add_logout_link_to_admin_bar( \WP_Admin_Bar $wp_admin_bar ) {
if ( ! is_admin_bar_showing() ) {
return;
}

if ( method_exists( $wp_admin_bar, 'get_node' ) ) {
if ( ! is_null( $wp_admin_bar->get_node( 'user-actions' ) ) ) {
$parent = 'user-actions';
} else {
return;
}
} elseif ( 1 === get_option( 'show_avatars' ) ) {
$parent = 'my-account-with-avatar';
} else {
$parent = 'my-account';
if ( is_null( $wp_admin_bar->get_node( 'user-actions' ) ) ) {
return;
}

$wp_admin_bar->add_menu(
array(
'parent' => $parent,
'parent' => 'user-actions',
'id' => SKAUTIS_INTEGRATION_NAME . '_adminBar_logout',
'title' => esc_html__( 'Odhlásit se (i ze skautISu)', 'skautis-integration' ),
'href' => $this->wp_login_logout->get_logout_url(),
Expand Down

0 comments on commit f7d900e

Please sign in to comment.