jabounet
Forum Replies Created
-
Forum: Plugins
In reply to: [Plugin: Contact Form 7] Add custom field managementHi nealb13
I’m confused, I wrote [pagelink name] but it was for the module i modified.
If you used exact schulzjan’s module put [pagetitle name] in the form and for the module i posted put [pagelink name]
The [name] is a variable, you can choose whatever you want, for example [pagetitle thepage] in the form ([thepage] in the message)If you used the modified module, it retrieves the value of the url parameter ‘id’, try to put ?id=yyy at the end of your url (like test.com/?id=yyy) the value of the hidden field should be ‘yyy’
Forum: Plugins
In reply to: [Plugin: Contact Form 7] Add custom field managementHi dunc1,
Try to go to the admin page of contact-form7
Next put the[pagelink yourcode]
short code in the form. Then use[yourcode]
in the mail.
I hope this will help you
ByeForum: Plugins
In reply to: [Plugin: Contact Form 7] Add custom field managementThank you very much schulzjan !
I have modified your code in order to add hidden field with a parameter from the url, for example with http:/yousite.com/contact/?id=12 you can get ‘id’ value (12) and use it in your mail.
<?php /** ** module, which adds a computed values to be displayed in the resulting message: ** [pagelink name] -> permalink of that post/page is available via [name] **/ /* Shortcode handler */ function wpcf7_pagelink_shortcode_handler( $tag ) { global $wpcf7_contact_form; global $wp_query; if ( ! is_array( $tag ) ) return ''; $type = $tag['type']; $name = $tag['name']; $url = $_SERVER['QUERY_STRING']; parse_str($url, $query); $html = '<input type="hidden" name="'. $name .'" value="'.$query['id'].'" />'; return $html; } wpcf7_add_shortcode( 'pagelink', 'wpcf7_pagelink_shortcode_handler', true ); function wpcf7_pagelink_validation_filter( $result, $tag ) { global $wpcf7_contact_form; $type = $tag['type']; $name = $tag['name']; $url = $_SERVER['QUERY_STRING']; parse_str($url, $query); $thePageID = $query['id']; $_POST[$name] = $thePageID; return $result; } add_filter( 'wpcf7_validate_pagelink', 'wpcf7_pagelink_validation_filter', 10, 2 );
thank you again !!! (apologies for my english)
@thoolz : you have to save schulzjan’s code as pagelink.php for example and put it in the contact-form-7’s module directory into your server.