Login_Profile-Button
parent
8c50bbff43
commit
751e9bfcf1
|
@ -46,8 +46,8 @@ use WoWPress\Frontend\NavWalker;
|
||||||
</div>
|
</div>
|
||||||
</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 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">
|
<div class="py-2 xl:hidden flex flex-row items-center justify-center gap-2" style="--btn-color : white">
|
||||||
<button class="btn btn-outline w-full" @click="open = !open">
|
<button class="btn btn-outline flex-grow" @click="open = !open">
|
||||||
Menü
|
Menü
|
||||||
<div x-show="!open">
|
<div x-show="!open">
|
||||||
<?= Icon::get('o-bars-3') ?>
|
<?= Icon::get('o-bars-3') ?>
|
||||||
|
@ -57,6 +57,12 @@ use WoWPress\Frontend\NavWalker;
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</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>
|
</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">
|
<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,7 +80,14 @@ 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 -->
|
</nav><!-- #site-navigation -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace WoWPress\Frontend;
|
namespace WoWPress\Frontend;
|
||||||
|
|
||||||
use WoWPress\Frontend\Icon;
|
use WoWPress\Frontend\Icon;
|
||||||
|
use WoWPress\Models\User;
|
||||||
|
|
||||||
class NavWalker extends \Walker_Nav_Menu
|
class NavWalker extends \Walker_Nav_Menu
|
||||||
{
|
{
|
||||||
|
@ -73,6 +74,7 @@ class NavWalker extends \Walker_Nav_Menu
|
||||||
|
|
||||||
if ($item->url && $item->url == "#LOGIN") {
|
if ($item->url && $item->url == "#LOGIN") {
|
||||||
if (is_user_logged_in()) {
|
if (is_user_logged_in()) {
|
||||||
|
|
||||||
$output .= "Profil";
|
$output .= "Profil";
|
||||||
} else {
|
} else {
|
||||||
$output .= "Login";
|
$output .= "Login";
|
||||||
|
|
|
@ -7,6 +7,13 @@ use Wenprise\ORM\WP\User as WPUser;
|
||||||
class User extends 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()
|
public function characters()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue