CFDB plugin : Preventing Duplicate Submissions from CF7 - wordpress

I have a form where user add his email address, I’m trying to prevent users to enter there email many times. I use "contact form to database plugin" to save email address and export them to excel. while searching on internet I found this solution (link below) but I can’t get it work can you help me please :
https://cfdbplugin.com/?page_id=904
Thanks

I found the solution,
in the line where you put the name of the form you should put the title of the form (line bellow ) :
$formName = 'email_form'; // Change to name of the form containing this field
so, for exemple if we have created with the contact form 7 a form here is the shortcode that we will have :
<?php echo do_shortcode( '[contact-form-7 id="69" title="Email_form" html_name="my_form"]' ); ?>
what I did is I put the value of html_name in the script of CFDB but when I changed to the value of title it works

Related

Display error message when shortcode user entry id not added

I have this shortcode ( put together from different sources ) and it works.. when a user inputs the shortcode to a page [insert_xpage idnum="123"] it will show the contents of the page id123.
However if in the shortcode itself when a user inputs the shortcode and does not add the id number [insert_xpage idnum=""] the site dies. NOT the backend, just the frontend. You can navigate to the shortcode on the post and enter a number and the site comes back.
I have added a var called $err containing an error message with some html markup also shown below.
How can the $output = ''; be amended to show the error, instead of killing the page? and... still allow the site to work!
But have a little error message where the $output should be?
Maybe another filter? or some kind of elseif? don't know....
I had tried to do different output, return, echo or just different ways to show an error
tried:
.$GLOBALS["err"].
' ".$GLOBALS["err"]." '
echo "".$GLOBALS["err"]."";
echo ""$err"";
If a user does not add the required id in the correct place, the site itself breaks.
EG: [insert_xpage idnum=""]
instead of [insert_xpage idnum="123"]

getting Custom field value in contact form 7 in wordpress

in my website i have a page that shows the job openings. Each job opening is done it as post. So when you click on a job opening it will goes to the detail page and shows the full details.All the job detail page have a unique job id and it is entering using a custom field in the admin using toolset. Then all the detail page have a contact form also for send there resume.so what i need is when sending the mail i need to pass the job id as an hidden field and it should be shown in the mail.
what i tried is
1
<?php echo do_shortcode( '[contact-form-7 id="983" title="contact 1" job ID="'.get_field( 'job-id' ).'"]' ); ?>
i tried this for getting the custom field value along with the shortcode....
i also tried this
2
[hidden hidden-948 "wpcf-job-id"]
i tried this to get the custom field value in the contact form 7 itself but both the codes didn't work for me .....
is there any way to get the custom field value in contact form 7....
Thanks in advance
You Can use this plugin to add custom fields in contact form 7 form
https://wordpress.org/plugins/advanced-custom-fields-contact-form-7-field/

Adding a Advanced Custom Field to Woocommerce users My Account Page

I am using admin columns together with ACF (advanced custom fields)
in the backend I created a field in ACF for just some text, now with admin columns I made this field viewable in the backend for me to add some text that I want .
Now I want to display this text in the my-account page on the frontend.
now I got this far that i added the snippet code to the account page and that works .
But it's only displaying the DEFAULT value I have filled in in ACF and not the value I have entered in the admin custom column backend.
so to clarify even more in my users backend page i give the user a string of text.
That text needs to be displayed in the frontend on the users account
So all users should have a different string of text. The text I can add using admin columns
thats no problem but its only displaying (echo,printing) this text that I have filled in there to the woocommerce account page is not working.
Again I only get the default result text from ACF there not the text I had put in.
For getting default message the code that I use now is:
<?php echo the_field('ethwallet'); ?>
This is giving me the default message right now. not the result that I entered in the backend.
I realize this is an older question, but I wanted to provide an answer as it has been viewed several hundred times.
To retrieve custom meta data (specifically ACF field data) from a User object you need to pass in the current user ID as a second parameter to the get_field or the_field function.
Like so:
<?php echo get_field( 'ethwallet', 'user_' . get_current_user_id() ); ?>
The way it works is that ACF needs the second parameter formatted as user_X, where X is the actual ID of the user (1, 347, whatever). So we concatenate the string part ('user_') with the actual ID of the logged in user and that forms the full parameter to pass to the_field() or get_field().
P.S. It's a minor detail, but in this case echo the_field(); is redundant because the_field() echoes its values by default. You could likely omit the echo or do echo get_field();

Generate custom dynamic URL in Contact Form 7 body

I need to add in the contact form body a custom filter. I was reading through the custom code to be written in functions.php but I wasn’t clear on how to use it for my case.
I have the following situation. I have yith plugin which has this code
<?php echo apply_filters( 'yith_wcwl_email_share_body', urlencode( $share_link_url ) ) ?>
This code generates a specific URL that can be shared in social networks and by email. I want to send this URL not through the share function, but as a part of the Contact Form 7.
Can anyone help me implement this code so the dynamically generated url from this code will be sent by email when Contact form 7 is compiled and sent?

How to link to a custom php page on a Wordpress Admin Plugin?

I am quite new in wordpress dev and I am writing an Admin plugin to handle certificate creation.
I achieve to create the plugin, and I have it in the Admin Menu via the add_menu_page.
Here is the plugin concept:
I used the WP_List_Table to display the list of users.
I have added custom columns with some user meta-data.
I have added a custom column with a button.
This button should display a form (with the correct items data to create a certificate. this form is designed in the file test.php. (Exactly the same way the edit user link is acting).
What I would like to do is :
I would like my button to open another php page that contains a Form and process that forms. And After go back to the previous page. More or less the same way the Users Admin do with the Users-edit.php page.
My plugin name is gbr-certificate.
My issues :
I don't know how to link to my php page that contains the form (test.php). This files is in my plugin root directory.
I have tried :
hard coding the url : In the column_default function adding the following code for the button :
$link = "http://localhost:8888/Standard/wp_content/plugins/gbr-certificate/test.php?user-id=" . $item->ID . "&wp_http_referer=" . urlencode( wp_unslash( $_SERVER['REQUEST_URI']));
$btn = "<button id=\"cert-\" class=\"button\" href=\"" . $link . "\">create cert.</button>";
Result: I have the right links in my button href :
<button id="cert-" class="button" href="http://localhost:8888/Standard/wp_content/plugins/gbr-certificate/test.php?user-id=1&wp_http_referer=%2FStandard%2Fwp-admin%2Fadmin.php%3Fpage%3Duser-cert-manager">create cert.</button>
But when i Click it => i get to the following url :
http://localhost:8888/Standard/wp-admin/admin.php?s=&_wpnonce=feb9b81efe&_wp_http_referer=%2FStandard%2Fwp-admin%2Fadmin.php%3Fpage%3Duser-cert-manager&paged=1
with a blank page displayed.
Could someone help me to achieve this ?
Thanks.
Guillaume B.

Resources