• Resolved sueyrad

    (@sueyrad)


    I use a theme that hosts avatars there own way and not like traditional backend avatar.

    the meta key is betube_get_image_url or betube_author_avatar_url.

    Is there way to implement this with this plugin? I tried the other author list plugin to no avail.

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Paul Bearne

    (@pbearne)

    Hi,

    The tick here is the to hook into the get_avater() function WP https://developer.wordpress.org/reference/functions/get_avatar/

    And use the filter to load you custom imagess

    /** * Filters the HTML for a user's avatar. * * @since 2.5.0 * @since 4.2.0 The $args parameter was added. * * @param string $avatar HTML for the user's avatar. * @param mixed $id_or_email The avatar to retrieve. Accepts a user_id, Gravatar MD5 hash, * user email, WP_User object, WP_Post object, or WP_Comment object. * @param int $size Square avatar width and height in pixels to retrieve. * @param string $default_value URL for the default image or a default type. Accepts '404', 'retro', 'monsterid', * 'wavatar', 'indenticon', 'mystery', 'mm', 'mysteryman', 'blank', or 'gravatar_default'. * @param string $alt Alternative text to use in the avatar image tag. * @param array $args Arguments passed to get_avatar_data(), after processing. */ return apply_filters( 'get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args );

    Or the pre

    /** * Allows the HTML for a user's avatar to be returned early. * * Returning a non-null value will effectively short-circuit get_avatar(), passing * the value through the {@see 'get_avatar'} filter and returning early. * * @since 4.2.0 * * @param string|null $avatar HTML for the user's avatar. Default null. * @param mixed $id_or_email The avatar to retrieve. Accepts a user_id, Gravatar MD5 hash, * user email, WP_User object, WP_Post object, or WP_Comment object. * @param array $args Arguments passed to get_avatar_url(), after processing. */ $avatar = apply_filters( 'pre_get_avatar', null, $id_or_email, $args );


    then my plugin will just pick up your images

    paul

    Thread Starter sueyrad

    (@sueyrad)

    Unfortunately i’m having trouble understanding exactly what to do with this information. Am i suppose to be editing pluggable php directly? when i try adding the code:

    get_avatar( mixed $id_or_email, int $size = 96, string $default_value = ”, string $alt = ”, array $args = null ): string|false

    in functions. php it breaks my site. Even when i end it with ;

    and do i need to adjust anything in the second or third code provided?

    I don’t know code language so its confusing to understand what to do.

    I’m just pulling at straws trying to figure it out.

    Could you break it down step for step for me? Id be willing to donate to the plugin and leave 5 star rating if you could help me with that.

    I know your time is important.

    Thank you.

    • This reply was modified 11 months, 1 week ago by sueyrad.
    Thread Starter sueyrad

    (@sueyrad)

    This is what theme support said:

    If user have upload profile image from Front-end user dashboard then profile picture ID is saved in betube_author_avatar_url

    After to get image you need to get image URL. and for that you can use this function.

    betube_get_image_url

    After to get image URL you can use that in your plugin.

    Plugin Author Paul Bearne

    (@pbearne)

    try this
    not it will work but it might

    add_filter( 'pre_get_avatar', static function(){
       return betube_get_image_url( get_current_user_id() );
    });

    If not, then you will need a code to help
    This is the link to Codeable https://codeable.io/?ref=LGu6G You can get fixed price quotes from them for your work

    Thread Starter sueyrad

    (@sueyrad)

    code didn’t work for me but i had my theme creator do the job and it was with the other author list plugin.

    Appreciate the help tho! Maybe someone else will find this info helpful.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Blank Avatars’ is closed to new replies.