cforms II User Forum

Registration is currently disabled.


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
Field populated by WP custom field value?
February 4, 2008
4:46 pm

Hey all…

Is it possible for the email field of a particular form to be populated by the value of a post's custom field?


I'm working on a site that has various accommodation listings. On each listing, I would ideally have a custom field, the value of which would be the email address of the particular listing.

I'd like CFORM then, to retrieve the value of this custom field and use it as the "to" email address for that particular form.

The end result would thus be that I would create 1 form that would submit to whatever email address I use in the custom field.

Creating a new form for each listing isn't an option as there's hundreds of them. So this option in the CFORM plugin would save me from writing a custom form from scratch.

Thanks in advance!! :)

February 4, 2008
7:46 pm
Munich, Germany
Forum Posts: 6400
Member Since:
March 6, 2005

That's quite easy to do, however you need to adjust the source code a bit:

in cforms.php search for $sentadmin = @mail:

and add this

$to = get_post_meta($Ajaxpid, 'YOUR CUSTOM FIELD KEY');

before // SMTP server or native PHP mai…

Now do the same in lib_nonajax.php, except add: 

$to = get_post_meta(get_the_ID(), 'YOUR CUSTOM FIELD KEY');

You also need to turn on "Extra variables
e.g. {Title}
" in the admin settings.

And make sure your email addresses in the custom field is properly formatted. 

February 4, 2008
8:35 pm

awesome!! :)

i'll give it a whirl laters…

Forum Timezone: Europe/Berlin

Most Users Ever Online: 959

Currently Online:
15 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: 3761

Members: 1463

Moderators: 3

Admins: 2

Forum Stats:

Groups: 1

Forums: 4

Topics: 5358

Posts: 18739

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

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

Administrators: Oliver (6400), Nicky (3)