I am not talking about threaded comments, thats way too messy. I was wondering if it would be easy to create a 'reply with quote' functionality as is seen on most forums.
Jinu Johnson
http://injinuity.blogspot.com
I am not talking about threaded comments, thats way too messy. I was wondering if it would be easy to create a 'reply with quote' functionality as is seen on most forums.
Jinu Johnson
http://injinuity.blogspot.com
Define "easy."
A quick and dirty php way of working this -- could probably do something with javascript, but for that I'd have to do some looking up -- add the following code block into the comment form textarea tag (<textarea> <em>here</em> </textarea>) of the comments.php template for your theme:
<?php
if(isset($_GET['reply-quote'])) :
$reply_quote = $_GET['reply-quote'];
$quote_comment = $wpdb->get_row("SELECT comment_author, comment_content FROM $wpdb->comments WHERE comment_ID = $reply_quote LIMIT 1");
echo "<blockquote>\n<cite>" .
$quote_comment->comment_author .
" said:</cite>\n" .
apply_filters('get_comment_text', $quote_comment->comment_content) .
"\n</blockquote>\n\n";
endif;
?>
And in an appropriate place in the comment loop, if you use default permalinks (/?p=#) on your blog, add this:
<a href="?<?php echo $_SERVER['QUERY_STRING']; ?>&reply-quote=<?php comment_ID() ?>#postcomment">quote in comment</a>
If you use custom permalinks, go with:
<a href="?reply-quote=<?php comment_ID() ?>#postcomment">quote in comment</a>
Hey thanks for the tip my friend.. I shall try and let you know how successful I was...
Kafkaesqui,
Absolutely brilliant my friend. I am implementing it, and its 80% perfect, the only thing is to have the text quoted inside the textarea input box...
http://www.arrogantly.com/2005/03/24/helloing-again/?reply-quote=8#postcomment
it works.. it works.. it works.. I had just placed the code, on the wrong line... now its perfect.. I just have to get the mouse focus corrected thats all.. else works perfectly.
THIS IS SOOOO MUCH EASIER THAN THE THREADED THING...lol
This topic has been closed to new replies.