How to make current user’s avatar + display name link to their profile?

Use get_the_author_link() or get_the_author_meta(‘user_url’, $user_id). Your code would become something like: $author_link = get_the_author_link(); $header .= ‘<div><a href=”‘. $author_link . ‘”>’ .get_avatar($user_ID, 64).'</a></div>’; $header .= ‘<div><strong><a href=”‘ . $author_link . ‘”>’ . __(“”, “front-end-pm”).’ ‘. fep_get_userdata($user_ID, ‘display_name’, ‘id’) .'</a></strong>’; Watch out with the quotes though, your code seems to use double quotes, I tried to … Read more

Avatar picture does not display when using get_avatar

The get_avatar function is a pluggable function with it’s first parameter being either the user’s ID or email. You’re using get_avatar with get_the_author_meta(‘ID’) which should give you the ID of the current user within the Loop. From the Codex If used within The Loop, the user ID need not be specified, it defaults to current … Read more

Hexagon avatar with get_avatar()

You can use the extra_attr input argument to add extra arguments to the gravatar’s image tag: <?php echo get_avatar( ThemexUser::$data[‘user’][‘ID’], 200, // size ”, // default ”, // alt [ ‘extra_attr’ => ‘clip-path=”url(#myClip)”‘ ] // args ); ?> but note that it’s unescaped. You could also add e.g. class=”hexagon” with: <?php echo get_avatar( ThemexUser::$data[‘user’][‘ID’], 200, … Read more

Return WP avatar inside a function

Replace the below line your code return get_avatar( get_the_author_meta( ‘ID’ ), 32 ); to return get_avatar_url( get_the_author_meta( ‘ID’ ) ); Hope this helps.

Custom Field Repeating When Using foreach

if you want to use multiple users, if you will add usernames comma separated in custom field. try below code. function user_avatar() { $user = “”; $names = get_post_meta( get_the_ID(), ‘user_name’, true ); $user_names = array_map(‘trim’, explode(‘,’, $names)); if(!empty($user_names)) { foreach ($user_names as $key => $user_name) { $user = get_user_by( ‘login’, $user_name ); if($user) { … Read more

How to change users avatar with specific e-mail addresses

Two things: The $id_or_email can be an integer (a user ID), a string (Gravatar MD5 hash or user email) or an object (e.g. a WP_User instance), so you can’t simply do $mail = $id_or_email->comment_author_email;. The email addresses in your list are all in the form of anonimus_<number>@anonimus.com, so instead of defining that long array, you … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)