HOW display logged user avatar in a certain page of WP

Post a reply


This question is a means of preventing automated form submissions by spambots.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

If you wish to attach one or more files enter the details below.

Maximum filesize per attachment: 1 MiB.

Expand view Topic review: HOW display logged user avatar in a certain page of WP

Re: HOW display logged user avatar in a certain page of WP

by axew3 » Fri Jan 20, 2017 11:29 pm

are you using the integration plugin? This post moved to WordPress forum.

Code: Select all

<? echo get_avatar ( $id_or_email, $size = '20' ); ?>
you need to put this where you need to output the avatar.

Re: HOW display logged user avatar in a certain page of WP

by skynet969 » Fri Jan 20, 2017 11:01 pm

Escuse me for double reply.

Merge, if you want.

My pieze of code is look like this:

Code: Select all

<div class="logged-in"> <? echo get_avatar ( $id_or_email, $size = '20' ); ?> <?php echo $link_with_username;?> | <a href="<?php echo wp_logout_url( $logout_redirect_page ); ?>" title="<?php _e('Logout','login-sidebar-widget');?>"><?php _e('Logout','login-sidebar-widget');?></a></div>

Re: HOW display logged user avatar in a certain page of WP

by skynet969 » Fri Jan 20, 2017 10:49 pm

Sorry, I forget this info.

Yes, I use integration plugin, and in my pic you can view the results of get_avatar command: it' blank.

The phpBB avatar overwrite option in WP is actived and display avatar in WP in shift On.

Re: HOW display logged user avatar in a certain page of WP

by axew3 » Fri Jan 20, 2017 10:36 pm

yes, but it depend from where the avatar come from.
I suppose you are using the phpBB WordPress integration?

By the way if you want to display an avatar into a login widget, it isn't complicate as you just need to display avatar for the current user, so the code will look like this, just to be sure will work on any situation:

Code: Select all

$current_user = wp_get_current_user();
    echo get_avatar( $current_user->ID, 32 ); 
Are you using the integration plugin?

'32' is the size in px of the avatar to display.

HOW display logged user avatar in a certain page of WP

by skynet969 » Fri Jan 20, 2017 10:07 pm

Hi!

Only a question.
Did is possible display a logged user avatar in a certain page, post of part in WP by php code?
I want insert user avatar into thirdy part login widget like this:
Cattura.PNG
Cattura.PNG (13.42 KiB) Viewed 14336 times
Thank in advance.

Top