mike62
Forum Replies Created
-
Can confirm that the update fixes the problem. Thanks for the quick work, Team Time.ly!
Nelero, thanks for this! Works great. I hope they incorporate this into future updates…!
Yes! Thank you!!
I had to do it here, to get the correct image, as well:
$metaSubValue = wp_get_terms_meta($subcategory->term_id, 'category_image' ,true);It’s working perfectly now. Thanks so much. 😀
Forum: Developing with WordPress
In reply to: get_posts offset not workingaHA! Thanks!! Sorry for not finding that myself… :S
Forum: Plugins
In reply to: [Contact Form 7] Integrate sendy with Contact Form 7Looks like someone has made something for this: https://github.com/CrystalAsia/sendywpcf
I know I want to modify:
wc_add_to_cart_message
But I just want to add something after it, not replace the whole thing; is that possible?I activate hookr and my entire front end is replaced with this error:
Fatal error: Unknown: Cannot use output buffering in output buffering display handlers in Unknown on line 0
🙁
Forum: Plugins
In reply to: [Shopp] Close/disable the store without removing/disabling the plugin?Ah, thank you! I knew there was something like that!
YES! That was exactly the code it was in there. Found it on one other site too. Thanks for the tip! \o/
Yes and yes.
Forum: Plugins
In reply to: [Media Tags] Speeding up Media Tags with WP_Query@stevesearer: Thanks for this! Using this plugin for a photography portfolio, and this snippet saved me a ton of time.
Forum: Hacks
In reply to: Capturing an email address from the front-end registration formI got it working with some jQuery. The below code needs to be added to functions.php:
add_filter( 'register_form', 'adding_custom_registration_fields' ); function adding_custom_registration_fields( ) { echo '<div class="form-row form-row-wide"><label for="reg_subscribe"><input type="checkbox" name="reg_subscribe" id="reg_subscribe" value="" />Subscribe to the newsletter</label></div>'; // email of the person being added to the email list $sendy_email = $_POST['email']; $url = "https://www.yourdomain.com/sendy/subscribe/$sendy_email/1/"; ?> <script> jQuery( ".register" ).submit(function() { var user_email = jQuery("#reg_email").val(); if(jQuery('#reg_subscribe').is(':checked')) { jQuery.post( "https://www.hilarydruxman.com/sendy/subscribe/"+ user_email +"/1/" ); } </script> <?php }Note that you need to change “yourdomain” to your domain, and the “1” at the end of that URL is the id for the list you want to subscribe the user to.
So, I ended up going a completely different route for this. I used jQuery to do both tasks: add a new user to my Sendy mailing list, and send my own email notification, since WooCommerce was being a pain about admin emails getting sent correctly. Here’s the code I ended up with in functions.php:
add_filter( 'register_form', 'adding_custom_registration_fields' ); function adding_custom_registration_fields( ) { echo '<div class="form-row form-row-wide"><label for="reg_subscribe"><input type="checkbox" name="reg_subscribe" id="reg_subscribe" value="" />Subscribe to the newsletter</label></div>'; echo '<div class="form-row form-row-wide"><label for="reg_wholesaler"><input type="checkbox" name="reg_wholesaler" id="reg_wholesaler" value="" />Send me more info about becoming a wholesaler</label></div>'; // email of the person being added to the email list $sendy_email = $_POST['email']; $url = "https://www.hilarydruxman.com/sendy/subscribe/$sendy_email/1/"; ?> <script> jQuery( ".register" ).submit(function() { var user_email = jQuery("#reg_email").val(); if(jQuery('#reg_subscribe').is(':checked')) { jQuery.post( "https://www.hilarydruxman.com/sendy/subscribe/"+ user_email +"/1/" ); } if(jQuery('#reg_wholesaler').is(':checked')) { var emailval = jQuery("#reg_email").val(); jQuery.ajax({ type: 'POST', url: '<?php bloginfo('stylesheet_directory'); ?>/send-admin-notification.php', data: jQuery(".register").serialize(), success: function(data) { if(data == "true") { } } }); } }); </script> <?php }Then the send-admin-notification.php file looks like this:
<?php $sendto = "[email protected]"; $usermail = $_POST['email']; //this is the "name" attribute of the field, in the form $subject = "New Wholesaler Request"; $headers = "From: " . strip_tags($usermail) . "\r\n"; $headers .= "Reply-To: ". strip_tags($usermail) . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html;charset=utf-8 \r\n"; $msg = "<html><body style='font-family:Helvetica,Arial,sans-serif;'>"; $msg .= "<h2>Hilary Druxman Wholesaler Request</h2>\r\n"; $msg .= "<p>Please contact me at the below address with more info on becoming a Hilary Druxman Design Wholesaler:</p>\r\n"; $msg .= "<p>".$usermail."</p>\r\n"; $msg .= "</body></html>"; if(@mail($sendto, $subject, $msg, $headers)) { echo "true"; } else { echo "false"; } ?>Hopefully this will help someone else!
bcworkz,
Thanks for your reply! You got me headed in the right direction. Turns out WooCommerce completely disables admin notification emails for new users. I found this bit of code to turn it back on:
function admin_email_on_registration() { $user_id = get_current_user_id(); wp_new_user_notification( $user_id ); } add_action('woocommerce_created_customer', 'admin_email_on_registration');The plugin does actually work, for customizing the notification emails.
My problem now, is that the checkbox for “_is_wholesaler” (refactored to “_interested_wholesaler”, below) seems to not be saving to the database at all. Here’s the full code I’m using to save the checkbox (as well as display it on the user profile page):
//add newsletter and wholesale checkboxes to the registration form add_filter( 'register_form', 'adding_custom_registration_fields' ); function adding_custom_registration_fields( ) { echo '<div class="form-row form-row-wide"><label for="reg_subscribe"><input type="checkbox" name="reg_subscribe" id="reg_subscribe" value="'.esc_attr($_POST['is_subscribed']).'" />Subscribe to the newsletter</label></div>'; echo '<div class="form-row form-row-wide"><label for="reg_wholesaler"><input type="checkbox" name="reg_wholesaler" id="reg_wholesaler" value="'.esc_attr($_POST['is_wholesaler']).'" />Send me more info about becoming a wholesaler</label></div>'; } //Updating user meta after successful registration add_action('woocommerce_created_customer','adding_extra_reg_fields'); function adding_extra_reg_fields($user_id) { extract($_POST); //add new fields to the user profile update_user_meta($user_id, '_is_subscribed', $is_subscribed); update_user_meta($user_id, '_interested_wholesaler', $is_wholesaler); } // end customization of registration form // add the wholesale checkbox to the back end function wholesale_toggle_callback($errors) { $html = '<h3>Wholesale Status</h3><p><label for="_interested_wholesaler" id="_interested_wholesaler"><input type="checkbox" id="_interested_wholesaler" name="_interested_wholesaler" value="1" ' . checked(1, get_option('_interested_wholesaler'), false) . '/>'; $html .= ' Interested in becoming a Wholesaler</label></p>'; echo $html; } add_action('user_new_form', 'wholesale_toggle_callback', 10, 1); add_action('show_user_profile', 'wholesale_toggle_callback', 10, 1); add_action('edit_user_profile', 'wholesale_toggle_callback', 10, 1); // save the wholesale checkbox when updated add_action( 'personal_options_update', 'save_wholesale_fields' ); add_action( 'edit_user_profile_update', 'save_wholesale_fields' ); function save_wholesale_fields( $user_id ) { if ( !current_user_can( 'edit_user', $user_id ) ) return false; update_usermeta( $user_id, '_interested_wholesaler', $_POST['_interested_wholesaler'] ); }I feel like I’m *almost* there, but am missing some bit of syntax to get that checkbox to save properly, both when editing the profile directly and when signing up using the front-end form. Any ideas?
Forum: Plugins
In reply to: [WooCommerce Product Gift Wrap] compatible woocommerce 2.2?Sheesh, nevermind, I see it now. :S