Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-03-17 14:13:13

december76
Member
From: Malmö, Sweden
Registered: 2004-05-18
Posts: 45
Website

How do I add an extra field in the comment form?

Hello!

Is there a simple way to add an extra field to the comment form without actually hacking into the Textpattern code (and thereby make updating a nightmare)?

It’s simple enough to add an extra field to the txp_discuss table and it’s also rather simple to insert an extra field into the comment form via the <txp:php> tag and some code, but how do you tell Textpattern to actually store the contents of that extra field into the database? If this would be possible to acheive via some PHP written directly in the comment form I would be a happy man indeed.

Anyone?

/Joakim

Offline

#2 2006-04-07 20:12:01

clivewalker
Member
From: Horsham UK
Registered: 2004-07-19
Posts: 26
Website

Re: How do I add an extra field in the comment form?

If you find another answer, let me know – but I think this will involve editing/hacking the txp code to add another field to the Comments ‘insert into database’ statement. I don’t have sufficient knowledge to know where this is. You would probably also need to hack the admin so that the new field(s) are displayed in Admin > Comments.

I’ve been looking round for a plugin that might be hacked to do this – but have not found one yet.

Offline

#3 2006-04-10 15:56:20

clivewalker
Member
From: Horsham UK
Registered: 2004-07-19
Posts: 26
Website

Re: How do I add an extra field in the comment form?

As a follow-up to my prev post, we are working on a website where we require one additional field in the Comments form but we do not need the website URL field. In this case we are going to use the web URL field to store some simple text from our website commenters. This will store the text in the database. Comments will be moderated, so all we need to do is use/display/edit the extra field in the way we want. We won’t be using it as the URL for the commenters name so this works for us.

Admittedly, this is not really adding another field. It’s just using the web field in a different way.

Offline

#4 2006-04-11 06:05:16

tranquillo
Archived Plugin Author
Registered: 2005-03-07
Posts: 127
Website

Re: How do I add an extra field in the comment form?

Imho this could be achieved with a plugin:

Create a txp:tag that outputs the desired field on comment.form event. Then let it save its content in the database on comment.save event. There are explanations on these two events in the textbook:

<a href=“http://textpattern.net/wiki/index.php?title=Combat_Comment_Spam”>comment.form and comment.save</a> and <a href=“http://textpattern.net/wiki/index.php?title=Plugin_Development_Topics”>callback_events</a>

Offline

#5 2006-04-12 06:09:38

december76
Member
From: Malmö, Sweden
Registered: 2004-05-18
Posts: 45
Website

Re: How do I add an extra field in the comment form?

Thank you both for your thoughts and inputs. After having skimmed through the comment.form and comment.save and callback_events in the textbook I would have to agree that it would be entirely possible (and probably not that difficult) to write a plugin that lets you add an extra comment field. I would however rather not try to write it myself, mostly because I’m crap at this level of PHP programming. I will simply have to hope for some gentle hearted stranger to solve this problem. Obviously I’m not he only one who misses this feature.

Offline

Board footer

Powered by FluxBB