Support » Plugin: Simple Comment Notification » Customization Example

  • Resolved serjao

    (@serjao)


    I love plugin, but i need for a example how to personalize the title and content of the autoresponder using function. This was not clear to me.

    One feature I’d like to see in the plugin is a checkbox for users to authorize the reply

Viewing 7 replies - 16 through 22 (of 22 total)
  • Plugin Author Beherit

    (@beherit)

    Oh one important thing – this will work only for not logged-in users 🙂

    Yes, i tested with not logged users. Not show checkbox.

    • This reply was modified 3 years, 2 months ago by serjao.

    It worked on the Twenty Seventeen theme.

    I think the problem is with the custom theme I’m using. I’ll try to figure out what’s going on.

    Thanks for plugin update.

    My comment template uses an old code. The plugin does not work on it. Any tip?

    <?php // Do not delete these lines
    	if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
    		die ('Please do not load this page directly. Thanks!');
    
    	if (!empty($post->post_password)) { // if there's a password
    		if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) {  // and it doesn't match the cookie
    			?>
    
    			<p class="nocomments">This post is password protected. Enter the password to view comments.</p>
    
    			<?php
    			return;
    		}
    	}
    
    	/* This variable is for alternating comment background */
    	$oddcomment = 'class="alt" ';
    ?>
    
    <!-- You can start editing here. -->
    <div id="comments">
    
    <?php if ($comments) : ?>
    
             <h3>Comentários:</h3>
    
    	<ol class="commentlist">
    
    	<?php $count_pings = 1; foreach ($comments as $comment) : ?>
    
    		<li <?php echo $oddcomment; ?>id="comment-<?php comment_ID() ?>">
    
    			<span><?php echo $count_pings; $count_pings++; ?></span>
    			<cite><?php comment_author_link() ?>&nbsp;disse:</cite>
    			<?php comment_text() ?>
    			<?php if ($comment->comment_approved == '0') : ?>
    			<p><b>Seu comentário está aguardando moderação.</b></p>
    			<?php endif; ?>
    
    		</li>
    
    	<?php
    		/* Changes every other comment to a different class */
    		$oddcomment = ( empty( $oddcomment ) ) ? 'class="alt" ' : '';
    	?>
    
    	<?php endforeach; /* end for each comment */ ?>
    
    	<div class="navigation">
        <div class="alignleft"><?php previous_comments_link(); ?></div>
        <div class="alignright"><?php next_comments_link(); ?></div>
    </div>
    
    	</ol>
    
    <?php endif; ?>
    
    	<?php if ('open' == $post->comment_status) : ?>
    		<!-- If comments are open, but there are no comments. -->
    
    	<?php else : // comments are closed ?>
    		<!-- If comments are closed. -->
    		<p class="nocomments">Os comentários para esse artigo estão fechados. Não é possível mais comentar nesse artigo.</p>
    
    	<?php endif; ?>
    
    <?php if ('open' == $post->comment_status) : ?>
    
    <hr/>
    
    <h3 class="center">Gostou? Deixe seu comentário!</h3>
    
    <?php if ( get_option('comment_registration') && !$user_ID ) : ?>
    <p>You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>">logged in</a> to post a comment.</p>
    <?php else : ?>
    
    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    
    <ul class="formlist">
    
    <li><textarea name="comment" id="comment" cols="70%" rows="7" tabindex="1" value="Digite seu comentário aqui."></textarea></li>
    
    <?php if ( $user_ID ) : ?>
    
    <p>Logado como: <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">&raquo; Sair &raquo;</a></p>
    
    <?php else : ?>
    
    <li><input type="text" name="author" id="author" value="Nome <?php if ($req) echo "(obrigatório)"; ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> onblur="if(this.value.length == 0) this.value='Nome <?php if ($req) echo "(obrigatório)"; ?>';" onclick="if(this.value == 'Nome <?php if ($req) echo "(obrigatório)"; ?>') this.value='';" /></li>
    
    <li><input type="text" name="email" id="email" value="E-mail <?php if ($req) echo "(obrigatório)"; ?>" size="22" tabindex="3" <?php if ($req) echo "aria-required='true'"; ?> onblur="if(this.value.length == 0) this.value='E-mail <?php if ($req) echo "(obrigatório)"; ?>';" onclick="if(this.value == 'E-mail <?php if ($req) echo "(obrigatório)"; ?>') this.value='';" /></li>
    
    <?php endif; ?>
    
    <!--<p><small><strong>XHTML:</strong> You can use these tags: <code><?php echo allowed_tags(); ?></code></small></p>-->
    
    <li class="submitbutton"><input name="submit" type="submit" id="submit" tabindex="4" value="Enviar" /></li>
    <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
    
    <?php do_action('comment_form', $post->ID); ?>
    
    </ul>
    
    </form>
    
    <?php endif; // If registration required and not logged in ?>
    
    <?php endif; // if you delete this the sky will fall on your head ?>
    
    </div>
    
    Plugin Author Beherit

    (@beherit)

    You need to use function comment_form() instead of do_action(‘comment_form’ …). Check this: https://developer.wordpress.org/reference/functions/comment_form/

    I made the changes in the theme and the extension is working very well.

    Thanks for your job.

    Plugin Author Beherit

    (@beherit)

    Nice, I will release a new version soon 🙂

Viewing 7 replies - 16 through 22 (of 22 total)
  • The topic ‘Customization Example’ is closed to new replies.