Your cart is currently empty!
[affiliates_id] in cf7
—
by
Hi Antonio
I need to insert the id field of the logged in user in a cf7 field
Let me explain, I have a cf7 form on a page reserved for affiliates that allows them to send some data to the administration
However, I need to create a field that contains the affiliate ID and is visible in the field before submitting
I tried with [affiliates_id] but it doesn’t work 🙁
How can I do?
Thank you
Posted in Affiliates Enterprise
Comments
One response to “[affiliates_id] in cf7”
Hi Alessio,
Good morning and happy new week!
I trust you are well and safe! Thank you so much for reaching out and for asking your question.
With regards, to your inquiry, by default Contact Form 7 does not render shortcodes found within their forms. However, you can fix this by doing the following:
In your themes functions.php file(most preferrably the one in your child-theme), please add the following code snippert:
add_filter( ‘wpcf7_form_elements’, ‘do_shortcode’ );
function mycustom_wpcf7_form_elements( $form ) {
$form = do_shortcode( $form );
return $form;
}
Then within your desired form, please add the following shortcode in order to render the affiliate ID.
[affiliates_is_affiliate]
ID:[affiliates_id]
[/affiliates_is_affiliate]
The above shortcode would render the Affiliates ID within the form and would only do this if the user is an affiliate. You can read more on the available shortcodes here:
* https://docs.itthinx.com/document/affiliates-pro/shortcodes/
I remain available to help if you have any further inquiries.
STAY SAFE and I wish you a very fine and productive day ahead!
Best,
Eugen.