From 751e9bfcf11b89475fcef5cc27538d5ee3f6453c Mon Sep 17 00:00:00 2001 From: sephger Date: Tue, 11 Jun 2024 12:19:18 +0200 Subject: [PATCH] Login_Profile-Button --- .../template-parts/layout/header-content.php | 21 +++++++++++++++---- theme/wowpress/Frontend/NavWalker.php | 2 ++ theme/wowpress/Models/User.php | 7 +++++++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/theme/template-parts/layout/header-content.php b/theme/template-parts/layout/header-content.php index 0ab9926..bff6f78 100644 --- a/theme/template-parts/layout/header-content.php +++ b/theme/template-parts/layout/header-content.php @@ -30,7 +30,7 @@ use WoWPress\Frontend\NavWalker;
-
- + + Login + + Profil + +
- +
diff --git a/theme/wowpress/Frontend/NavWalker.php b/theme/wowpress/Frontend/NavWalker.php index bda96a2..8cc7d8a 100644 --- a/theme/wowpress/Frontend/NavWalker.php +++ b/theme/wowpress/Frontend/NavWalker.php @@ -3,6 +3,7 @@ namespace WoWPress\Frontend; use WoWPress\Frontend\Icon; +use WoWPress\Models\User; class NavWalker extends \Walker_Nav_Menu { @@ -73,6 +74,7 @@ class NavWalker extends \Walker_Nav_Menu if ($item->url && $item->url == "#LOGIN") { if (is_user_logged_in()) { + $output .= "Profil"; } else { $output .= "Login"; diff --git a/theme/wowpress/Models/User.php b/theme/wowpress/Models/User.php index ce3ed8e..1eb9440 100644 --- a/theme/wowpress/Models/User.php +++ b/theme/wowpress/Models/User.php @@ -7,6 +7,13 @@ use Wenprise\ORM\WP\User as WPUser; class User extends WPUser { + public static function logged_in(){ + if(is_user_logged_in()){ + return User::find(get_current_user_id()); + } + return false; + } + public function characters() {