WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Live Comment Preview] Gravatars shown in preview even if turned off in blog settings

[Plugin: Live Comment Preview] Gravatars shown in preview even if turned off in blog settings

Viewing 4 replies - 1 through 4 (of 4 total)
  • Got it to work. Here are the changes, if you’d like to incorporate them:

    line 35:

    // Customize this string if you want to modify the preview output
    	// %1 - author's name (as hyperlink if available)
    	// %2 - comment text
    	// %3 - gravatar image url
    	$previewFormat = '
    		<ol class="commentlist" style="clear: both; margin-top: 3em;">
    			<li id="comment-preview" class="alt" style="overflow: hidden;">';
    	if (get_option('show_avatars') != '0')
    		$previewFormat .= '<img src="%3" alt="" class="avatar avatar-' . $gravatar_size . '" width="' . $gravatar_size . '" height="' . $gravatar_size . '"/>';
    	$previewFormat .= '<cite>%1</cite> Says:
    				<br />
    				%2
    			</li>
    		</ol>';

    around line 200:

    if (get_option('show_avatars') != '0') $previewFormat = str_replace("%3", "' + gravatar + '", $previewFormat);

    n/m, that worked in testing but removed the comment text in production.

    get_avatar does have the check built in. Look at the code in the default theme:
    <?php echo get_avatar( $comment, 32 ); ?>

    That’s all it takes in a theme.

    Live Comment Preview, on the other hand, is *live*. It’s generated via some other means, not via the PHP code.

    I know. I just can’t seem to make it work. For now I’ve disabled the avatar in the CSS: #comment-preview img.avatar { display: none; }

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Live Comment Preview] Gravatars shown in preview even if turned off in blog settings’ is closed to new replies.
Skip to toolbar