Login_Profile-Button

master
sephger 2024-06-11 12:19:18 +02:00
parent 8c50bbff43
commit 751e9bfcf1
3 changed files with 26 additions and 4 deletions

View File

@ -30,7 +30,7 @@ use WoWPress\Frontend\NavWalker;
</svg>
</div>
<a href="/" class="logo w-[350px] h-[150px] max-w-[90vw]">
</a>
<div class="hidden lg:block" style="width:100px;fill:var(--color-alliance);transform:rotate(20deg)">
<!--?xml version="1.0" encoding="UTF-8" standalone="no"?-->
@ -46,8 +46,8 @@ use WoWPress\Frontend\NavWalker;
</div>
</div>
<div x-data="{ open: false }" class="flex flex-col max-w-screen-xl px-4 py-2 mx-auto xl:items-center xl:justify-center xl:flex-row xl:px-8">
<div class="py-2 xl:hidden flex flex-row items-center justify-center" style="--btn-color : white">
<button class="btn btn-outline w-full" @click="open = !open">
<div class="py-2 xl:hidden flex flex-row items-center justify-center gap-2" style="--btn-color : white">
<button class="btn btn-outline flex-grow" @click="open = !open">
Menü
<div x-show="!open">
<?= Icon::get('o-bars-3') ?>
@ -57,6 +57,12 @@ use WoWPress\Frontend\NavWalker;
</div>
</button>
<?php if (!is_user_logged_in()) : ?>
<a class="btn btn-outline btn-red" href="/wp-login.php">Login</a>
<?php else : ?>
<a class="btn btn-outline btn-alliance" href="/wp-admin/profile.php">Profil</a>
<?php endif; ?>
</div>
<nav id="site-navigation" :class="{'flex': open, 'hidden': !open}" class="flex-col flex-grow pb-4 md:pb-0 hidden xl:flex xl:justify-center xl:flex-row gap-2">
@ -74,9 +80,16 @@ use WoWPress\Frontend\NavWalker;
);
?>
<div class="hidden xl:flex">
<?php if (!is_user_logged_in()) : ?>
<a class="btn btn-outline btn-red" href="/wp-login.php">Login</a>
<?php else : ?>
<a class="btn btn-outline btn-alliance" href="/wp-admin/profile.php">Profil</a>
<?php endif; ?>
</div>
</nav><!-- #site-navigation -->
</div>

View File

@ -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";

View File

@ -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()
{