WordPress.org

Ready to get started?Download WordPress

Forums

Use tags elsewhere? (13 posts)

  1. paulcarruthers
    Member
    Posted 6 years ago #

    This may be a dumb question, but is it possible to call the userphoto_the_author_photo() template tag in places other than the post or comment loops? I'm trying to put the user photo in the left bar of a page template.

    Thanks...and thanks for a bl00dy useful plugin!

    -pc.

  2. Weston Ruter
    Member
    Posted 6 years ago #

    As long as $authordata is globally set, you can call userphoto_the_author_photo() anywhere.

  3. hnyc
    Member
    Posted 6 years ago #

    Nice plugin...I tried using the tags in the sidebar and it works for only one author. Is there a tag available to call userphoto_the_author_photo() anywhere for users/subscribers as well as authors--I would like the pic of the person signed in to be displayed in the sidebar.

    Also is there a way to move the "photo field" to the top of the "Your Profile" Section

  4. ibeats
    Member
    Posted 6 years ago #

    I'm also trying to achieve this. Am i right in thinking $authordata is globally set by default/activation of the plugin?

    by using <?php userphoto_the_author_photo(); ?> I can see the user photo, however, the same userphoto exists for all my users.

    I wish to achieve the same as HNYC and display the photo relative to the signed in user.

  5. abelito
    Member
    Posted 6 years ago #

    Am also looking to do exactly the same thing!

    It seems to draw the required info. from global $authordata but don't know how to reset this for each user to display the relevant photo for each user.

    Help!:)

  6. abelito
    Member
    Posted 6 years ago #

    This is a very brutal solution:

    $user = get_userdata($user);
    		$authordata = get_userdata($user_id);
    		echo '<img src="' . get_option('siteurl') . '/wp-content/uploads/userphoto/' . $user->user_login . '.thumbnail.jpg" />';

    Can't really recommend it... but it works!

  7. ibeats
    Member
    Posted 6 years ago #

    Can't get that to work Abelito :(

  8. tection99
    Member
    Posted 6 years ago #

    "As long as $authordata is globally set, you can call userphoto_the_author_photo() anywhere."

    Hi, are you able to point me to some docs about setting $authordata globally?

    Thanks

  9. tection99
    Member
    Posted 6 years ago #

    I got it to work by using 2 loops:

    heres my code for the first loop:
    (rewind_posts ends the first loop, or something to that effect :))

    <?php the_post(); ?>

    <?php global $authordata; echo userphoto_the_author_photo(); ?>

    <?php rewind_posts(); ?>

  10. dinozer
    Member
    Posted 6 years ago #

    I have got the same problem. I tryed all your solutions but they didn't work. I am using the code which is

    <?php userphoto_the_author_photo(); ?>

    And I can see my picture however everyone see only my picture in the sidebar. How can I set my $authordata as global. Or is this problem arise from $autodata or any other thing?

  11. Weston Ruter
    Member
    Posted 6 years ago #

    @dinozer:

    This should so it:

    <?php
    global $post;
    setup_postdata($post);
    userphoto_the_author_photo();
    ?>

    The internals of the userphoto_* functions do global $authordata anyway, so doing an explicit statement to global $authordata shouldn't be necessary.

  12. by-tor2112
    Member
    Posted 6 years ago #

    I have tried every solution (That I could find) and nothing will work for me!

    I'm trying to put the current logged in user's avatar in the sidebar, but it only seems to produce the same avatar (mine, the admin). Has anyone got this working? and if so could you post the code you used?

  13. ehab
    Member
    Posted 6 years ago #

    tection99 is a genius ! his solution

    <?php the_post(); ?>
    
    <?php global $authordata; echo userphoto_the_author_photo(); ?>
    
    <?php rewind_posts(); ?>

    works fine outside the loop.

    251 :) t/c all

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags