cforms II User Forum

Registration is currently disabled.
Guest

FAQs

Login form protected by Login LockDown.


Lost password?
Advanced Search

— Forum Scope —

  

— Match —

   

— Forum Options —

    

Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
Tutorial [WP comment feature]: Adding and using extra fields!
February 18, 2009
7:12 am
Oliver
Munich, Germany
Admin
Forum Posts: 6400
Member Since:
March 6, 2005
Offline

With v10.3 the support for extra comment fields (in addition to author, url, email & comment) has been much improved.

Adding two extra fields (e.g. another text input field + a check box) only takes a few steps now, here is how it's done:

[#1] Form Configuration:

Extend your form by adding those two more fields ( note the required [id:customX] ):

Other required settings:

[#2] The above will make the (default WP comment) form look like:

Only the extra fields will be stored in the cforms tracking tables:

[#3] Now adjust your WP's comment.php template:

Add inside the LOOP:

<?php $xtra = cf_extra_comment_data(get_comment_ID()); ?>

The data array $xtra can now be referenced, e.g. right after the comment_author_link() in this example:

&#8212; <?php echo ' Agreed: '.($xtra['My custom checkbox']<>''?'Yes':'No'); ?>

[#4] Outputs:

October 20, 2009
5:56 am
Guest

Please, Oliver do a Tutorial for print only the text input from the user.

December 6, 2009
6:39 pm
Gaelle
Guest

Oh yes it would be very usefull ! or at least could you be more precise with  the syntaxe  to use and why not examples so that we could display more easily the content of extra fields.

The most complicated is not to edit extra fields in a form but to insert the" php echo tag" in the template. As for me the "snag" especially concerns the end of the call Cry

<>''?'Yes':'No'); ?>

to adpapt that code portion to my requirements (a select box with a first negative option for "select in the list").

Tx in advance.

February 4, 2010
9:10 pm
Guest

Hi, being this my first post: thank you so much for this incredible plugin & the great support. Your plugin enables WP to go beyond the label as publishing platform to be a “capturing” platform! ;-)

My observation to this feature:

either tracking is working or is the WP-Comment. Enabling both at the same time results in inserting comments (& mail notification) but without tracking the entries in the DB.

As I haven’t yet see it in action, I understand that the extra fields are added only to the tracking table but not inserted in the wp_commentmeta? Perhaps a desirable feature? Why did you opt for only inserting the extra fields into the CF-DB?

My configuration: WP 2.9.1 & CF 11.3

LG,

Adrián

February 5, 2010
7:13 am
Oliver
Munich, Germany
Admin
Forum Posts: 6400
Member Since:
March 6, 2005
Offline

boquiabierto said:

Hi, being this my first post: thank you so much for this incredible plugin & the great support. Your plugin enables WP to go beyond the label as publishing platform to be a “capturing” platform! ;-)

My observation to this feature:

either tracking is working or is the WP-Comment. Enabling both at the same time results in inserting comments (& mail notification) but without tracking the entries in the DB.

no, both generally works,  tracking data & using the WP comment feature. otherwise this tutorial would be pointless, no? innocent

As I haven’t yet see it in action, I understand that the extra fields are added only to the tracking table but not inserted in the wp_commentmeta? Perhaps a desirable feature?

absolutely not. that would mean that cforms would have to alter your core WP comment tables which is really bad and can cause all kinds of trouble down the path.

Why did you opt for only inserting the extra fields into the CF-DB?

security, upgrade-abilty etc.

My configuration: WP 2.9.1 & CF 11.3

LG,

Adrián

Forum Timezone: Europe/Berlin

Most Users Ever Online: 959

Currently Online:
20 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

tracedef: 43

mores: 21

Gyrus: 20

frozenwaste: 18

asuffredini: 15

photoworks: 14

Member Stats:

Guest Posters: 3762

Members: 1463

Moderators: 3

Admins: 2

Forum Stats:

Groups: 1

Forums: 4

Topics: 5361

Posts: 18742

Newest Members: juredujmovic, dreamkeeper, rajattyagi, wrokaa, lukass

Moderators: Paul (421), cnymike (8), sonika (95)

Administrators: Oliver (6400), Nicky (3)