Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
[plugin] [ORPHAN] ako_random_comment
ako_random_comment
Display a random comment
This plugin is designed to allow you to display a random comment based on article ID number. This plugin was created at the request of Maniqui.
Right now it’s really limited in it’s ability (I just wanted to get it out there), so it only takes these three attributes:- id – the article ID from which to pull comments. (Note: it’s only taking one right now…)
- wraptag – tag to wrap the output with
- class – class attribute to add onto the wraptag.
I do plan on implementing some of the other features Maniqui requested (such as limits, allowing more than one article ID, output comments from a given section, and the use of article forms), but that might take a bit of time. I’m currently a bit more focused on the WP Visual.Syntax plugin port.
Also, I haven’t really tested this (just a tiny bit), so it should work, but if something goes wrong, please (a) don’t kill me, and (b) let me know so that I can fix it.
Download v0.1
More info (Not yet. Just check the sparse help file / ask here..)
Offline
Re: [plugin] [ORPHAN] ako_random_comment
Brilliant plug-in! What a wonderful idea! ;)
Ako, many thanks for taking my request!
I have tested it, and it works as expected. Very nice.
As you said, it’s quite simple right now, but thanks again for the starting kick.
Thinking in the future of the article and to have the ideas here (for reference), I quote my initial request:
Some ideas and desired attributes for the plug-in:
- to output a random comment from a given section (“section” attribute)
- to output a random comment from some specified articles ids. Example:
<txp:random_comment id="7,15,24" />
- would be nice if it could accept the use of article forms. This way, the output can be customized to include permanent links to the article, the title of the article, etc.
- also, a limit attribute, so you can have a list of random comments, for example, 3 random comments…
One possible use: random product reviews.
I think a useful implementation for this requested new plug-in could be in a site that sells products and where comments are more like “product reviews”.
So, you could have at the home page or at the section front-page a random comment (review) from one of the products.
would be nice if it could accept the use of article forms. This way, the output can be customized to include permanent links to the article, the title of the article, etc.
I add: also, it would be nice if it could accept the use of comments forms (i think that comments form are, in fact, article forms) to output data about the comment (author, website, comment date).
thanks again and again and again, Ako
Offline
Re: [plugin] [ORPHAN] ako_random_comment
I’m writing an updated version of this plugin that includes all of your enchancements.
Offline
Re: [plugin] [ORPHAN] ako_random_comment
Wow!
many thanks also to you, Manfre-kun.
Hope you have fun coding it!
And also hope to see you more often at forum!
Offline
Re: [plugin] [ORPHAN] ako_random_comment
maniqui wrote:
Wow!
many thanks also to you, Manfre-kun.
Hope you have fun coding it!
And also hope to see you more often at forum!
I read the forum in cycles that equate to how bored and unmotivated I am with my day job. The higher up on that scale, the more likely I am to code for fun.
Offline
Re: [plugin] [ORPHAN] ako_random_comment
Thanks, Manfre-kun!
Testing it right now… and works like a charm!
The only “problem” is that I have to disable the asy_jpcache plug-in because if not, the random comment stays there until the cache is cleaned, and so, it doesnt look like it’s randomly chosen.
The new request: any chance that section attribute accepts multiple comma separated values? I would like the comments from two sections to be picked up randomly.
Thanks in advance. Have fun!
Offline
Re: [plugin] [ORPHAN] ako_random_comment
I can’t do anything about the caching plugin, unless I modify that. I uploaded a new version with the comma separated list of sections. (I knew you were going to ask for that as I was uploading the first version)
Offline
Re: [plugin] [ORPHAN] ako_random_comment
Hey! please, don’t care about the “problem” with the cache plug-in.
You are the man, Manfre!
I will try this new version… this is my way of the ninja.
thanks!
Offline
Re: [plugin] [ORPHAN] ako_random_comment
Mmmm, I think I’m getting a cached version of the plug-in… because it still shows 0.1 when installed and the multiple values for section attribute isn’t no working.
I have cleaned the cache, but the version it’s the same.
This happened to me once… I can’t remember how I downloaded the new version…
And maybe it’s cached not in my computer but in a server (well, my imagination thinks that is possible).
thanks!
Offline
Re: [plugin] [ORPHAN] ako_random_comment
Me again!
Manfre: could be any any chance to grab the title of the article to which the comment belongs?
I have tried using <txp:title />
inside the comment form but it didn’t worked.
Just the title (and not any other article field) because I’m afraid this request could overbloat the plug-in with many queries to the database
thanks!
Offline
Re: [plugin] [ORPHAN] ako_random_comment
Hi Manfre,
maybe you should open a new thread for your plug-in or ako will get angry with all my posts :D
There is a little bug: when calling a comment form with your plug-in, if the comment form has a <txp:comment_time />
, it won’t output the comment date. It will output today’s date for every comment.
That’s all!
Thanks!
Offline
Re: [plugin] [ORPHAN] ako_random_comment
Naw, I don’t mind. ;)
Offline