WordPress.org

Ready to get started?Download WordPress

Forums

amr users
[resolved] Change Avatar Output (5 posts)

  1. beanz7890
    Member
    Posted 1 year ago #

    I would like to change the way avatars are displayed using this plugin, are you able to advise as to where I would start?

    Rather than display the standard WP avatar or gravatar, I would like to display a custom one. I currently do this in my author.php file with the following:

    <?php
    $userID = get_the_author_meta('ID');
    $user = get_userdata( $userID );
    $displayName = $user->adi_displayname;
    $photoURL = $user->adt_user_photo_url;
    ?>
    <img src="<?php echo $photoURL?>" title="Profile photograph for <?php echo $displayName?>" alt="Profile photograph for <?php echo $displayName?>"></img>

    Where would I put this in your plugin?

    Thanks very much.

    http://wordpress.org/extend/plugins/amr-users/

  2. anmari
    Member
    Plugin Author

    Posted 1 year ago #

    Hi beanz,

    plugin uses wordpress avatar function, so recommended way (in general, not just for this plugin) is to use the wordpress get avatar filter to serve up your custom avatar.

    No modification of plugin or wp code required => better maintainability.

    See
    http://codex.wordpress.org/Function_Reference/get_avatar

  3. beanz7890
    Member
    Posted 1 year ago #

    Thanks for coming back to me.

    Which files/where does your plugin make this call?

    Thanks

  4. anmari
    Member
    Plugin Author

    Posted 1 year ago #

    Really beanz7890? If you are planning on coding, you should know how to find stuff in code: go to into your editor on one of the amr-user files (hopefully you are using something like notepad++ or sublimetext2 that has a find files feature). Hit find in files (select all amr-users files), type in "get_avatar" and see what comes up.

    Note as I said above it is NOT recommended to modify plugin code - it will remove your site from the upgrade path. That is why filters and pluggable function exist - they make wordpress VERY powerful/customisable while maintaining ability to upgrade.

    The recommended way to modify avatar output is using the filter. A quick google will help you
    http://hungred.com/how-to/customize-wordpress-avatar-filter-hook/
    http://wordpress.stackexchange.com/questions/56736/how-to-filter-get-avatar

  5. beanz7890
    Member
    Posted 1 year ago #

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.