G
G
Grayward2021-03-10 10:56:39
Online shopping
Grayward, 2021-03-10 10:56:39

Setting up a personal account, how to do it?

I am creating an online store, in the header of the site there is "Authorization" and "Registration", is it possible to make it so that after Authorization by the user he is transferred to the main page and instead of "Authorization" and "Registration" he sees something like "You are authorized as : <username>"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dima, 2021-03-10
Dolgoter @SpiderPigAndCat

if ( is_user_logged_in() ) {
  echo 'Вы авторизованы на сайте!';
тут пишешь строчку для редиректа на главную
}
else {
  echo 'Вы всего лишь пользователь!';
}

in the menu where registration and authorization you write like this
if ( is_user_logged_in() ) {
 global $current_user;
  wp_get_current_user() ;
   
  echo 'Вы авторизованы на сайте как '. $current_user->user_login;
}
else {
   вывод кнопок авторизация регистрация
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question