Example #1
0
    <input type="hidden" name="inline_comments_nonce" value="<?php 
    print wp_create_nonce('inline_comments_nonce');
    ?>
" id="inline_comments_nonce" />
    <?php 
    if (get_option('comment_registration') != 1 || is_user_logged_in()) {
        ?>
        <div class="inline-comments-content inline-comments-content-comment-fields">
            <div class="inline-comments-p">
                <form action="javascript://" method="POST" id="default_add_comment_form">
                    <input type="hidden" name="inline_comments_nonce" value="<?php 
        print wp_create_nonce('inline_comments_nonce');
        ?>
" id="inline_comments_nonce" />
                    <?php 
        inline_comments_profile_pic();
        ?>
                    <textarea placeholder="Press enter to submit comment&#8230;" tabindex="4" id="comment" name="comment" id="inline-comments-textarea" class="inline-comments-auto-expand submit-on-enter"></textarea>
                    <span class="inline-comments-more-handle"><a href="#">more</a></span>
                    <div class="inline-comments-more-container" <?php 
        if ($user_email != null && isset($keep_open) && $keep_open != "on") {
            ?>
style="display: none;"<?php 
        }
        ?>
>
                        <div class="inline-comments-allowed-tags-container">
                            Allowed <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes:
                            <code>&lt;a href="" title=""&gt; &lt;blockquote&gt; &lt;code&gt; &lt;em&gt; &lt;strong&gt;</code>
                        </div>
                        <div class="inline-comments-field"><input type="text" tabindex="5" name="user_name" id="inline_comments_user_name" placeholder="<?php 
/**
 * Load comments and comment form
 *
 * @since 0.1-alpha
 */
function inline_comments_load_template()
{
    check_ajax_referer('inline_comments_nonce', 'security');
    $comments = get_comments(array('post_id' => (int) $_POST['post_id'], 'number' => 100, 'status' => 'approve', 'order' => 'ASC'));
    ?>
    <div class="inline-comments-container" id="comments_target">
        <?php 
    if ($comments) {
        foreach ($comments as $comment) {
            ?>
            <?php 
            // ck get the paragraph id from the comment meta
            $para_id = get_comment_meta($comment->comment_ID, 'para_id', true);
            $user = new WP_User($comment->user_id);
            $class = null;
            if (!empty($user->roles) && is_array($user->roles)) {
                foreach ($user->roles as $role) {
                    $class = $role;
                }
            } else {
                $class = 'annon';
            }
            // ck -added data-comment-para-id to div
            ?>
            <div class="orphan-comment comment-para-id-<?php 
            echo $para_id;
            ?>
 inline-comments-content inline-comments-<?php 
            echo $class;
            ?>
" id="comment-<?php 
            echo $comment->comment_ID;
            ?>
">
                <div class="inline-comments-p">
                    <?php 
            inline_comments_profile_pic($comment->comment_author_email);
            ?>
                    <?php 
            print $comment->comment_content;
            ?>
<br />
                    <time class="meta">
                        <strong><?php 
            $user = get_user_by('login', $comment->comment_author);
            if (!empty($user->user_url)) {
                ?>
<a href="<?php 
                print $user->user_url;
                ?>
" target="_blank"><?php 
                print $comment->comment_author;
                ?>
</a><?php 
            } else {
                print $comment->comment_author;
            }
            ?>
</strong>
                        <a href="<?php 
            echo get_permalink($comment->comment_post_ID);
            ?>
#<?php 
            echo $comment->comment_ID;
            ?>
" class="inline-comments-time-handle" data-comment_id="<?php 
            echo $comment->comment_ID;
            ?>
"><?php 
            print human_time_diff(strtotime($comment->comment_date), current_time('timestamp'));
            ?>
 ago.</a>
                    </time>
                </div>
            </div>
        <?php 
        }
    }
    ?>
    </div>
    <?php 
    die;
}