Adding Mailchimp (MC4WP) checkbox to Woocommerce My Account registration form - woocommerce

I want to add a checkbox for people to subscribe to my Mailchimp when registering an account on my Woocommerce store. MC4WP provide the following code:
<label>
<input type="checkbox" name="mc4wp-subscribe" value="1" />
Sign-up to our newsletter.
</label>
How can I add this in to that form? Ideally with a snippet I can place in Codesnippets.
Thank you!

you can easily add in the custom HTML field.

Related

Add checkbox from Contact Form 7 into mail chimp list

In my WordPress site, i use "Contact Form 7" and
"Contact Form 7 MailChimp Extension" plugins for ingratiation with mailchimp.
Everything works fine!
The problem is,
that i have a checkbox for agreement getting newsletter in the contact form 7,
but I can't add a custom field in mailchimp for this checkbox.
under mailchimp list --> "List fields and |MERGE| tags" --> i can't find option of adding new field of checkbox type.
Under "Signup forms" there is option to add checkbox to form in mailchimp,
but how to map this checkbox field to checkbox field in my Contact Form 7?
Thanks a lot!
contact form 7:
<label> fname
[text* your-name] </label>
<label> email
[email* your-email] </label>
<label>date
[date* date-695 date-format:DD/MM/YYYY change-month change-year ]
</label>
[checkbox* checkbox-759 "Agree to receive a newsletter"]
[submit "Send"]
In Mailchimp tab, go to Advanced Settings and you will see a field called "Required Acceptance Field", add checkbox-759 there.

How to pass custom amount with Bitpay hosted checkout form?

I am looking to integrate BitPay for processing bitcoin payments on one of my sites.
Their hosted checkout form (similar to PayPal checkout form) is easy to integrate however I don't know how I can pass order amount with the form so that the same checkout button can be used for different orders (payments).
Here's their page regarding hosted checkout: https://bitpay.com/help-hosted-checkout
Bitpay has clearly stated that we can pass different order amount but they have not provided any field for this on the above mentioned page. I have contacted them and they will reply in 3 days but since I need to integrate this at the earliest, I hope somebody here can help me fast.
Thanks.
I was also looking for help with a bitpay button for a project and found this question (and another one like it), so coming back to answer in case it can help others in the future: If you got your bitpay button code from the payment button option on bitpay, your code might look something like this:
<form action="https://test.bitpay.com/checkout" method="post">
<input type="hidden" name="action" value="checkout" />
<input type="hidden" name="posData" value="" />
<input type="hidden" name="price" value="<?php echo $price_var;?>" />
<input type="hidden" name="data" value="...(your data value)..." />
<input name="checkout" type="submit" value="Checkout" class="form-button-submit button"/>
</form>
Having the line of code with 'name="price"' allows you to set a global variable (potentially your shopping cart total) as an order amount. Hope this helps!

store data in drupal 8

I have created form using twig template, the form has first name,last name and email.I need to save those values to database.
how can I create new table and store data in it??
<!DOCTYPE html>
<html>
<body>
<form action="/action_page.php">
First name: <input type="text" name="FirstName"><br>
Last name: <input type="text" name="LastName"><br>
Email: <input type="text" name="email" value="Mouse"><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
Can anyone help on that please??
You should use drupal's form api to create the form. Your way is not really "drupalish" way. Then you can define custom content type, with all the fields you need and if form submission handler of your form you can create new nodes in that type with data your form collected.
So google a bit, check some tutorial on form api, and how to make custome form and also on custom content types in drupal. Not that scare as it maybe looks to you right now.
Or, check on webform module that comes with D8 default installation, maybe you can use it instead!

Wordpress - Separate Log in and Register forms in the same page

I need to create a page in Wordpress. In it I need to have three tabs: Log In, Register, Forgot Password. Obviously, they will contain a login form, a registration form and a password recovery form. I have found instructions on how to create custom login form here:
http://www.tutorialstag.com/custom-wordpress-login-without-using-a-plugin.html
and how to create a custom registration form here:
http://www.tutorialstag.com/create-custom-wordpress-registration-page.html
Those two solutions seem good to me, so I'd like to use them. The problem occurs because both codes use $_POST for sending data and they both execute certain code in if($_POST) loops. Now, if I put both codes on the same page, and if a user tries to log in, it will also trigger the registration form's if($_POST) loop, and vice versa.
Is there a way for me to separate these two loops, something like if($_POST['login']) and if($_POST['register']) or in some other way?
Ideally, I want to create a plugin which adds shortcodes for login form, registration form and forgot password form. What is the best way to separate codes and yet make them work together in the same page?
Also, is there perhaps an easier way to achieve what I need? I've tried looking for plugins that might look alike, but with no luck.
Yes, and pretty much as you've described here.
Set the 'name' attribute on each of your submit buttons - e.g.
<input type="submit" name="login" value="Login" class="mybtnclass" />
Then when parsing, check if that value is set
if(isset($_POST['login'])) :
// Do login
elseif(isset($_POST['register'])) :
// Do registration
elseif(isset($_POST['reset'])) :
// Do password reset
endif;
EDIT:
An alternative is to give all the buttons the same 'name' and then test the 'value' attribute to determine which was pressed e.g.
<input type="submit" name="submit" value="Login" class="mybtnclass" />
<input type="submit" name="submit" value="Register" class="mybtnclass" />
<input type="submit" name="submit" value="Reset Password" class="mybtnclass" />
<?php
if('Login'===$_POST['submit']) :
// Do login
elseif('Register'===$_POST['submit']) :
// Do register
elseif('Reset Password'===$_POST['submit']) :
// Do password reset
endif;
?>

Drupal WebForm With PinPointe--Avoid Confirmation Page

Our company uses PinPointe for email marketing and we have a Drupal 6 site with several language domains. I have created a web form except I did not create any fields in Drupal. Instead in the node Edit NOT THE NODE WEBFORM EDIT....in the node edit for the body section I added the HTML and the javascript for form. Everything works well and the data is captured to pinpointe. The problem lies in the fact that the page..upon clicking submit..actually redirects to PinPointe where I get a friendly message saying. Thanks for joining. Well I don't want this. I would like to just pop an alert saying thanks and leave the user on the page they were on. I tried this code for using jquery to do the post but it isn't loading and I suspect that's because I need it in the header not the body.
So all I want is to submit the data to pinpointe and not redirect the user. So here is where my limited Drupal knowledge runs out:
If I create the input fields in the node webform then how do I get the form to post to pinpointe?
If I create the fields dynamically in the node body (not node>>webform) I can direct the submission to PinPointe but then how do I stop the redirect?
FWIW here is the jquery I was trying to use but suspect has to go in the header http://jsfiddle.net/4xDFK/4/
FWIW here is the code for the dynamic creation:
<form action="http://na04.mypinpointe.com/...." id="webform-client-form-1375" method="post" onsubmit="return CheckForm257(this);">
<div>
<div id="webform-component-UsrEmail">
<div id="edit-submitted-UsrEmail-wrapper">
<input id="edit-submitted-UsrEmail" name="email" size="30" type="email" />
</div>
</div>
<div class="form-actions form-wrapper" id="edit-actions">
<input class="form-submit" id="edit-submit" name="op" type="submit" value=" " />
</div>
</div>
</form>
Create your custom confirmation page in Drupal. Then set up PinPointe to redirect to this confirmation page.
In the PinPointe form manager, there is a option under the 'Thank you page options' to send a signup user to a custom URL.

Resources