Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-03-09 23:54:20

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

[plugin] [ORPHAN] ajw_if_comment_owner

Summary

Conditional output based on comparing the name of the commenter with either a) the real name of article author or b) with a user-specified name (or comma-separated list of names). You could specify lists of known people and output a class of “friend” or “owner” or “whatever” based on their name. Intended usage is from within default comment form.

Download latest version: ajw_if_comment_owner (v0.3.1)

-Read the Documentation {Offline. See plugin’s help text. – Uli}

Requires:

  • 1.0RC3 (rev180 or greater)
  • If you are using Textpattern 1.0RC3 rev142 thru rev179, you will need to perform a one-line edit of <code>/textpattern/publish/comment.php</code>, as outlined in this Textpattern Forum thread (allows for plugin parsing in comments)

Attributes

name (optional)
- name="Dean Allen,andrew,Mr.T"

email
- email="foo@example.com"

web
- web="example.com"

strict
- Setting this attribute to “1” will force all to match

<else />
- Allows to specify output for “all other cases”

Examples

Ideally, this is meant to be used in your default comment form. While it is possible to use this plugin with the default &lt;ol&gt; formatting of comments, you’ll be able to do much more fun things if you switch off numbered list formatting in admin-&gt;preferences.

  • name="foo"
    • Anyone named “foo”
  • name="foo,bar" email="foo@domain.com"
    • (foo OR bar) OR (foo@domain.com)
  • name="foo,bar" email="foo@domain.com" strict="1"
    • (foo OR bar) AND (foo@domain.com)
  • name="foo" email="foo@domain.com" web="domain.com" strict="1"
    • (foo) AND (foo@domain.com) AND (domain.com)
  • name="foo,bar" email="foo@domain.com" web="domain.com" strict="1"
    • (foo OR bar) AND (foo@domain.com) AND (domain.com)

Revision History

v0.3

  • Added ability to use <else /> clause

v0.2

  • Allows for loose or strict checks against multiple fields

{Edited download address. – Uli}

Last edited by uli (2012-03-26 22:08:25)

Offline

#2 2005-03-24 21:22:08

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: [plugin] [ORPHAN] ajw_if_comment_owner

big update! -> v0.2

Offline

#3 2005-05-04 16:22:54

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: [plugin] [ORPHAN] ajw_if_comment_owner

update! -> 0.3

Offline

#4 2005-05-18 17:14:40

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: [plugin] [ORPHAN] ajw_if_comment_owner

Just received email from Cody Lindley ::

I’m not really sure why, but when I try and use this tag it breaks my comments. Can you give an actual example of how the commet form would look… It seems unless I use the else part the tag breaks my comments on the first comment that is an author comment.

I’ll investigate this later today.

Offline

#5 2005-05-18 17:16:10

codylindley
Member
From: Boise, Idaho
Registered: 2004-06-09
Posts: 29
Website

Re: [plugin] [ORPHAN] ajw_if_comment_owner

Also, when I do use the else tag my comments work but the if statements do not.


codylindley.com

Offline

#6 2005-05-18 17:22:50

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: [plugin] [ORPHAN] ajw_if_comment_owner

Can you provide your example usage?

Offline

#7 2005-05-18 17:30:57

codylindley
Member
From: Boise, Idaho
Registered: 2004-06-09
Posts: 29
Website

Re: [plugin] [ORPHAN] ajw_if_comment_owner

<pre>
<code>
<div class=“cline”><span class=“cicon”><a href=”#addcomment” title=“Add Comment”></a></span><strong style=“color:#592C16;”>Comment</strong> Posted by&nbsp;<txp:comment_name />&nbsp;on&nbsp;<txp:comment_time />&nbsp;|
<txp:comment_permlink>Comment Link</txp:comment_permlink></div>
<div class=“commentm”><txp:message />
<div>

<txp:ajw_if_comment_owner name=“Cody Lindley” email=“contact@codylindley.com” web=“codylindley.com”>
YES!
<else />
NO!
</txp:if_comment_owner>
</pre>
</code>

Last edited by codylindley (2005-05-18 17:32:33)


codylindley.com

Offline

#8 2005-05-18 17:34:15

codylindley
Member
From: Boise, Idaho
Registered: 2004-06-09
Posts: 29
Website

Re: [plugin] [ORPHAN] ajw_if_comment_owner

Also if I do this:

<pre>
<code>
<txp:ajw_if_comment_owner name=“Cody Lindley” email=“contact@codylindley.com” web=“codylindley.com”>
YES!
</txp:if_comment_owner>
</pre>
</code>

The comments break at my first comment.


codylindley.com

Offline

#9 2005-05-18 18:30:59

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: [plugin] [ORPHAN] ajw_if_comment_owner

D’oh. I figured it out ;-)

</txp:if_comment_owner>

should be

</txp:ajw_if_comment_owner>

I’ll take the blame for that one; the example provided had the same error. My bad.

Offline

#10 2005-05-18 20:32:38

codylindley
Member
From: Boise, Idaho
Registered: 2004-06-09
Posts: 29
Website

Re: [plugin] [ORPHAN] ajw_if_comment_owner

bingo…thanks


codylindley.com

Offline

#11 2005-07-26 06:49:31

dressfordialogue
New Member
Registered: 2004-11-18
Posts: 8

Re: [plugin] [ORPHAN] ajw_if_comment_owner

I think I’m a tad slow. I can’t seem to figure out how exactly to incoporate this one.

Here’s my txp form for the output of comments:

<pre><code><div class=”<txp:ajw_comment_alt even=“foo” odd=“bar” />”><txp:glx_gravatar class=“gravatar” /><p><txp:message /></p>
<p><txp:comment_name /> &raquo; <txp:comment_time /></p></div></code></pre>

And the txp form for the input of comments:

<pre><code><p> <label>Name</label>
<txp:comment_name_input />
</p><p><a href=“http://www.gravatar.com” class=“gravlink” target=”_blank”>Gravatar Enabled</a> <label>Email</label> <txp:comment_email_input />
</p><p> <label> http://</label> <txp:comment_web_input />
</p><p><a href=“http://www.textpattern.com/help/?item=textile_comments” rel=“external” onclick=“window.open(this.href, ‘popupwindow’, ‘width=300,height=400,scrollbars,resizable’); return false;” class=“help”>Textpattern Help</a> <label>Comments</label> <txp:comment_message_input />
</p>
<p> <label>&nbsp;</label>
<txp:comment_preview /> <txp:comment_submit />
</p>
<p><label>Remember details?</label>
<input type=“checkbox” name=“remember” value=“1” checked=“checked” class=“prefs” /></p></code></pre>

Could someone please point out to me exactly where I would place the relevant code? I’d like to retain the odd, even styling but add an additional class for me.

Last edited by dressfordialogue (2005-07-26 06:52:05)

Offline

#12 2005-07-28 21:15:21

dressfordialogue
New Member
Registered: 2004-11-18
Posts: 8

Re: [plugin] [ORPHAN] ajw_if_comment_owner

Bumpy bumpity.

Offline

Board footer

Powered by FluxBB