AI Assistant
Notifications
Clear all

[Solved] Can I show the name and avatar somewhere else?

7 Posts
2 Users
0 Reactions
1,498 Views
DMolina
Posts: 34
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@dmolina)
Trusted Member
Joined: 6 years ago
[#11984]

I would like to show the username with your avatar in a menu, to display the account options, is there already any function to do this?


Topic Tags
6 Replies
Robert
Posts: 10720
Admin
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@robert)
Support Team
Joined: 2 months ago

The avatar could be displayed using this function:

<?php echo get_avatar( get_current_user_id(), 60 ); ?>

The user display name:

<?php echo WPF()->current_user_display_name; ?>

5 Replies
DMolina
(@dmolina)
Joined: 6 years ago

Trusted Member
Posts: 34
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@robert

Isn't there a way to use both in one function?
I want to do this, but with the functions of Wordpress I can not show the avatar of the forum profile

 

 Screenshot 2020 01 31 Inicio1

Robert
Admin
(@robert)
Joined: 2 months ago

Support Team
Posts: 10720
Robert
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@dmolina

Why a function? Just put those together:

<?php echo get_avatar( get_current_user_id(), 60 ) . ' <span class="user-name">' . WPF()->current_user_display_name . '</span>' ?>

 


DMolina
(@dmolina)
Joined: 6 years ago

Trusted Member
Posts: 34
DMolina
Robert
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@robert

Sorry, I have not programmed for a while but I understand how to use it!
Thank you!

 


DMolina
(@dmolina)
Joined: 6 years ago

Trusted Member
Posts: 34
DMolina
Robert
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@robert

I think I need a little more help, this function still brings me the Wp avatar, but the one I need to show is the wpforo

<?php echo get_avatar( get_current_user_id(), 60 ); ?>

 


DMolina
(@dmolina)
Joined: 6 years ago

Trusted Member
Posts: 34
Robert
DMolina
Robert
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

Ready, I could make it thanks!


Share: