<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									Conditionally changing comment avatar - How-to and Troubleshooting				            </title>
            <link>https://wpdiscuz.com/community/troubleshooting/conditionally-changing-comment-avatar/</link>
            <description>wpDiscuz WordPress Comment Plugin Community. Support and Resources.</description>
            <language>en-US</language>
            <lastBuildDate>Mon, 20 Jul 2026 16:39:26 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>RE: Conditionally changing comment avatar</title>
                        <link>https://wpdiscuz.com/community/troubleshooting/conditionally-changing-comment-avatar/#post-22925</link>
                        <pubDate>Fri, 19 Jan 2024 05:06:31 +0000</pubDate>
                        <description><![CDATA[Thank you for looking into it and for future updates!]]></description>
                        <content:encoded><![CDATA[<p>Thank you for looking into it and for future updates!</p>]]></content:encoded>
						                            <category domain="https://wpdiscuz.com/community/troubleshooting/">How-to and Troubleshooting</category>                        <dc:creator>Billy</dc:creator>
                        <guid isPermaLink="true">https://wpdiscuz.com/community/troubleshooting/conditionally-changing-comment-avatar/#post-22925</guid>
                    </item>
				                    <item>
                        <title>RE: Conditionally changing comment avatar</title>
                        <link>https://wpdiscuz.com/community/troubleshooting/conditionally-changing-comment-avatar/#post-22904</link>
                        <pubDate>Thu, 18 Jan 2024 10:04:31 +0000</pubDate>
                        <description><![CDATA[The get_avatar() function currently lacks a comment ID parameter, rendering the logic ineffective.In the upcoming version of wpDiscuz, we&#039;ll add comments support, enabling you to achieve the...]]></description>
                        <content:encoded><![CDATA[<p>The get_avatar() function currently lacks a comment ID parameter, rendering the logic ineffective.<br /><br />In the upcoming version of wpDiscuz, we'll add comments support, enabling you to achieve the desired functionality.</p>
<pre contenteditable="false">function change_comment_avatar( $avatar, $id_or_email, $size, $default, $alt, $args ) {
	$comment = empty($args) ? null : $args;
	if ( $comment instanceof WP_Comment) {
		$fun_comment = get_comment_meta($comment-&gt;comment_ID, 'the_fun_comment', true);
		if ($fun_comment == 'on') {
			$avatar = "&lt;img alt='{$alt}' src='example.png' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' /&gt;";
		}
	}
	return $avatar;
}

add_filter( 'get_avatar', 'change_comment_avatar', 99, 6 );</pre>]]></content:encoded>
						                            <category domain="https://wpdiscuz.com/community/troubleshooting/">How-to and Troubleshooting</category>                        <dc:creator>Asti</dc:creator>
                        <guid isPermaLink="true">https://wpdiscuz.com/community/troubleshooting/conditionally-changing-comment-avatar/#post-22904</guid>
                    </item>
				                    <item>
                        <title>RE: Conditionally changing comment avatar</title>
                        <link>https://wpdiscuz.com/community/troubleshooting/conditionally-changing-comment-avatar/#post-22884</link>
                        <pubDate>Tue, 16 Jan 2024 10:53:22 +0000</pubDate>
                        <description><![CDATA[I&#039;ll ask the developers and provide you with an update shortly.]]></description>
                        <content:encoded><![CDATA[<p>I'll ask the developers and provide you with an update shortly. </p>]]></content:encoded>
						                            <category domain="https://wpdiscuz.com/community/troubleshooting/">How-to and Troubleshooting</category>                        <dc:creator>Asti</dc:creator>
                        <guid isPermaLink="true">https://wpdiscuz.com/community/troubleshooting/conditionally-changing-comment-avatar/#post-22884</guid>
                    </item>
				                    <item>
                        <title>Conditionally changing comment avatar</title>
                        <link>https://wpdiscuz.com/community/troubleshooting/conditionally-changing-comment-avatar/#post-22881</link>
                        <pubDate>Tue, 16 Jan 2024 00:27:45 +0000</pubDate>
                        <description><![CDATA[I&#039;m using a custom field that I added to my comment form and I know from there I can target the meta key with a function. If the key equals a certain value, I want to change or hide that com...]]></description>
                        <content:encoded><![CDATA[<p>I'm using a custom field that I added to my comment form and I know from there I can target the meta key with a function. If the key equals a certain value, I want to change or hide that comment author's avatar. The following seems like it should work but it doesn't. Does anyone out there know how to hide or change the avatar within wpDiscuz comments if a custom meta key's value is detected? By the way, I know the custom field is set correctly because I'm able to change the author name, and I was able to add a class based on this custom field. Only the avatar gives me trouble. Also, changing the priority of get_avatar does nothing.</p>
<pre contenteditable="false">function change_comment_avatar($avatar, $id_or_email, $size, $default, $alt) {
    $comment = get_comment($id_or_email);
    $fun_comment = get_comment_meta($comment-&gt;comment_ID, 'the_fun_comment', true);
    if ($fun_comment == 'on') {
        $avatar = "&lt;img alt='{$alt}' src='example.png' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' /&gt;";
    }
    return $avatar;
}
add_filter('get_avatar', 'change_comment_avatar', 10, 5);</pre>]]></content:encoded>
						                            <category domain="https://wpdiscuz.com/community/troubleshooting/">How-to and Troubleshooting</category>                        <dc:creator>Billy</dc:creator>
                        <guid isPermaLink="true">https://wpdiscuz.com/community/troubleshooting/conditionally-changing-comment-avatar/#post-22881</guid>
                    </item>
							        </channel>
        </rss>
		