Home Forums Plugin Support WP User Frontend Pro Avatar Questions

This topic is: resolved

Tagged: 

This topic contains 2 replies, has 2 voices, and was last updated by  cphine 5 years, 10 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #6559

    cphine
    Participant
    Post count: 10

    Hello. I just bought the pro version of wp-user-frontend to replace my use of the free version and wp-user-avatar. (I'm also using theme-my-login) The avatar program would not work from the frontend so I figured this would solve the issue. Wow. I didn't realize how much work was in store for me! This is the first series of what will probably be a number of questions. Apologies in advance.

    First, when logged in as the administrator and in the backend, I am unable to change or add a user avatar. My site has a number of Guest authors that don't post themselves, but allow us to use their content. I would like to be able to update their avatar, as I could with wp-user-avatar. Is this not possible? Could it be?

    Second, with wp-user-avatar, I was able to use this code
    <?php echo get_wp_user_avatar($user_id, 50, 'left'); ?>
    to display the avatar both in the author archive page and next to their post on my front page.

    Now, with the pro version, I am trying to use this code
    <?php echo get_avatar( $curauth->user_id, '50' ); ?>
    It works in my author archive, but it does not work on my front page. I only get the gravatar “mystery man” image.

    Any thoughts as to why?

    EDIT: Figured out the code for the front page. (I don't understand it, but it appears to work) I'll leave this hear just in case anyone else is wondering.
    <?php echo get_avatar( get_the_author_meta( 'ID' ), 50 ); ?>

    #6568

    Tareq Hasan
    Keymaster
    Post count: 2831

    I think, the avatar in backend profile will not work if you update on behalf of another user. Because it associate the avatar with the current logged in user. In this case, you can use the User Switching plugin to switch to that user, update the profile and switch back!

    get_avatar( $curauth->user_id, '50' ); works in author archive because your author.php is getting the current authors archive to the $curauth variable. But in other pages this won't work, because $curauth variable is unknown in the context. get_the_author_meta( 'ID' ) will work on the WordPress loop correctly because WordPress sets the global $post variable that way.

    #6981

    cphine
    Participant
    Post count: 10

    Ok, user switching plugin does work, but it's weird that as the admin I can't edit the avatar but I can change everything else about them…name, password, bio, etc. I thought that was the point of being the Admin! Using other avatar programs, I could edit as admin. Perhaps something to consider.

    Thanks for the description of the $curauth code. I think I understand. Got it to work, that's what I'm concerned about!

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Avatar Questions’ is closed to new replies.