Reply
A new Threaded Wordpress Comments Plugin
Old 04-29-2008, 09:59 PM A new Threaded Wordpress Comments Plugin
jamestl2's Avatar
Mmmm.......... Reindeer

Latest Blog Post:
Recent Comments Page
Posts: 2,195
Name: <member type="brilliant" alt="foolish">James Lewitzke</member>
Location: / public_html / Universe / Virgo_Supercluster / Local_Group / Milky_Way / Orion_Arm / Solar_System / Earth / North_America / USA / Wisconsin
I've been working on trying to code this sort of feature into my blog all day for the past few days, and with the plugins I've tried (Brian's Threaded Comments, Ajax, etc.), I've been getting errors everywhere, no current theme CSS, etc. It's been really frustrating . (and the WP.org forums haven't been much help either )

Basically what I wanted to do was have a system similar to what those plugins offer, but..... I want:
  • Just the ability to indent a few levels, replying to the above comment (It'd be nice if the form could move too, like with the BTC plugin)
  • To use my theme's current comment stylesheet (I already like the way my comment styles and colors look)
  • And I do NOT want a new comments.php page. (which is what all those WP plugins seem to come with)
I was thinking about just taking the code from each of the files Brian's TC plugin offers, and just making one whole php page plugin out of it, but I'd have no idea what to move to where.

Here's Brian's Threaded Comments' Plugin's code:
PHP Code:
<?php
/*
Plugin Name: Brian's Threaded Comments
Plugin URI: http://meidell.dk/threadedcomments/
Version: 1.5.18
Description: This gives you threaded comments and a "wandering" comment form.
Author: Brian Meidell
Author URI: http://meidell.dk/

Changelog:
   version 1.5:     Released for WP1.5
   version 1.5.1:    Added error message for missing form field
   version 1.5.2:    Fixed stupid bug from last release    
   version 1.5.3:    Much more comprehensive error messages to help with diagnosis of problems.
                  Added login patch from Salil Deshpande.
                  Added auto-integration with subscribe-to-comments.
   version 1.5.4:    A fix to Salil Deshpandes patch - proper login required code, thanks to Salil again.
                  Renamed maybe_add_column to prevent conflicts with other plugins.
   version 1.5.5:    Added an options panel called "Threaded Comments" for the few settings
   version 1.5.6:    Changed comment_reply_ID form field to use comment_form hook instead, making it 
                  compatible with other plugins using this hook. Thanks to Martey of www.marteydodoo.com for pointing this out.
   version 1.5.7: Included bugfix from Zhou Qingbo
   version 1.5.8:    Fixed php opening tags to be verbose, as suggested by Michael Carrino
   version 1.5.9:    Changed plugin to use only existing database columns, and added migration code from older versions
   version 1.5.10: Changed nesting levels setting so it correctly reflects the nesting level (it was one off)
   version 1.5.11: Fixed taborder. Thanks to RJ Matthis (http://blog.reformatthis.com) / Ryan J Parker (http://www.ryanjparker.net)
   version 1.5.12: Fixed missing php opening tag
   version 1.5.15: Fixed closed/open comments bug and deploy script
   version 1.5.16: Big thanks to NSpeaks - Fixed issues mentioned in this post: http://nspeaks.com/149/hacking-brian’s-threaded-comments-plugin/
   version 1.5.17: Fixes from this article implemented: http://www.howtospoter.com/web-20/wordpress/fixing-brians-threaded-comments-plugin - thanks to Alex Sysoef
   version 1.5.18: Added gravatar support for wp2.5 and myavatars, thanks to Alex Sysoef
*/

 
/**
 * Images
 */
$images = array();
$images['subscribed.png'] = "iVBORw0KGgoAAAANSUhEUgAAABUAAAAICAMAAAAhgUThAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAAGUExURai0vvP8+20m9Z0AAAACdFJOU/8A5bcwSgAAAE5JREFUeNpiYAQBBhBGAgABxAARZYBgRigPIIBgchAI1cgAEEBwFWDlUNMYAAIIWS3cIAaAAEIyFy7OyAAQQAxIbkDYBhBAcCaKywACDAAgyABfpZamZwAAAABJRU5ErkJggg==";
$images['subthread.png'] = "iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAAEF7NTqAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAACmSURBVHjaYvz//z8DCAAEEBMDFAAEECNMBCCA4CIAAQQXgQGAAGJiQAMAAYSiAiCAGIEYzgMIIBSlAAGEogwggBignP/oGCQOEEAYNiADgADCKwkQQBiOhQGAAGIByzIyosgCFTMCBBBOHQABhFMHQADh1AEQQDh1AAQQTh0AAYRTAh8ACCBEzKBZhY8PEEBMDGQAgAAiSxNAAJGlCSCAyAoIgAADAEniPAbcSIg9AAAAAElFTkSuQmCC";
$images['subthread-open.png'] = "iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAAEF7NTqAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAACoSURBVHjaYvz//z8DCAAEEBMDFAAEECNMBCCA4CIAAQQXgQGAAGJiQAMAAYSiAiCAQOg/VOA/QAChKAUIIBRlAAHEAFOCjkHiAAGEYQMyAAggvJIAAYThFBgACCAWsCwj4380dzICBBBOHQABhFMHQADh1AEQQDh1AAQQTh0AAYRTAh8ACCBEzKBZhWE6kjxAADExkAEAAogsTQABRJYmgAAiKyAAAgwA3YE+/1F5tWAAAAAASUVORK5CYII=";
$images['spacer.png'] = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQI12NgYGBgAAAABQABXvMqOgAAAABJRU5ErkJggg==";

if(isset(
$_GET['image']))
{
    
header("content-type: image/png");
    print 
base64_decode($images[$_GET['image']]);
    exit;
}

function 
btc_options_page()
{
    global 
$wpdb;
?>
 
<div class="wrap"> 
<?php 
    $col 
$wpdb->get_col("DESCRIBE {$wpdb->comments} comment_reply_ID");
    
$col count$col );
?>
  <?php if( $col && !get_option("btc_migrated") ) { ?>
  <h2><?php _e('Upgrade Threading'); ?></h2>
  <form name="form2" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
    <table width="100%" cellspacing="2" cellpadding="5" class="editform"> 
      <tr valign="top"> 
        <th width="33%" scope="row"><?php _e('Migrate Threading'?></th> 
        <td>
    <?php if( isset($_REQUEST['btc_upgrade']) ) { 
         
$wpdb->query("UPDATE {$wpdb->comments} SET comment_parent=comment_reply_ID WHERE comment_parent = 0");
        
update_option("btc_migrated");
    
?>
           Done migrating comments.
    <?php } else { ?>
      <input type="submit" name="btc_upgrade" value="Migrate now" />
    <br />
    Migrate threading from older version of Brians Threaded Comments plugin. 
    <?php
    
?>
    </td> 
      </tr> 
      </table>
  </form>
  <?php ?>
  <h2><?php _e('Brians Threaded Comments Options'?></h2> 
  <form name="form1" method="post" action="options.php"> 
    <input type="hidden" name="action" value="update" /> <input type="hidden" name="page_options" value="btc_nestinglevels,btc_shrinkby,btc_customtarget,btc_separate_trackbacks" /> 
    <table width="100%" cellspacing="2" cellpadding="5" class="editform"> 
      <tr valign="top"> 
        <th width="33%" scope="row"><?php _e('Max Nesting Levels:'?></th> 
        <td><input name="btc_nestinglevels" type="text" id="btc_nestinglevels" value="<?php form_option('btc_nestinglevels'); ?>" size="5" /></td> 
      </tr> 
      <tr valign="top"> 
        <th scope="row"><?php _e('Shrink Font By %:'?></th> 
        <td><input name="btc_shrinkby" type="text" id="btc_shrinkby" value="<?php form_option('btc_shrinkby'); ?>" size="5" />
        <br />
<?php _e('Enables shrinking the font by n percent per nesting level. Recommended is 0%-2%.'?></td> 
      </tr> 
      <tr valign="top"> 
        <th width="33%" scope="row"><?php _e('Custom Comments Target:'?></th> 
        <td><input name="btc_customtarget" type="text" id="btc_customtarget" value="<?php form_option('btc_customtarget'); ?>" size="40" />
    <br /> 
<?php _e('If you have renamed your wp-comments-post.php file to prevent comment spam, set the filename here (relative to the site root).'?></td> 
      </tr> 
      <tr valign="top"> 
        <th width="33%" scope="row"><?php _e('Separate Trackbacks:'?></th> 
          <td><input name="btc_separate_trackbacks" type="checkbox" id="btc_separate_trackbacks" <?php checked('1'get_settings('btc_separate_trackbacks')); ?> value="1" size="40" />
      </tr> 
</table>

    </fieldset> 
    <p class="submit">
      <input type="submit" name="Submit" value="<?php _e('Update Options'?> &raquo;" />
    </p>
  </form> 
</div> 
<?php 
    
include("admin-footer.php");
    exit;
}
    
/**
 * Settings   
 */
 
$shrinkby get_option("btc_shrinkby");      //    Each level of nesting makes the font size 2% smaller
 
$btc_cutoff_level get_option("btc_nestinglevels")-1;         //     At what level of nesting should we flatten the tree

function bnc_altertable()
{
    global 
$tablecomments;
    if(
get_option("btc_shrinkby") == false)
        
add_option("btc_shrinkby"0"Shrink percentage per nesting level for Brians Threaded Comments");
    if(
get_option("btc_nestinglevels") == false)
        
add_option("btc_nestinglevels"3"Max numver of nesting levels for Brians Threaded Comments");
    if(
get_option("btc_customtarget") == false)
        
add_option("btc_customtarget""wp-comments-post.php""Custom post target script name for Brians Threaded Comments");
    if(
get_option("btc_separate_trackbacks") === false)
        
add_option("btc_separate_trackbacks"'1'"Separate trackbacks form comments for Brians Threaded Comments");
}

function 
briansthreadedcomments() {
global 
$shrinkby;
if (!(
$withcomments) && ($single)) return;

// You can safely delete the single line below if your threaded comments are up and running
    
bnc_altertable();
    
?>
<script language="javascript" type="text/javascript">
<!--
        function collapseThread( theId ) {
            var comment = document.getElementById(theId);
            if(!comment)
            {
                alert("ERROR:\nThe document structure is different\nfrom what Threaded Comments expects.\nYou are missing the element '"+theId+"'");
                return;
            }
            var theBody = findBody(comment);
            if(comment.className.indexOf("collapsed") > -1) {
                comment.className = comment.className.replace(" collapsed", "");;
            } else {
                comment.className += " collapsed";
            }
        }

        function expandThread( theId ) {
            var comment = document.getElementById(theId);
            if(!comment)
            {
                alert("ERROR:\nThe document structure is different\nfrom what Threaded Comments expects.\nYou are missing the element '"+theId+"'");
                return;
            }
            var theBody = findBody(comment);
            if(comment.className.indexOf("collapsed") > -1) {
                comment.className = comment.className.replace(" collapsed", "");;
            } 
        }
        
        function findBody(el)
        {
            var divs = el.getElementsByTagName("div");
            var ret;
            for(var i = 0; i < divs.length; ++i) {
                if(divs.item(i).className.indexOf("body") > -1)
                    return divs.item(i);
            }
            return false;
        }
    
        function onAddComment() {
            //checkDocumentIntegrity();
            var el = document.getElementById("commentform");
            // Future release: Check if form is filled correctly and mark the form fields.
            el.submit();
        }
        
        function moveAddCommentBelow(theId, threadId, collapse)
        {
            expandThread( theId );
            var addComment = document.getElementById("addcomment");
            if(!addComment)
            {
                  alert("ERROR:\nThreaded Comments can't find the 'addcomment' div.\nThis is probably because you have changed\nthe comments.php file.\nMake sure there is a tag around the form\nthat has the id 'addcomment'"); 
                return
            }
            var comment = document.getElementById(theId);
            if(collapse)
            {
                for(var i = 0; i < comment.childNodes.length; ++i) {
                    var c = comment.childNodes.item(i);
                    if(typeof(c.className) == "string" && c.className.indexOf("collapsed")<0) {
                        c.className += " collapsed";
                    }
                }
            }
            addComment.parentNode.removeChild(addComment);

            comment.appendChild(addComment);
            if(comment.className.indexOf("alt")>-1) {
                addComment.className = addComment.className.replace(" alt", "");                    
            } else {
                addComment.className += " alt";
            }
                var replyId = document.getElementById("comment_reply_ID");
            if(replyId == null)
            {
                alert("Brians Threaded Comments Error:\nThere is no hidden form field called\n'comment_reply_ID'. This is probably because you\nchanged the comments.php file and forgot\nto include the field. Please take a look\nat the original comments.php and copy the\nform field over.");
            }
            replyId.value = threadId;
            var reRootElement = document.getElementById("reroot");
            if(reRootElement == null)
            {
                alert("Brians Threaded Comments Error:\nThere is no anchor tag called 'reroot' where\nthe comment form starts.\nPlease compare your comments.php to the original\ncomments.php and copy the reroot anchor tag over.");
            }
            reRootElement.style.display = "block";
            var aTags = comment.getElementsByTagName("A");
            var anc = aTags.item(0).id;
            //document.location.href = "#"+anc;
            document.getElementById("comment").focus();
        }

        function checkDocumentIntegrity()
        {
            str = "";
            
            str += checkElement("reroot","div tag");
            str += checkElement("addcomment", "div tag");
            str += checkElement("comment_reply_ID", "hidden form field");
            str += checkElement("content", "div tag");
            str += checkElement("comment", "textfield");
            str += checkElement("addcommentanchor", "anchor tag");
            
            if(str != "")
            {
                str = "Brian's Threaded Comments are missing some of the elements that are required for it to function correctly.\nThis is probably the because you have changed the original comments.php that was included with the plugin.\n\nThese are the errors:\n" + str;
                str += "\nYou should compare your comments.php with the original comments.php and make sure the required elements have not been removed.";

                alert(str);
            }
        }
               
        function checkElement(theId, elDesc)
        {
            var el = document.getElementById(theId);
            if(!el)
            {
                if(elDesc == null)
                    elDesc = "element";
                return "- The "+elDesc+" with the ID '" +theId + "' is missing\n"; 
            }
            else 
                return "";
        }
        
        function reRoot()
        {
            var addComment = document.getElementById("addcomment");            
            var reRootElement = document.getElementById("reroot");
            reRootElement.style.display = "none";
            var content = document.getElementById("content-main");
            if( !content )
                content = document.getElementById("content");
            if( content )
            {
                addComment.parentNode.removeChild(addComment);
                content.appendChild(addComment);
            }
            addComment.className = addComment.className.replace(" alt", "");
            document.location.href = "#addcommentanchor";
            document.getElementById("comment").focus();                
            document.getElementById("comment_reply_ID").value = "0";
        }            
        
        function changeCommentSize(d)
        {
            var el = document.getElementById("comment");
            var height = parseInt(el.style.height);
            if(!height && el.offsetHeight)
                height = el.offsetHeight;
            height += d;
            if(height < 20) 
                height = 20;
            el.style.height = height+"px";
        }        
-->
</script>
<style type="text/css">
.comment 
{
    position:                 relative;
    margin:                    3px;
    margin-top:                6px;
/*    border:                 1px solid #666; */
    padding:                4px 4px 4px 8px;
<?php if($shrinkby 0) { ?>
    font-size:                <?php echo (100-$shrinkby); ?>%;
<?php ?>
    background-color:        #fff;
}

.odd
{
    background-color: #f8f8f8;
}

.comment div {
    position:                 relative;
}

.comment .comment img
{
    margin:                 0px;
}

.comment .collapseicon 
{
    width:                     13px;
    height:                 13px;
    overflow:                hidden;
    background-image:         url(<?php echo get_settings('siteurl'); ?>/wp-content/plugins/briansthreadedcomments.php?image=subthread-open.png);
}

.collapsed .collapseicon 
{
    background-image:         url(<?php echo get_settings('siteurl'); ?>/wp-content/plugins/briansthreadedcomments.php?image=subthread.png);
}


.comment .reply {
    text-align:             right;
    font-size:                 80%;
    padding:                 0px 6px 6px 0px;
}

.comment
{
    border:     1px solid #ddd;
    margin-top:             10px;
}

input#subscribe
{
    width: auto;
}

.comment .body .content
{
    padding:                0px 3px 0px 3px;
    /*width:                     100%;    */
    overflow:                 auto; 
}

.comment .title abbr
{
    border: none;
}

.collapsed .body, .collapsed .comment
{
    display:                none;
}
 
#commentform textarea {
    width: 97%;
}

<?php if( btc_has_avatars() ) { ?>
.btc_gravatar {
    float: right;
    margin: 3px 3px 4px 4px;
}
<? ?>
</style>
<?php
}

function 
btc_has_avatars()
{

    if( 
function_exists('get_avatar')) 
        return 
true;
    else if(
function_exists('MyAvatars'))
        return 
true;
    return 
false;
}

function 
btc_avatar()
{

    if( 
function_exists('get_avatar')) 
    {
        echo 
get_avatar(get_comment_author_email(), '64'); 
        return;
    }
    else if(
function_exists('MyAvatars')) 
    { 
        
MyAvatars();
        return;
    }
}

function 
btc_add_reply_id($id)
{
    global 
$tablecomments$wpdb;    
    
$reply_id mysql_escape_string($_REQUEST['comment_reply_ID']);
    
$q $wpdb->query("UPDATE $tablecomments SET comment_parent='$reply_id' WHERE comment_ID='$id'");
}

function 
btc_add_options()
{
    
add_options_page("Threaded Comments""Threaded Comments"7__FILE__'btc_options_page');
    
}

function 
btc_add_reply_id_formfield()
{
    print 
"<input type='hidden' id='comment_reply_ID' name='comment_reply_ID' value='0' />";
}

add_action('wp_head','briansthreadedcomments');
add_action('comment_post','btc_add_reply_id');
add_action('admin_menu''btc_add_options');
add_action('comment_form''btc_add_reply_id_formfield');
?>
__________________
Read this if you are new. | PageRank only applies to Web PAGES!
Selling My Forums.
A Program to help you choose a Programming Language!

jamestl2 is online now
Reply With Quote
View Public Profile Visit jamestl2's homepage!
 
When You Register, These Ads Go Away!
Old 04-29-2008, 10:00 PM Re: A new Threaded Wordpress Comments Plugin
jamestl2's Avatar
Mmmm.......... Reindeer

Latest Blog Post:
Recent Comments Page
Posts: 2,195
Name: <member type="brilliant" alt="foolish">James Lewitzke</member>
Location: / public_html / Universe / Virgo_Supercluster / Local_Group / Milky_Way / Orion_Arm / Solar_System / Earth / North_America / USA / Wisconsin
(I had to write this extra post because there were too many characters with all that plugin code)

And here's the extra comments.php page it provided:

PHP Code:
<?php

/**
 * This is a modified version of wp-commments that comes with the Brian's Threaded Comments plugin.
 * Version: See briansthreadedcomments.php
 * Author: Brian Meidell
 * Author URI: http://meidell.dk/
 */ 

if ('wp-comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
    die (
'Please do not load this page directly. Thanks!');

include(
ABSPATH WPINC "/version.php");

$is_new = (isset($wp_version) && $wp_version '1.2');

if ((
$is_new) or ($withcomments) or ($single)) {
        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><?php _e("Enter your password to view comments."); ?><p>
<?php
                
return;
            }
        }

         
$comment_author = (isset($_COOKIE['comment_author_'.$cookiehash])) ? trim($_COOKIE['comment_author_'.$cookiehash]) : '';
        
$comment_author_email = (isset($_COOKIE['comment_author_email_'.$cookiehash])) ? trim($_COOKIE['comment_author_email_'.$cookiehash]) : '';
         
$comment_author_url = (isset($_COOKIE['comment_author_url_'.$cookiehash])) ? trim($_COOKIE['comment_author_url_'.$cookiehash]) : '';

        if(!
$tablecomments && $wpdb->comments// this makes it work in both 1.2 and 1.3
            
$tablecomments $wpdb->comments;
            
$comments $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = '$id' AND comment_approved = '1' ORDER BY comment_date");
?>

<!-- You can start editing here. -->

<p><?php comments_rss_link(__('<abbr title="Really Simple Syndication">RSS</abbr> feed')); ?> 
<?php if ('open' == $post->ping_status) { ?>
| <a href="<?php trackback_url()?>">Trackback <acronym title=\"Uniform Resource Identifier\">URI</acronym></a>
<?php ?>
</p>

<?php
$GLOBALS
['threaded_comments'] = array();

function 
write_comment(&$c$deepest_id = -1) {
    global 
$btc_cutoff_level$post;
    
$threaded_comments $GLOBALS['threaded_comments'];
    
$odd = ($GLOBALS['__writeCommentDepth']%2" odd" "");
?>
            <div  id="div-comment-<?php echo $c->comment_ID ?>" class='comment<?php echo $odd?>'>
<?php    if (btc_has_avatars()) {   // Gravatar support ?>
<div class='btc_gravatar gravatar'>
    <?php btc_avatar(); ?>
   <div style="clear: both;"></div>
</div>
<?php // End Gravatar support ?>
                <a name='comment-<?php echo $c->comment_ID ?>' id='comment-<?php echo $c->comment_ID ?>'></a>
                <div class="title">
                    <img class="collapseicon" src="<?php echo get_settings('siteurl'); ?>/wp-content/plugins/briansthreadedcomments.php?image=spacer.png" onclick='collapseThread("div-comment-<?php echo $c->comment_ID ?>")' />
                    <cite><?php comment_type(); ?> <?php _e('by'); ?> <?php comment_author_link() ?><a href="#comment-<?php echo $c->comment_ID ?>"></a></cite> 
                    <?php 
                        
if(function_exists('comment_subscription_status')) { 
                            if (
comment_subscription_status()) { 
                                echo 
"<img alt='Subscribed to comments via email' src='".get_settings('siteurl') ."/wp-content/plugins/briansthreadedcomments.php?image=subscribed.png' />"
                            } 
                        }
                    
?>
                    <?php edit_comment_link(__("Edit This"), ' |'); ?>                
                </div>
                <div class='body'>
                    <div class='meta'>
                        <?php echo $c->comment_date ?> <?php echo $c->comment_time ?>                        
                    </div>                    
                    <div class='content'>
                        <?php comment_text() ?><?php 
                        
if(preg_match('|<Pingback />|'$c->comment_content)) {
                            echo 
"<small>Read the rest at ";
                            echo 
comment_author_link();
                            echo 
"</small>";
                        }
                        
?>
                    </div>
<?php if($GLOBALS['__writeCommentDepth'] < $btc_cutoff_level) { ?>
                    <div class='reply'>
                        <?php if( $post->comment_status == 'open' ) { ?>
                        <?php global $user_ID; if ( get_option("comment_registration") && !$user_ID ) echo '<a href="'.
                        
get_option('siteurl') . 
                        
'/wp-login.php?redirect_to=' get_permalink() .
                        
'">Log in to Reply</a>'; else { ?> 
                        <a href='#' onclick='moveAddCommentBelow("div-comment-<?php echo $c->comment_ID ?>", <?php echo $c->comment_ID ?>, true); return false;'>Reply to this comment</a>
                        <?php ?>
                        <?php ?>
                    </div>
<?php } else if($GLOBALS['__writeCommentDepth'] == $btc_cutoff_level) { 
?>
                <small>(Comments wont nest below this level)</small>
<?php ?>
                </div>
<?php
        
if($threaded_comments[$c->comment_ID]) {
            
$id $c->comment_ID;
            foreach(
$threaded_comments[$id] as $c) {
                
$GLOBALS['__writeCommentDepth']++;
                if(
$GLOBALS['__writeCommentDepth'] == $btc_cutoff_level)
                    
write_comment($c$c->comment_ID);
                else
                    
write_comment($c$deepest_id);
                
$GLOBALS['__writeCommentDepth']--;
            }
        }
?>
<?php 
if($GLOBALS['__writeCommentDepth'] == $btc_cutoff_level ) { ?>

<?php if( $post->comment_status == 'open' ) { ?>
                    <div class='reply'>
                        <?php global $user_ID; if ( get_option("comment_registration") && !$user_ID ) echo '<a href="'.
                        
get_option('siteurl') . 
                        
'/wp-login.php?redirect_to=' get_permalink() .
                        
'">Log in to Reply</a>'; else { ?> 
                        <a href='#' onclick='moveAddCommentBelow("div-comment-<?php echo $deepest_id ?>", <?php echo $deepest_id ?>, false); return false;'>Reply here</a>
                        <?php ?>
                    </div>
    <?php ?>
<?php 
?>                    

            </div>
            <!-- This has to be here because of Internet Explorers plethora of layout bugs -->
            <div style="height: 1px; overflow: hidden;">&nbsp;</div>
<?php
    
}// end function
?>
<h2 id="comments"><?php comments_number(__("Comments"), __("1 Comment"), __("% Comments")); ?> 
<?php if ('open' == $post->comment_status) { ?>
<a href="#postcomment" title="<?php _e("Leave a comment"); ?>">&raquo;</a>
<?php ?>
</h2>
<div class="#commentlist">
<?php if ( $comments ) : 
    foreach(
$comments as $c)
    {
        
$GLOBALS['threaded_comments'][$c->comment_parent][] = $c;
    }
    
$GLOBALS['__writeCommentDepth'] = 0;
    if( 
is_array($GLOBALS['threaded_comments'][0]) ) {
        foreach(
$GLOBALS['threaded_comments'][0] as $comment) {
            if ( 
get_comment_type() == "comment" ) {
            
$GLOBALS['comment'] = &$comment;
            
write_comment($GLOBALS['comment']);
            }
        }
    }
?>
<?php 
else : ?>
    <p><?php _e('No comments yet.'); ?></p>
<?php endif; ?>
</div>
<?php if ('open' == $post->comment_status) : ?>
<?php
 
// this line is WordPress' motor, do not delete it.
$comment_author = (isset($_COOKIE['comment_author_' COOKIEHASH])) ? trim($_COOKIE['comment_author_'COOKIEHASH]) : '';
$comment_author_email = (isset($_COOKIE['comment_author_email_'COOKIEHASH])) ? trim($_COOKIE['comment_author_email_'COOKIEHASH]) : '';
$comment_author_url = (isset($_COOKIE['comment_author_url_'COOKIEHASH])) ? trim($_COOKIE['comment_author_url_'COOKIEHASH]) : '';

?>
<div id="addcomment" class="comment">
<a id="addcommentanchor" name="addcommentanchor"></a>
<form action="<?php echo get_settings('siteurl'); ?>/<?php echo get_option('btc_customtarget'); ?>" method="post" id="commentform">
<div class="add">
    <div id="reroot" style="display: none;">
        <small><a href="#" onclick="reRoot(); return false;">
            Click here to cancel "reply".
        </a></small>
    </div>
<?php if ( $user_ID ) : ?>
<p>Logged in as <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">Logout &raquo;</a></p>
<?php else : ?>
    <small>
        <?php _e('Name'); ?> <?php if ($req_e('(required)'); ?>
    </small>
    <div>
        <input type="text" name="author" id="author" class="textarea" value="<?php echo $comment_author?>" size="28" tabindex="1" />
    </div>
    <small>
        <?php _e('E-mail'); ?> <?php if ($req_e('(required - never shown publicly)'); ?>
    </small>
    <div>
        <input type="text" name="email" id="email" value="<?php echo $comment_author_email?>" size="28" tabindex="2" />
    </div>
    <small>
        <?php _e('<acronym title="Uniform Resource Identifier">URI</acronym>'); ?>
    </small>
    <div>
        <input type="text" name="url" id="url" value="<?php echo $comment_author_url?>" size="28" tabindex="3" />    
    </div>
    <?php 
/****** Math Comment Spam Protection Plugin ******/
if ( function_exists('math_comment_spam_protection') ) { 
    
$mcsp_info math_comment_spam_protection();
?>     <p><input type="text" name="mcspvalue" id="mcspvalue" value="" size="22" tabindex="4" />
    <label for="mcspvalue"><small>Spam protection: Sum of <?php echo $mcsp_info['operand1'] . ' + ' $mcsp_info['operand2'] . ' ?' ?></small></label>
    <input type="hidden" name="mcspinfo" value="<?php echo $mcsp_info['result']; ?>" />
</p>
<?php // if function_exists... ?>
<?php 
endif; ?>
<?php 
if(function_exists('comment_subscription_status')) { ?>
    <div>
        <input type="checkbox" name="subscribe" id="subscribe" value="subscribe" />
        <small>Subscribe to comments via email</small>
    </div>        
<?php } else if( function_exists('show_subscription_checkbox')) { 
    
show_subscription_checkbox(); 
?>
    <small>
        <?php _e('Your Comment'); ?> (<a href="#" onclick="changeCommentSize(-80); return false;">smaller size</a> | <a href="#" onclick="changeCommentSize(80); return false;">larger size</a>)
    </small>
    <div style="width: 100%;">
        <textarea name="comment" id="comment" cols="60" rows="14" tabindex="4"></textarea>
    </div>
    <small>
        You may use 
        <?php echo allowed_tags();?>
        in your comment.
    </small>
    <div>
        <input type="hidden" name="comment_post_ID" value="<?php echo $post->ID?>" />
        <input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?>" />
        <input onclick="if(typeof(onAddComment) == 'function') { onAddComment(); } else { alert('ERROR:\nIt looks like the website administrator hasn\'t activated the Brians Threaded Comments plugin from the plugin page'); };" name="addcommentbutton" type="button" id="addcommentbutton" value="Add comment" tabindex="5" />
    </div>
</div>
<?php do_action('comment_form'$post->ID); ?>
</form>
</div>
<?php if( get_option('btc_separate_trackbacks') ) { ?>
<h3>Trackback responses to this post</h3>
  <ul>
  <?php foreach ($comments as $comment) : ?>
  <?php $comment_type get_comment_type(); ?>
  <?php if($comment_type != 'comment') { ?>
  <li><?php comment_author_link() ?></li>
  <?php ?>
  <?php endforeach; ?>
</ul>
<? // end separate trackbacks ?>
<?php 
else : // Comments are closed ?>
<p><?php _e('Sorry, the comment form is closed at this time.'); ?></p>
<?php endif; ?>
<?php 
?>
I figured I'd just remove the stylesheet from the first code block or something, then somehow have it read my current WP theme's stylesheet.

Just take a look at vangogh's current blog comment system to see what I mean.
__________________
Read this if you are new. | PageRank only applies to Web PAGES!
Selling My Forums.
A Program to help you choose a Programming Language!

jamestl2 is online now
Reply With Quote
View Public Profile Visit jamestl2's homepage!
 
Old 04-29-2008, 10:21 PM Re: A new Threaded Wordpress Comments Plugin
vangogh's Avatar
Post Impressionist

Posts: 9,465
Name: Steven Bradley
Location: Boulder, Colorado
James I'll have to go through my files to see what changes I made. I know I restyled it a lot. If you look at Shoemoney's blog I think he has the plugin set mostly to the default.

I didn't remove the css. I moved both the css and javascript to external files so they wouldn't have to load on every page view. Then I restyled the css and maybe added one or two styles. I don't think I modified comments.php but I am using the new one created by btc. It adds some code you need to make it work.

I'm also using an older version of the plugin. I think the new one has the gravatars/mybloglog images built in. I'm using another plugin to include those.

If I remember it did take me a few nights to get it working the way I wanted. It wasn't a quick fix.
__________________
l Search Engine Friendly Web Design | Van SEO Design
l Tips On Marketing, SEO, Design, and Development | TheVanBlog
l Custom WordPress Themes
| Small Business Forum
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 04-29-2008, 10:32 PM Re: A new Threaded Wordpress Comments Plugin
jamestl2's Avatar
Mmmm.......... Reindeer

Latest Blog Post:
Recent Comments Page
Posts: 2,195
Name: <member type="brilliant" alt="foolish">James Lewitzke</member>
Location: / public_html / Universe / Virgo_Supercluster / Local_Group / Milky_Way / Orion_Arm / Solar_System / Earth / North_America / USA / Wisconsin
Thanks Steve,

Actually, I think my comments would look better without those gravatars in each comment (which would've required even more hacking).

Plus, I was thinking about trying to find out just what was wrong with the plugin when I try to update the options (as I describe here). It wouldn't let me change the settings, whether it's a plugin compatibility issue or something I did as I was altering the CSS (That's all I did).

This was an entirely new error altogether, the actual plugin was giving me even more errors that I couldn't solve which had nothing to do with the style, so I deactivated the plugin in the time being.

It was seeming like more trouble than it was worth.
__________________
Read this if you are new. | PageRank only applies to Web PAGES!
Selling My Forums.
A Program to help you choose a Programming Language!

jamestl2 is online now
Reply With Quote
View Public Profile Visit jamestl2's homepage!
 
Old 04-30-2008, 10:03 PM Re: A new Threaded Wordpress Comments Plugin
vangogh's Avatar
Post Impressionist

Posts: 9,465
Name: Steven Bradley
Location: Boulder, Colorado
I had that same problem too. When I went to change the threshold it gave me an error that it couldn't. I think it's a WP 2.5 incompatibility since it worked in the past.

I manually edited the file to increase the level of nested comments. Look in briansthreadedcomments.php On line 116 of the file or close to that look for this line of code

PHP Code:
$btc_cutoff_level get_option("btc_nestinglevels")-1
Just replace get_option("btc_nestinglevels")-1 with the number of levels you want to nest in the replies. I went with 5.

If you want to change the shrinkby % it's the line above and you can change it the same way.

I'm not sure where the gravatars are located since I have a prior version. I did download the latest version and if you can wait till the weekend I'll take a look through and find out what to remove so the gravatars are inactive.
__________________
l Search Engine Friendly Web Design | Van SEO Design
l Tips On Marketing, SEO, Design, and Development | TheVanBlog
l Custom WordPress Themes
| Small Business Forum

Last edited by vangogh : 04-30-2008 at 10:04 PM.
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 04-30-2008, 10:22 PM Re: A new Threaded Wordpress Comments Plugin
jamestl2's Avatar
Mmmm.......... Reindeer

Latest Blog Post:
Recent Comments Page
Posts: 2,195
Name: <member type="brilliant" alt="foolish">James Lewitzke</member>
Location: / public_html / Universe / Virgo_Supercluster / Local_Group / Milky_Way / Orion_Arm / Solar_System / Earth / North_America / USA / Wisconsin
Quote:
Originally Posted by vangogh View Post
I had that same problem too. When I went to change the threshold it gave me an error that it couldn't. I think it's a WP 2.5 incompatibility since it worked in the past.
The odd part about that thought was when I first installed the plugin correctly, I was able to update it. Then after a few hours, it stopped working again, so I have no idea why it wouldn't let me edit via that admin section.

Luckily though we can describe what we want by editing the code manually, as you describe below.

Quote:
Originally Posted by vangogh View Post
I manually edited the file to increase the level of nested comments. Look in briansthreadedcomments.php On line 116 of the file or close to that look for this line of code

PHP Code:
$btc_cutoff_level get_option("btc_nestinglevels")-1
Just replace get_option("btc_nestinglevels")-1 with the number of levels you want to nest in the replies. I went with 5.
That sounds easy enough, I guess I'll choose that number when I decide just how deep I'll want it to go, since I edited my theme to be more fluid than most.

Quote:
Originally Posted by vangogh View Post
If you want to change the shrinkby % it's the line above and you can change it the same way.
Honestly right now off the top of my head, I don't remember what that does.

Quote:
Originally Posted by vangogh View Post
I'm not sure where the gravatars are located since I have a prior version.
I think those were around line 53 or so of comments.php (It mentioned gravatar support there)

Quote:
Originally Posted by vangogh View Post
I did download the latest version and if you can wait till the weekend I'll take a look through and find out what to remove so the gravatars are inactive.
That'll be fine

I have actually a lot of make up work to do since my college semester is coming to an end, so I won't have much time to help with the plugin editing very much anyway this week.
__________________
Read this if you are new. | PageRank only applies to Web PAGES!
Selling My Forums.
A Program to help you choose a Programming Language!

jamestl2 is online now
Reply With Quote
View Public Profile Visit jamestl2's homepage!
 
Old 04-30-2008, 11:23 PM Re: A new Threaded Wordpress Comments Plugin
vangogh's Avatar
Post Impressionist

Posts: 9,465
Name: Steven Bradley
Location: Boulder, Colorado
I'm not sure why it stopped working for me either. I'm assuming it was the upgrade, but maybe not. I had thought it might be file permissions so I tried temporarily setting all the plugin files to be writable and it still didn't work.

The shrinkby is to reduce the size of the nested content a little bit. I'm not shrinking it at all. When I've tried I didn't care much for it.

I'll take a look at the newest version of the plugin over the weekend and let you know how to turn off the gravatars. My guess is all you need to do is comment out the few lines of code that's displaying the html/css to display the gravatars.
__________________
l Search Engine Friendly Web Design | Van SEO Design
l Tips On Marketing, SEO, Design, and Development | TheVanBlog
l Custom WordPress Themes
| Small Business Forum
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 05-01-2008, 08:37 AM Re: A new Threaded Wordpress Comments Plugin
davidshaw's Avatar
Ultra Talker

Posts: 375
Name: David Shaw
The only work I have done with Brian's Threaded Comments is to remove the trackbacks and display them separately.

Tutorial here
__________________
Website Design Bristol
davidshaw is offline
Reply With Quote
View Public Profile Visit davidshaw's homepage!
 
Old 05-01-2008, 04:40 PM Re: A new Threaded Wordpress Comments Plugin
vangogh's Avatar
Post Impressionist

Posts: 9,465
Name: Steven Bradley
Location: Boulder, Colorado
I separated the two as well. It makes it so much easier to read through the comments when the trackbacks are all in one place.
__________________
l Search Engine Friendly Web Design | Van SEO Design
l Tips On Marketing, SEO, Design, and Development | TheVanBlog
l Custom WordPress Themes
| Small Business Forum
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 05-01-2008, 05:39 PM Re: A new Threaded Wordpress Comments Plugin
jamestl2's Avatar
Mmmm.......... Reindeer

Latest Blog Post:
Recent Comments Page
Posts: 2,195
Name: <member type="brilliant" alt="foolish">James Lewitzke</member>
Location: / public_html / Universe / Virgo_Supercluster / Local_Group / Milky_Way / Orion_Arm / Solar_System / Earth / North_America / USA / Wisconsin
The latest version of the plugin already does that .
__________________
Read this if you are new. | PageRank only applies to Web PAGES!
Selling My Forums.
A Program to help you choose a Programming Language!

jamestl2 is online now
Reply With Quote
View Public Profile Visit jamestl2's homepage!
 
Old 05-01-2008, 06:04 PM Re: A new Threaded Wordpress Comments Plugin
vangogh's Avatar
Post Impressionist

Posts: 9,465
Name: Steven Bradley
Location: Boulder, Colorado
I think I should have waited for the latest version. Sounds like half the work I did is now in there by default.
__________________
l Search Engine Friendly Web Design | Van SEO Design
l Tips On Marketing, SEO, Design, and Development | TheVanBlog
l Custom WordPress Themes
| Small Business Forum
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 05-02-2008, 04:15 AM Re: A new Threaded Wordpress Comments Plugin
Novice Talker

Posts: 14
I had that same problem too
king0910 is offline
Reply With Quote
View Public Profile
 
Old 05-06-2008, 12:20 AM Re: A new Threaded Wordpress Comments Plugin
jamestl2's Avatar
Mmmm.......... Reindeer

Latest Blog Post:
Recent Comments Page
Posts: 2,195
Name: <member type="brilliant" alt="foolish">James Lewitzke</member>
Location: / public_html / Universe / Virgo_Supercluster / Local_Group / Milky_Way / Orion_Arm / Solar_System / Earth / North_America / USA / Wisconsin
Just wanted to bump this to see how far progress is .
__________________
Read this if you are new. | PageRank only applies to Web PAGES!
Selling My Forums.
A Program to help you choose a Programming Language!

jamestl2 is online now
Reply With Quote
View Public Profile Visit jamestl2's homepage!
 
Old 05-06-2008, 04:33 PM Re: A new Threaded Wordpress Comments Plugin
vangogh's Avatar
Post Impressionist

Posts: 9,465
Name: Steven Bradley
Location: Boulder, Colorado
Sorry James. For some reason I got it in my head that you weren't going to use BTC. I'm not sure why. I scanned through your posts above and don't see where you indicate that. My bad.

I'll take a look as soon as I can and let you know what I find for removing the gravatars.
__________________
l Search Engine Friendly Web Design | Van SEO Design
l Tips On Marketing, SEO, Design, and Development | TheVanBlog
l Custom WordPress Themes
| Small Business Forum
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 05-07-2008, 02:08 PM Re: A new Threaded Wordpress Comments Plugin
jamestl2's Avatar
Mmmm.......... Reindeer

Latest Blog Post:
Recent Comments Page
Posts: 2,195
Name: <member type="brilliant" alt="foolish">James Lewitzke</member>
Location: / public_html / Universe / Virgo_Supercluster / Local_Group / Milky_Way / Orion_Arm / Solar_System / Earth / North_America / USA / Wisconsin
Alright, sounds good Steve

Also, were you planning on making this as an entirely new plugin? Or will you just advise us on where to change the code (aka the specific color scheme, removing gravatars, etc.)?
__________________
Read this if you are new. | PageRank only applies to Web PAGES!
Selling My Forums.
A Program to help you choose a Programming Language!

jamestl2 is online now
Reply With Quote
View Public Profile Visit jamestl2's homepage!
 
Old 05-07-2008, 06:38 PM Re: A new Threaded Wordpress Comments Plugin
vangogh's Avatar
Post Impressionist

Posts: 9,465
Name: Steven Bradley
Location: Boulder, Colorado
I wasn't going to create a new plugin. Maybe one day as it's something I'd like to do, but for now I was just going to let you know how to remove the avatars.

Was that all you needed right now or were there other things wanted to change?
__________________
l Search Engine Friendly Web Design | Van SEO Design
l Tips On Marketing, SEO, Design, and Development | TheVanBlog
l Custom WordPress Themes
| Small Business Forum
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 05-07-2008, 09:13 PM Re: A new Threaded Wordpress Comments Plugin
jamestl2's Avatar
Mmmm.......... Reindeer

Latest Blog Post:
Recent Comments Page
Posts: 2,195
Name: <member type="brilliant" alt="foolish">James Lewitzke</member>
Location: / public_html / Universe / Virgo_Supercluster / Local_Group / Milky_Way / Orion_Arm / Solar_System / Earth / North_America / USA / Wisconsin
Actually, the main thing I wanted was changing the colors to match my blog's current comment color scheme, I wasn't able to adjust those very well.
__________________
Read this if you are new. | PageRank only applies to Web PAGES!
Selling My Forums.
A Program to help you choose a Programming Language!

jamestl2 is online now
Reply With Quote
View Public Profile Visit jamestl2's homepage!
 
Old 05-08-2008, 06:04 PM Re: A new Threaded Wordpress Comments Plugin
vangogh's Avatar
Post Impressionist

Posts: 9,465
Name: Steven Bradley
Location: Boulder, Colorado
Sounds good. I'll look into the colors and the gravatars. Mind sending me a quick email to remind me?
__________________
l Search Engine Friendly Web Design | Van SEO Design
l Tips On Marketing, SEO, Design, and Development | TheVanBlog
l Custom WordPress Themes
| Small Business Forum
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 05-08-2008, 07:03 PM Re: A new Threaded Wordpress Comments Plugin
jamestl2's Avatar
Mmmm.......... Reindeer

Latest Blog Post:
Recent Comments Page
Posts: 2,195
Name: <member type="brilliant" alt="foolish">James Lewitzke</member>
Location: / public_html / Universe / Virgo_Supercluster / Local_Group / Milky_Way / Orion_Arm / Solar_System / Earth / North_America / USA / Wisconsin
Just sent you the email.

Unfortunately, I just realized I sent it to you without a title , so that's the one.
__________________
Read this if you are new. | PageRank only applies to Web PAGES!
Selling My Forums.
A Program to help you choose a Programming Language!

jamestl2 is online now
Reply With Quote
View Public Profile Visit jamestl2's homepage!
 
Old 05-08-2008, 07:28 PM Re: A new Threaded Wordpress Comments Plugin
vangogh's Avatar
Post Impressionist

Posts: 9,465
Name: Steven Bradley
Location: Boulder, Colorado
No subject line, no response from me

I'll take a look, probably over the weekend. You're using the latest version of the plugin, right?
__________________
l Search Engine Friendly Web Design | Van SEO Design
l Tips On Marketing, SEO, Design, and Development | TheVanBlog
l Custom WordPress Themes
| Small Business Forum
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Reply     « Reply to A new Threaded Wordpress Comments Plugin

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.26159 seconds with 12 queries