T
T
Toster7772018-06-11 21:33:49
WordPress
Toster777, 2018-06-11 21:33:49

How to display specific text for the user?

Let's say there is a user Alexander, you need to display one hint for him on the site.
How to do this in PHP in Wordpress?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dymok, 2018-06-11
@UnluckySerivelha

$current_user = wp_get_current_user();

echo 'Username: ' . $current_user->user_login . '<br />';
echo 'email: ' . $current_user->user_email . '<br />';
echo 'first name: ' . $current_user->user_firstname . '<br />';
echo 'last name: ' . $current_user->user_lastname . '<br />';
echo 'Отображаемое имя: ' . $current_user->display_name . '<br />';
echo 'ID: ' . $current_user->ID . '<br />';

Further, it is probably clear

S
Syomka Gavrilenko, 2018-06-13
@cema93

$current_user = wp_get_current_user();
if($current_user->user_login == "Alexander") {
    echo "подсказка для александра";
}

But I don't think it's worth it. After all, such a check takes a lot of resources.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question