Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- /* Real Time Comments ToDo List
- * 1 Change timer to check for new posts every 30 seconds
- * 2 Change system to use a template for both ajax and comment creation
- * 3 Use
- */
- ?>
- <div id="respond">
- <div class="literal twelve columns alpha omega comments-wrapper" id="comments">
- <? $comments_count = wp_count_comments(get_the_id()); ?>
- <div class="literal columns alpha omega"><p class='comment-reply-title'>Comments </p></div>
- <div class="literal columns alpha omega"><p class="comm-count"><? echo $comments_count->approved; ?></p></div>
- </div>
- <div class="clear"></div>
- <?
- if(get_current_user_id() > 0){ ?>
- <form action="http://gamelust.com/wp-comments-post.php" method="post" id="commentform" class="comment-form">
- <p class="comment-form-comment">
- <?
- ?><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea><?/*
- $settings = array(
- 'wpautop' => false,
- 'textarea_rows' => 8,
- 'textarea_cols' => 45,
- 'media_buttons' => false
- );
- wp_editor('', "comment", $settings);*/
- ?>
- </p>
- <p class="form-submit">
- <input name="submit" type="submit" id="submit_comment" class="submit" value="Post Comment" />
- <input type='hidden' name='comment_post_ID' value='<? echo get_the_id(); ?>' id='comment_post_ID' />
- <input type='hidden' name='comment_parent' id='comment_parent' value='0' />
- <input type='hidden' name='current_user' id='current_user_ID' value='<? echo get_current_user_id(); ?>' />
- </p>
- <!--<input type="hidden" id="_wp_unfiltered_html_comment_disabled" name="_wp_unfiltered_html_comment_disabled" value="e9a412a3bc" />-->
- <script>
- (function(){if(window===window.parent){document.getElementById('_wp_unfiltered_html_comment_disabled').name='_wp_unfiltered_html_comment';}})();
- </script>
- </form><?
- } else { ?>
- <p class="comment-login-required">You must be <span class="comment-login">logged in</span> to leave a comment</p><?
- }
- ?>
- </div>
- <div class="mstarAjax" id="commentCounter" post_id="<? echo get_the_id(); ?>" delay="4000" count="<? echo $comments_count->approved; ?>"></div>
- <div class="literal twelve columns alpha omega comments-area">
- <div class="literal twelve columns alpha omega comment-anchor" id="comments-top"></div>
- <?
- //try this method. get all comments order asc
- $the_id = get_the_id();
- $comment_args = array(
- 'post_id' => get_the_id(),
- 'status' => 'approve',
- //'orderby' => 'comment_type',
- //'order' => 'asc',
- 'parent' => 0,
- );
- $comments = get_comments($comment_args);
- //var_viewer($comments);
- foreach($comments as $comment){ ?>
- <div class="literal twelve columns alpha omega single-comment"><?
- if($comment->comment_parent == 0) {
- //var_viewer($comment);
- $comm_id = $comment->comment_ID;
- $commenter = $comment->user_id;
- $user_data = get_userdata($commenter);
- $current_likes = get_comment_meta($comm_id,'user_likes',true);
- $current_dislikes = get_comment_meta($comm_id,'user_dislikes',true); ?>
- <div class="literal twelve columns alpha omega parent-comment" id="comment-<? echo $comm_id; ?>">
- <div class="literal one column alpha omega user-gravatar"><?
- echo get_avatar($commenter, 50); ?>
- </div>
- <div class="literal seven columns alpha omega comment-by">
- <p>Posted by <? echo $user_data->display_name; ?></p>
- </div>
- <div class="literal eleven columns alpha omega comment">
- <p class="comment-content"><? echo apply_filters('the_content',$comment->comment_content); ?></p>
- <div class="clear"></div>
- <div class="literal three columns alpha omega user-data"><?
- if(get_current_user_id() > 0){ ?>
- <a href="" class="reply-link" com_id="<? echo $comm_id; ?>">Reply</a>
- <!--<a href="" class="flag-link" com_id="<? echo $comm_id; ?>">Flag</a>-->
- <a href="#" class="upvote-link" com_id="<? echo $comm_id; ?>"><img src="<? echo get_template_directory_uri(); ?>/images/greenarrow.png" /><span class="upvote"><? echo $current_likes; ?></span></a>
- <a href="#" class="downvote-link" com_id="<? echo $comm_id; ?>"><img src="<? echo get_template_directory_uri(); ?>/images/redarrow.png" /><span class="downvote"><? echo $current_dislikes; ?></span></a><?
- } else { ?>
- <p class="news add-news">You must <a href="<? echo bloginfo('url').'/wp-login.php'; ?>"><span class="comment-login">log in</span></a> or <a href="<? echo bloginfo('url').'/wp-login.php?action=register'; ?>"><span class="comment-login">register</span></a> to reply.</p><?
- } ?>
- </div>
- <div class="literal four columns alpha omega likes-area"></div>
- <div class="literal four columns alpha omega dislikes-area"></div>
- </div>
- </div>
- <div class="clear"></div>
- <div class="literal twelve columns alpha omega" id="reply-form-<? echo $comm_id; ?>" parent="<? echo $comm_id; ?>"></div><?
- }
- if($comm_id){
- $child_args = array(
- 'order' => 'ASC',
- 'parent' => $comm_id,
- 'status' => 'approve',
- );
- $comm_children = get_comments($child_args);
- if($comm_children){
- foreach($comm_children as $child_comment){
- $child_comm_id = $child_comment->comment_ID;
- $child_commenter = $child_comment->user_id;
- $child_user_data = get_userdata($child_commenter);
- $child_current_likes = get_comment_meta($child_comm_id,'user_likes',true);
- $child_current_dislikes = get_comment_meta($child_comm_id,'user_dislikes',true); ?>
- <div class="literal twelve columns alpha omega child-comment" id="comment-<? echo $child_comm_id; ?>">
- <div class="literal one column alpha omega user-gravatar"><?
- echo get_avatar($child_commenter, 50); ?>
- </div>
- <div class="literal seven columns alpha omega comment-by">
- <p>Posted by <? echo $child_user_data->display_name; ?></p>
- </div>
- <div class="literal eleven columns alpha omega comment">
- <p class="comment-content"><? echo apply_filters('the_content',$child_comment->comment_content); ?></p>
- <div class="clear"></div>
- <div class="literal four columns alpha omega user-data"><?
- if(get_current_user_id() > 0){ ?>
- <a class="reply-link" com_id="<? echo $child_comm_id; ?>">Reply</a>
- <a class="upvote-link" com_id="<? echo $child_comm_id; ?>"><img src="<? echo get_template_directory_uri(); ?>/images/greenarrow.png" /><span class="upvote"><? echo $child_current_likes; ?></span></a>
- <a class="downvote-link" com_id="<? echo $child_comm_id; ?>"><img src="<? echo get_template_directory_uri(); ?>/images/redarrow.png" /><span class="downvote"><? echo $child_current_dislikes; ?></span></a><?
- } else { ?>
- <p class="news add-news">You must <a href="<? echo bloginfo('url').'/wp-login.php'; ?>"><span class="comment-login">log in</span></a> or <a href="<? echo bloginfo('url').'/wp-login.php?action=register'; ?>"><span class="comment-login">register</span></a> to reply.</p><?
- } ?>
- </div>
- </div>
- </div>
- <div class="clear"></div>
- <div class="literal twelve columns alpha omega" id="reply-form-<? echo $child_comm_id; ?>" parent="<? echo $child_comm_id; ?>"></div><?
- if($child_comm_id){
- $grand_child_args = array(
- 'order' => 'ASC',
- 'parent' => $child_comm_id,
- 'status' => 'approve',
- );
- $comm_grand_children = get_comments($grand_child_args);
- if($comm_grand_children){
- foreach($comm_grand_children as $grand_child_comment){
- $grand_child_comm_id = $grand_child_comment->comment_ID;
- $grand_child_commenter = $grand_child_comment->user_id;
- $grand_child_user_data = get_userdata($grand_child_commenter);
- $grand_child_current_likes = get_comment_meta($comm_id,'user_likes',true);
- $grand_child_current_dislikes = get_comment_meta($comm_id,'user_dislikes',true); ?>
- <div class="literal twelve columns alpha omega grand-child-comment" id="comment-<? echo $grand_child_comm_id; ?>">
- <div class="literal one column alpha omega user-gravatar"><?
- echo get_avatar($grand_child_commenter, 50); ?>
- </div>
- <div class="literal seven columns alpha omega comment-by">
- <p>Posted by <? echo $grand_child_user_data->display_name; ?></p>
- </div>
- <div class="literal eleven columns alpha omega comment">
- <p class="comment-content"><? echo $grand_child_comment->comment_content; ?></p>
- <div class="clear"></div>
- <div class="literal four columns alpha omega user-data"><?
- if(get_current_user_id() > 0){ ?>
- <a class="reply-link" com_id="<? echo $grand_child_comm_id; ?>">Reply</a>
- <a class="upvote-link" com_id="<? echo $grand_child_comm_id; ?>"><img src="<? echo get_template_directory_uri(); ?>/images/greenarrow.png" /><span class="upvote"><? echo $grand_child_current_likes; ?></span></a>
- <a class="downvote-link" com_id="<? echo $grand_child_comm_id; ?>"><img src="<? echo get_template_directory_uri(); ?>/images/redarrow.png" /><span class="downvote"><? echo $grand_child_current_dislikes; ?></span></a><?
- } else { ?>
- <p class="news add-news">You must <a href="<? echo bloginfo('url').'/wp-login.php'; ?>"><span class="comment-login">log in</span></a> or <a href="<? echo bloginfo('url').'/wp-login.php?action=register'; ?>"><span class="comment-login">register</span></a> to reply.</p><?
- } ?>
- </div>
- </div>
- </div>
- <div class="clear"></div>
- <div class="literal twelve columns alpha omega" id="reply-form-<? echo $grand_child_comm_id; ?>" parent="<? echo $grand_child_comm_id; ?>"></div><?
- if($grand_child_comm_id){
- $great_child_args = array(
- 'order' => 'ASC',
- 'parent' => $grand_child_comm_id,
- 'status' => 'approve',
- );
- $comm_great_children = get_comments($great_child_args);
- if($comm_great_children){
- foreach($comm_great_children as $great_child_comment){
- $great_child_comm_id = $great_child_comment->comment_ID;
- $great_child_commenter = $great_child_comment->user_id;
- $great_child_user_data = get_userdata($great_child_commenter);
- $great_child_current_likes = get_comment_meta($comm_id,'user_likes',true);
- $great_child_current_dislikes = get_comment_meta($comm_id,'user_dislikes',true); ?>
- <div class="literal twelve columns alpha omega great-child-comment" id="comment-<? echo $great_child_comm_id; ?>">
- <div class="literal one column alpha omega user-gravatar"><?
- echo get_avatar($great_child_commenter, 50); ?>
- </div>
- <div class="literal seven columns alpha omega comment-by">
- <p>Posted by <? echo $great_child_user_data->display_name; ?></p>
- </div>
- <div class="literal eleven columns alpha omega comment">
- <p class="comment-content"><? echo apply_filters('the_content', $great_child_comment->comment_content); ?></p>
- <div class="clear"></div>
- <div class="literal four columns alpha omega user-data"><?
- if(get_current_user_id() > 0){ ?>
- <a class="reply-link" com_id="<? echo $great_child_comm_id; ?>">Reply</a>
- <a class="upvote-link" com_id="<? echo $great_child_comm_id; ?>"><img src="<? echo get_template_directory_uri(); ?>/images/greenarrow.png" /><span class="upvote"><? echo $great_child_current_likes; ?></span></a>
- <a class="downvote-link" com_id="<? echo $great_child_comm_id; ?>"><img src="<? echo get_template_directory_uri(); ?>/images/redarrow.png" /><span class="downvote"><? echo $great_child_current_dislikes; ?></span></a><?
- } else { ?>
- <p class="news add-news">You must <a href="<? echo bloginfo('url').'/wp-login.php'; ?>"><span class="comment-login">log in</span></a> or <a href="<? echo bloginfo('url').'/wp-login.php?action=register'; ?>"><span class="comment-login">register</span></a> to reply.</p><?
- } ?>
- </div>
- </div>
- </div>
- <div class="clear">
- </div><div class="literal twelve columns alpha omega" id="reply-form-<? echo $great_child_comm_id; ?>" parent="<? echo $great_child_comm_id; ?>"></div><?
- if($great_child_comm_id){
- $scnd_great_child_args = array(
- 'order' => 'ASC',
- 'parent' => $great_child_comm_id,
- 'status' => 'approve',
- );
- $comm_scnd_great_children = get_comments($scnd_great_child_args);
- if($comm_scnd_great_children){
- foreach($comm_scnd_great_children as $scnd_great_child_comment){
- $scnd_great_child_comm_id = $scnd_great_child_comment->comment_ID;
- $scnd_great_child_commenter = $scnd_great_child_comment->user_id;
- $scnd_great_child_user_data = get_userdata($scnd_great_child_commenter);
- $scnd_great_child_current_likes = get_comment_meta($scnd_great_child_comm_id,'user_likes',true);
- $scnd_great_child_current_dislikes = get_comment_meta($scnd_great_child_comm_id,'user_dislikes',true); ?>
- <div class="literal twelve columns alpha omega great-child-comment" id="comment-<? echo $scnd_great_child_comm_id; ?>">
- <div class="literal one column alpha omega user-gravatar"><?
- echo get_avatar($scnd_great_child_commenter, 50); ?>
- </div>
- <div class="literal seven columns alpha omega comment-by">
- <p>2gPosted by <? echo $scnd_great_child_user_data->display_name; ?></p>
- </div>
- <div class="literal eleven columns alpha omega comment">
- <p class="comment-content"><? echo apply_filters('the_content', $scnd_great_child_comment->comment_content); ?></p>
- <div class="clear"></div>
- <div class="literal four columns alpha omega user-data"><?
- if(get_current_user_id() > 0){ ?>
- <a class="reply-link" com_id="<? echo $scnd_great_child_comm_id; ?>">Reply</a>
- <a class="upvote-link" com_id="<? echo $scnd_great_child_comm_id; ?>"><img src="<? echo get_template_directory_uri(); ?>/images/greenarrow.png" /><span class="upvote"><? echo $scnd_great_child_current_likes; ?></span></a>
- <a class="downvote-link" com_id="<? echo $scnd_great_child_comm_id; ?>"><img src="<? echo get_template_directory_uri(); ?>/images/redarrow.png" /><span class="downvote"><? echo $scnd_great_child_current_dislikes; ?></span></a><?
- } else { ?>
- <p class="news add-news">You must <a href="<? echo bloginfo('url').'/wp-login.php'; ?>"><span class="comment-login">log in</span></a> or <a href="<? echo bloginfo('url').'/wp-login.php?action=register'; ?>"><span class="comment-login">register</span></a> to reply.</p><?
- } ?>
- </div>
- </div>
- </div>
- <div class="clear"></div>
- <div class="literal twelve columns alpha omega" id="reply-form-<? echo $scnd_great_child_comm_id; ?>" parent="<? echo $scnd_great_child_comm_id; ?>"></div><?
- if($scnd_great_child_comm_id){
- $thrd_great_child_args = array(
- 'order' => 'ASC',
- 'parent' => $scnd_great_child_comm_id,
- 'status' => 'approve',
- );
- $comm_thrd_great_children = get_comments($thrd_great_child_args);
- if($comm_thrd_great_children){
- foreach($comm_thrd_great_children as $thrd_great_child_comment){
- $thrd_great_child_comm_id = $thrd_great_child_comment->comment_ID;
- $thrd_great_child_commenter = $thrd_great_child_comment->user_id;
- $thrd_great_child_user_data = get_userdata($thrd_great_child_commenter);
- $thrd_great_child_current_likes = get_comment_meta($thrd_great_child_comm_id,'user_likes',true);
- $thrd_great_child_current_dislikes = get_comment_meta($thrd_great_child_comm_id,'user_dislikes',true); ?>
- <div class="literal twelve columns alpha omega great-child-comment" id="comment-<? echo $thrd_great_child_comm_id; ?>">
- <div class="literal one column alpha omega user-gravatar"><?
- echo get_avatar($thrd_great_child_commenter, 50); ?>
- </div>
- <div class="literal seven columns alpha omega comment-by">
- <p>3gPosted by <? echo $thrd_great_child_user_data->display_name; ?></p>
- </div>
- <div class="literal eleven columns alpha omega comment">
- <p class="comment-content"><? echo apply_filters('the_content', $thrd_great_child_comment->comment_content); ?></p>
- <div class="clear"></div>
- <div class="literal four columns alpha omega user-data"><?
- if(get_current_user_id() > 0){ ?>
- <a class="reply-link" com_id="<? echo $thrd_great_child_comm_id; ?>">Reply</a>
- <a class="upvote-link" com_id="<? echo $thrd_great_child_comm_id; ?>"><img src="<? echo get_template_directory_uri(); ?>/images/greenarrow.png" /><span class="upvote"><? echo $thrd_great_child_current_likes; ?></span></a>
- <a class="downvote-link" com_id="<? echo $thrd_great_child_comm_id; ?>"><img src="<? echo get_template_directory_uri(); ?>/images/redarrow.png" /><span class="downvote"><? echo $thrd_great_child_current_dislikes; ?></span></a><?
- } else { ?>
- <p class="news add-news">You must <a href="<? echo bloginfo('url').'/wp-login.php'; ?>"><span class="comment-login">log in</span></a> or <a href="<? echo bloginfo('url').'/wp-login.php?action=register'; ?>"><span class="comment-login">register</span></a> to reply.</p><?
- } ?>
- </div>
- </div>
- </div>
- <div class="clear"></div><div class="literal twelve columns alpha omega" id="reply-form-<? echo $scnd_great_child_comm_id; ?>" parent="<? echo $thrd_great_child_comm_id; ?>"></div><?
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- } ?>
- </div><?
- }
- //var_viewer($comm_grand_children);
- ?>
- </div>
- <div id="form-template">
- <form action="http://gamelust.com/wp-comments-post.php" method="post" id="reply-form" class="comment-form">
- <p class="comment-form-comment">
- <textarea id="reply" class="reply-box" name="comment" cols="45" rows="8" aria-required="true"></textarea>
- </p>
- <p class="form-submit">
- <input name="submit" type="submit" id="submit_reply" class="submit" value="Add Reply" />
- <input type='hidden' name='comment_post_ID' value='<? echo get_the_id(); ?>' id='reply_post_ID' />
- <input name="close" type="submit" id="close_reply" class="close-reply" value="Cancel" com_id="" />
- </p>
- <input type="hidden" id="_wp_unfiltered_html_comment_disabled" name="_wp_unfiltered_html_comment_disabled" value="e9a412a3bc" />
- <script>
- (function(){if(window===window.parent){document.getElementById('_wp_unfiltered_html_comment_disabled').name='_wp_unfiltered_html_comment';}})();
- </script>
- </form>
- </div>
- <!--<div id="comment-template"><li><div cols="7"><img t="av" /></div><div cols="1"><p type="d_name"></p></div><div cols="11"><p type="cont"></p><div class="clear"></div><div cols="4"><a type="reply">Reply</a><a type="uv"><img type="uv" /><span count="uv"></span></a><a type="dv"><img type="dv" /><span count="dv"></span></a></div></div></div><div type="clear"></div></div>-->
- <?
- /*
- $commentdata = array(
- 'comment_post_ID' => $post->ID, // to which post the comment will show up
- 'comment_author' => 'Another Someone', //fixed value - can be dynamic
- 'comment_author_email' => '[email protected]', //fixed value - can be dynamic
- 'comment_author_url' => 'http://example.com', //fixed value - can be dynamic
- 'comment_content' => 'Comment messsage...', //fixed value - can be dynamic
- 'comment_type' => '', //empty for regular comments, 'pingback' for pingbacks, 'trackback' for trackbacks
- 'comment_parent' => 0, //0 if it's not a reply to another comment; if it's a reply, mention the parent comment ID here
- 'user_id' => $current_user->ID, //passing current user ID or any predefined as per the demand
- );
- //Insert new comment and get the comment ID
- $comment_id = wp_new_comment( $commentdata );
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement