Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-11-15 18:16:24

agustinpac
New Member
Registered: 2006-11-15
Posts: 4

Adding to the comment form

Hi all!!

I’m writing a plugin that someone requested here, but I’m a newby here.
I have modified the funcion saveComment (in comment.php) and what I needed works, but I need to add a checkbox where people write their comments.
The question is how do I do that and how do I send the checkbox info (‘yes’ or ‘no’) to the function saveComment like the other parameters: name, web, message, etc.

btw, i’ll change the name of the function later.

Thanks in advance!

(Edit: updated thread subject to something more clear. -Mary)

Last edited by Mary (2007-01-02 14:47:33)

Offline

#2 2006-11-15 18:22:31

variaas
Plugin Author
From: Chicago
Registered: 2005-01-16
Posts: 402
Website

Re: Adding to the comment form

So the built-in savecomment() function calls getcomment() to get things like name, web, email, etc. You could write another version of getcomment() to include your additional checkbox. Or you could just add a line to you savecomment() function to include:
$yourvar = ps('nameofcheckbox');

Offline

#3 2006-11-15 19:01:45

agustinpac
New Member
Registered: 2006-11-15
Posts: 4

Re: Adding to the comment form

That’s what I needed!! thanks

And how do I insert the checkbox in the code? because all the others are inserted using a function like this:
<td> <txp:comment_name_input /> </td>

<td> <txp:comment_remember /> </td>

thanks

Offline

#4 2006-11-15 19:18:18

variaas
Plugin Author
From: Chicago
Registered: 2005-01-16
Posts: 402
Website

Re: Adding to the comment form

Tags will just call a function –
<txp:asv_checkbox />
will call
function asv_checkbox($atts, $thing){ return $your_html_for_the_checkbox; }

So create a function that will generate the html for your checkbox and just have it return that string. You can include this function in the plugin you are building right now.

Offline

#5 2006-11-15 19:20:56

variaas
Plugin Author
From: Chicago
Registered: 2005-01-16
Posts: 402
Website

Re: Adding to the comment form

I highly recommend reading through Anatomy of a Plugin

Offline

#7 2006-11-16 12:26:19

agustinpac
New Member
Registered: 2006-11-15
Posts: 4

Re: Adding to the comment form

thanks guys!
I’m almost finishig it!!

I’ll let you know…

Regards

Offline

Board footer

Powered by FluxBB