function wws_wwlc_auto_select_role ($user) { //get the selected role $selected_role = get_user_meta($user->ID, ‘wwlc_cf_select_role’, true); // Change to match your custom field. $defaultRole = get_option( ‘wwlc_general_new_lead_role’ ); if ($selected_role) { $user->remove_role( $defaultRole ); $user->add_role( $selected_role ); } } add_action( ‘wwlc_action_after_approve_user’, ‘wws_wwlc_auto_select_role’ );Continue reading
/** * Generate a virtual coupon when order is completed. * * @param int $order_id Order ID. */ function acfwp_create_virtual_coupon( $order_id ) { $order = wc_get_order( $order_id ); $customer_id = $order->get_customer_id(); $create_date = date( ‘Y-m-d H:i:s’, current_time(‘timestamp’)); $expire_date = date(…Continue reading
/*********************************************************************************** * WooCommerce Wholesale Lead Capture Re-send Email Button in User Profile * *********************************************************************************/ function wwlc_add_resend_email_button() { if ( ! is_plugin_active( ‘woocommerce-wholesale-lead-capture/woocommerce-wholesale-lead-capture.bootstrap.php’ ) ) { return; } ?> Re-send wholesale lead email Wholesale application receivedWholesale account approvedWholesale account rejected Send…Continue reading
/** * Custom shortcode to display WPForms form entries in table view * * Basic usage: [wpforms_entries_table id=”FORMID”] * * @link https://wpforms.com/developers/how-to-display-form-entries/ * * For support, please visit: https://www.facebook.com/groups/wpformsvip */ function wpf_entries_table( $atts ) { // Pull ID shortcode attributes.…Continue reading
/** * Add field values for dropdown, checkboxes, and multiple choice fields * * @link https://wpforms.com/developers/add-field-values-for-dropdown-checkboxes-and-multiple-choice-fields/ * * For support, please visit: https://www.facebook.com/groups/wpformsvip */ add_filter( ‘wpforms_fields_show_options_setting’, ‘__return_true’ );Continue reading
/** * Defer the reCAPTCHA script until after the page loads * * @link https://wpforms.com/developers/how-to-defer-the-recaptcha-script/ * * For support, please visit: https://www.facebook.com/groups/wpformsvip */ function wpf_recaptcha_add_async_defer( $tag, $handle ) { if ( strpos( $tag, ‘recaptcha/api.js?onload=wpformsRecaptchaLoad’ ) !== false ) { $tag…Continue reading
/** * Change position of v2 Invisible reCAPTCHA badge * * @link https://wpforms.com/developers/how-to-change-the-position-of-the-v2-invisible-recaptcha-badge/ * * For support, please visit: https://www.facebook.com/groups/wpformsvip */ function wpf_dev_invisible_recaptcha_position( $data, $form_data ) { $type = wpforms_setting( ‘recaptcha-type’, ‘v2’ ); if ( ‘invisible’ === $type ) {…Continue reading
/** * Run shortcodes on HTML field content * * @link https://wpforms.com/developers/how-to-display-shortcodes-inside-the-html-field/ * * For support, please visit: https://www.facebook.com/groups/wpformsvip */ function wpf_dev_html_field_shortcodes( $field, $field_atts, $form_data ) { if ( ! empty( $field[ ‘code’ ] ) ) { $field[ ‘code’ ]…Continue reading
/** * Sets a default date for Date Picker * * @link https://wpforms.com/developers/how-to-set-a-default-date-for-your-date-picker-form-field/ * * For support, please visit: https://www.facebook.com/groups/wpformsvip */ function wpf_dev_date_picker_default() { ?>Continue reading