Getting rid of comments, but leaving trackbacks

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
Brian1969
Regular
Posts: 78
Joined: Tue Mar 22, 2005 7:03 pm
Contact:

Getting rid of comments, but leaving trackbacks

Post by Brian1969 »

Hello,

I've been thinking of doing away with the comments area in my blog, but when I tried it using my settings (in the admin panel and within my posts), it also deletes trackbacks.

Is there a way to eliminate the comment feature without also removing the trackback link and feature, and if so, how?
Brian
mgroeninger
Regular
Posts: 546
Joined: Mon Dec 20, 2004 11:57 pm
Contact:

Post by mgroeninger »

Perhaps the easiest method to do something like this would be to edit the template you are using to simply not display comments (or the link to post a comment) and have it leave all the trackback info.

(I would actually recommend copying the template directory and then editing the info.txt to use a new name..)

I think entries.tpl controls the post display...

Personally, I would also set all comments to moderate in the spam protector plugin, since this method does not disable comments...
Brian1969
Regular
Posts: 78
Joined: Tue Mar 22, 2005 7:03 pm
Contact:

Post by Brian1969 »

Well, I tried that, and while it gets rid of the comment link (on the main page) it doesn't get rid of the comment box in the actual post. I'd like something that does both.

I know I can shut down comments, but I'd rather take them out altogether, so that people don't spend time composing a comment only to be told the comments have been disabled.

So I'm trying to find a way that just gets rid of them, yet keeps the trackback link and function within the blog.

Thanks.
Brian
mgroeninger
Regular
Posts: 546
Joined: Mon Dec 20, 2004 11:57 pm
Contact:

Post by mgroeninger »

To get rid of the comment form you could edit the file "commentform.tpl", I believe...
Brian1969
Regular
Posts: 78
Joined: Tue Mar 22, 2005 7:03 pm
Contact:

Post by Brian1969 »

Yes, but how? I don't know squat about PHP, and I'm afraid that if I tinker too much, my site is gonna come crashing down around me. lol
Brian
mgroeninger
Regular
Posts: 546
Joined: Mon Dec 20, 2004 11:57 pm
Contact:

Post by mgroeninger »

"tpl" files in serendipity are template files... They do not actual contain php code, but a derived presentation language. Template files are parsed into php code and stored for later (and recurring) use.

There isn't much you could do to (seriously) damage your install by playing with tempalte files... Especially if you have created a new theme like I suggested...

Anyways, it seems like commentform.tpl is entirely dedicated to displaying the comment form. You could just delete all of the text in it and leave it blank (I believe). I'm not a template expert though...

If you are concerned about messing up your install, just make a backup of the file you are going to make changes to. If the results are not good, replace the file you changed with the original.
Last edited by mgroeninger on Sat Apr 08, 2006 1:56 am, edited 1 time in total.
Ianardo
Regular
Posts: 114
Joined: Sun Nov 28, 2004 3:02 pm
Location: Hastings, U.K.
Contact:

Post by Ianardo »

Well, here's how I did it on the Jazz Cafe theme by just adding <!--- --->
around the bits I didn't want in the 'entries.tpl'

This is what it looks like: Click Here

I've done this a few times now on diffrent blogs and most entries.tpl are pretty similar...

Code: Select all

<!-- ENTRIES START -->
    {serendipity_hookPlugin hook="entries_header" addData="$entry_id"}

    {foreach from=$entries item="dategroup"}
        {foreach from=$dategroup.entries item="entry"}
        <div class="post">
            <h2 id="post-{$entry.id}"><a href="{$entry.link}">{$entry.title}</a></h2>
            {if !$is_single_entry}<div class="small">{$entry.timestamp|@formatTime:DATE_FORMAT_ENTRY}</div>{/if}

            {if $entry.categories}
            <span class="categoryIcon">
            {foreach from=$entry.categories item="category"}
                {if $category.category_icon}
                    <a href="{$category.category_link}"><img class="categoryIcon" title="{$category.category_name|@escape}{$category.category_description|@emptyPrefix}" alt="{$category.category_name|@escape}" src="{$category.category_icon}" /></a>
                {/if}
            {/foreach}
            </span>
            {/if}

            <div class="entrytext">
                <br /><p>
                {$entry.body}
                {if $is_single_entry}
                <a id="extended"></a>{$entry.extended}
                {/if}
                </p>

                {if $entry.has_extended and not $is_single_entry and not $entry.is_extended}
                <br /><a href="{$entry.link}#extended">{$CONST.VIEW_EXTENDED_ENTRY|@sprintf:$entry.title}</a><br /><br />
                {/if}

            <div class="postmetadata{if $is_single_entry} graybox{/if}">
                {if $is_single_entry}

				{$CONST.ENTRY_POSTED_BY} <a href="{$entry.link_author}">{$entry.author}</a> {$CONST.ON} {$entry.timestamp|@formatTime:DATE_FORMAT_ENTRY}<!---(TIMESTAMP) {$CONST.AT} {$entry.timestamp|@formatTime:"%H:%M"}.--->
                {if $entry.categories}
                   {$CONST.FILED_UNDER} {foreach from=$entry.categories item="category" name="categories"}<a href="{$category.category_link}">{$category.category_name|@escape}</a>{if not $smarty.foreach.categories.last}, {/if}{/foreach}.
                {/if}
                <!---(COMMENTS AND TRACKBACKS) 
                {if $entry.allow_comments}
                    {$CONST.LEAVE_RESPONSE|sprintf:'<a href="#serendipity_CommentForm">':'</a>':"<a href=\"$entry[link]\">":'</a>'}
                    {if $entry.moderate_comments}
                        {$CONST.SUBJECT_TO_MODERATION}
                    {/if}--->
                {else}
                    {$CONST.COMMENTS_CLOSED}
                {/if} 

                {else}
               <!---(POSTED BY) {$CONST.POSTED_BY} <a href="{$entry.link_author}">{$entry.author}</a> --->
                {if $entry.categories}
                <!---(IN)   {$CONST.IN} ---> Posted in {foreach from=$entry.categories item="category" name="categories"}<a href="{$category.category_link}">{$category.category_name|@escape}</a>{if not $smarty.foreach.categories.last}, {/if}{/foreach}
                {/if}

                {if $dategroup.is_sticky}
                    {$CONST.ON}
                {else}
                  <!---(AT)  {$CONST.AT} --->
                {/if} 
                
                <!---(TIME, COMMENTS, TRACKBACKS) <a href="{$entry.link}">{if $dategroup.is_sticky}{$entry.timestamp|@formatTime:DATE_FORMAT_ENTRY} {/if}{$entry.timestamp|@formatTime:'%H:%M'}</a>

                {if $entry.has_comments}
                    {if $use_popups}
                        | <a href="{$entry.link_popup_comments}" onclick="window.open(this.href, 'comments', 'width=480,height=480,scrollbars=yes'); return false;">{$entry.label_comments} ({$entry.comments})</a>
                    {else}
                        | <a href="{$entry.link}#comments">{$entry.label_comments} ({$entry.comments})</a>
                    {/if}
                {/if}

                {if $entry.has_trackbacks}
                    {if $use_popups}
                        | <a href="{$entry.link_popup_trackbacks}" onclick="window.open(this.href, 'comments', 'width=480,height=480,scrollbars=yes'); return false;">{$entry.label_trackbacks} ({$entry.trackbacks})</a>
                    {else}
                        | <a href="{$entry.link}#trackbacks">{$entry.label_trackbacks} ({$entry.trackbacks})</a>
                    {/if}
                {/if} --->

                {if $entry.is_entry_owner and not $is_preview}
                        | <a href="{$entry.link_edit}">{$CONST.EDIT_ENTRY}</a>
                {/if}
                {/if}
                {$entry.add_footer}
               </div>
            </div>
        </div> 
        <!---
        <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                 xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"
                 xmlns:dc="http://purl.org/dc/elements/1.1/">
        <rdf:Description
                 rdf:about="{$entry.link_rdf}"
                 trackback:ping="{$entry.link_trackback}"
                 dc:title="{$entry.title}"
                 dc:identifier="{$entry.rdf_ident}" />
        </rdf:RDF>
        --->
     <!---(TRACKBACKS)   {$entry.plugin_display_dat}

        {if $is_single_entry and not $use_popups and not $is_preview}
            {if $CONST.DATA_UNSUBSCRIBED}
                <br /><div class="serendipity_center serendipity_msg_notice">{$CONST.DATA_UNSUBSCRIBED|@sprintf:$CONST.UNSUBSCRIBE_OK}</div><br />
            {/if}

            {if $CONST.DATA_TRACKBACK_DELETED}
                <br /><div class="serendipity_center serendipity_msg_notice">{$CONST.DATA_TRACKBACK_DELETED|@sprintf:$CONST.TRACKBACK_DELETED}</div><br />
            {/if}

            {if $CONST.DATA_TRACKBACK_APPROVED}
                <br /><div class="serendipity_center serendipity_msg_notice">{$CONST.DATA_TRACKBACK_APPROVED|@sprintf:$CONST.TRACKBACK_APPROVED}</div><br />
            {/if}

            {if $CONST.DATA_COMMENT_DELETED}
                <br /><div class="serendipity_center serendipity_msg_notice">{$CONST.DATA_COMMENT_DELETED|@sprintf:$CONST.COMMENT_DELETED}</div><br />
            {/if}

            {if $CONST.DATA_COMMENT_APPROVED}
                <br /><div class="serendipity_center serendipity_msg_notice">{$CONST.DATA_COMMENT_APPROVED|@sprintf:$CONST.COMMENT_APPROVED}</div><br />
            {/if}
                <a id="trackbacks"></a><h3>{$CONST.TRACKBACKS}</h3>
                    <div class="serendipity_center">
                        <a style="font-weight: normal" href="{$entry.link_trackback}" onclick="alert('{$CONST.TRACKBACK_SPECIFIC_ON_CLICK|@escape:htmlall}'); return false;" title="{$CONST.TRACKBACK_SPECIFIC_ON_CLICK|@escape}">{$CONST.TRACKBACK_SPECIFIC}</a>
                    </div>
                    <ol class="commentlist">
                        {serendipity_printTrackbacks entry=$entry.id}
                    </ol>
        {/if} --->

    <!---(COMMENT FORM)
    
    			{if $is_single_entry and not $is_preview}
                <a id="comments"></a><h3>{$CONST.COMMENTS}</h3>
                <div class="serendipity_center">{$CONST.DISPLAY_COMMENTS_AS}
                {if $entry.viewmode eq $CONST.VIEWMODE_LINEAR}
                    ({$CONST.COMMENTS_VIEWMODE_LINEAR} | <a href="{$entry.link_viewmode_threaded}#comments">{$CONST.COMMENTS_VIEWMODE_THREADED}</a>)
                {else}
                    (<a href="{$entry.link_viewmode_linear}#comments">{$CONST.COMMENTS_VIEWMODE_LINEAR}</a> | {$CONST.COMMENTS_VIEWMODE_THREADED})
                {/if}
                </div>
                <br />
                <ol class="commentlist">
                    {serendipity_printComments entry=$entry.id mode=$entry.viewmode}
                </ol>

                {if $entry.is_entry_owner}
                    {if $entry.allow_comments}
                    <div class="serendipity_center">(<a href="{$entry.link_deny_comments}">{$CONST.COMMENTS_DISABLE}</a>)</div>
                    {else}
                    <div class="serendipity_center">(<a href="{$entry.link_allow_comments}">{$CONST.COMMENTS_ENABLE}</a>)</div>
                    {/if}
                {/if}
                <a id="feedback"></a>

                {foreach from=$comments_messagestack item="message"}
                <div class="serendipity_center serendipity_msg_important">{$message}</div>
                {/foreach}

                {if $is_comment_added}

                <br />
                <div class="serendipity_center serendipity_msg_notice">{$CONST.COMMENT_ADDED}</div>

                {elseif $is_comment_moderate}

                <br />
                <div class="serendipity_center serendipity_msg_notice">{$CONST.COMMENT_ADDED}<br />{$CONST.THIS_COMMENT_NEEDS_REVIEW}</div>

                {else}

                <br />
                <h3>{$CONST.ADD_COMMENT}</h3>
                {$COMMENTFORM}

                {/if}
        {/if} --->

        {$entry.backend_preview}
        {/foreach}
    {foreachelse}
    {if not $plugin_clean_page}
        {$CONST.NO_ENTRIES_TO_PRINT}
    {/if}
    {/foreach}

    <div class="serendipity_pageFooter" style="text-align: center">


    {if $footer_prev_page}
        <a href="{$footer_prev_page}">« {$CONST.PREVIOUS_PAGE}</a>  
    {/if}

    {if $footer_info}
        ({$footer_info})
    {/if}

    {if $footer_next_page}
        <a href="{$footer_next_page}">» {$CONST.NEXT_PAGE}</a>
    {/if}

    {serendipity_hookPlugin hook="entries_footer"}
    </div>
<!-- ENTRIES END -->
I also chose to disable most of the message footer info too, but you can just choose the bits you want.

Oh, and I know absolutely nothing about PHP so I just use undo everytime I make an error and re-post! (I use a great, free text editor called 'Text Wrangler' for this.
Brian1969
Regular
Posts: 78
Joined: Tue Mar 22, 2005 7:03 pm
Contact:

Post by Brian1969 »

Matthew:

That worked fine. Thanks!

One more question, and it's not a big deal here....

How would I get rid of the text in the post area that says:
Comments
Display comments as (Linear | Threaded)

(Do not allow comments to this entry)

Add Comment
I know there's a file where this is configured, but I can't locate it. Any idea?
Brian
Brian1969
Regular
Posts: 78
Joined: Tue Mar 22, 2005 7:03 pm
Contact:

Post by Brian1969 »

Nevermind, I think I found it. =D
Brian
Post Reply