Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀

Slava Abakumov slaFFik

🚀
View GitHub Profile
@slaFFik
slaFFik / wp-mail-smtp-disable-smtpautotls.php
Created Nov 3, 2017
WP Mail SMTP: Disable SMTPAutoTLS
View wp-mail-smtp-disable-smtpautotls.php
<?php
add_filter('wp_mail_smtp_custom_options', function( $phpmailer ) {
$phpmailer->SMTPAutoTLS = false;
return $phpmailer;
} );
@slaFFik
slaFFik / wpforms-add-bcc-to-emails.php
Created Oct 16, 2017
WPForms: add BCC email header to notification emails
View wpforms-add-bcc-to-emails.php
<?php
add_filter( 'wpforms_email_headers', function ( $headers, $emails ) {
// APPLY THE BCC TO THIS FORM ID ONLY.
// CHANGE THE ID TO THE FORM YOU NEED. OR REMOVE THE WHOLE IF BLOCK IF NEEDED FOR ALL FORMS.
if ( 384 !== $emails->form_data['id'] ) {
return $headers;
}
// CHANGE THIS EMAIL ADDRESS TO YOURS:
@slaFFik
slaFFik / wpforms-export-change-separator.php
Last active Jan 31, 2020
WPForms: change the export CSV file separator.
View wpforms-export-change-separator.php
<?php
// For WPForms < v1.5.5, but should work with the latest version as well.
add_filter(
'wpforms_csv_export_separator',
function( $sep ) {
return ';';
}
);
@slaFFik
slaFFik / wpforms-add-new-currency.php
Created Sep 27, 2017
WPForms: Add new currency
View wpforms-add-new-currency.php
<?php
add_filter( 'wpforms_currencies', function( $currencies ) {
$currencies['RON'] = array(
'name' => __( 'Romanian Leu', 'wpforms' ),
'symbol' => ' lei',
'symbol_pos' => 'right',
'thousands_separator' => ',',
'decimal_separator' => '.',
'decimals' => 2,
@slaFFik
slaFFik / wpforms-process-custom-smarttag.php
Last active Apr 14, 2020
WPForms: Process own smart tag (smarttag) with custom value
View wpforms-process-custom-smarttag.php
<?php
add_filter( 'wpforms_smart_tag_process', function ( $content, $tag ) {
// CHANGE custom_tag TO YOUR OWN SMART TAG NAME.
preg_match_all( '/custom_tag="(.+?)"/', $tag, $ids );
if ( ! empty( $ids[1] ) ) {
foreach ( $ids[1] as $key => $item_id ) {
// CHANGE HERE WHAT YOU WANT TO GET.
@slaFFik
slaFFik / wpforms-hide-forms-on-mobile.php
Created Sep 25, 2017
WPForms: Hide forms on mobile
View wpforms-hide-forms-on-mobile.php
<?php
add_filter( 'wpforms_frontend_load', function( $load, $form_data, $var ) {
// Comment these lines if you need to hide a certain form only.
if ( wp_is_mobile() ) {
return false;
}
// Or check certain form only. Uncomment.
/*
@slaFFik
slaFFik / wpforms-submit-form-once-loggedin.php
Last active Nov 22, 2020
WPForms: Submit the form only once for logged in users.
View wpforms-submit-form-once-loggedin.php
<?php
add_action( 'wp', function () {
if ( ! is_user_logged_in() ) {
return;
}
$entries = wpforms()->entry->get_entries(
array(
'form_id' => 74, // CHANGE THIS FORM ID
@slaFFik
slaFFik / wpforms-split-name-smarttag-in-notifications.php
Last active Aug 29, 2017
WPForms: Split the first Name field to display only First Name in notification text
View wpforms-split-name-smarttag-in-notifications.php
<?php
add_filter( 'wpforms_process_smart_tags', function ( $message, $form_data, $fields = '', $entry_id = 0 ) {
// CHANGE THIS FORM ID TO YOURS:
if ( 157 != $form_data['id'] ) {
return $message;
}
// So we are not submitting the form.
if ( empty( $entry_id ) ) {
return $message;
@slaFFik
slaFFik / wpforms-change-js-validation-form-id.php
Last active Aug 29, 2017
WPForms: Change the JS validation strings based on a form ID (useful for multi-language sites)
View wpforms-change-js-validation-form-id.php
<?php
add_filter( 'wpforms_frontend_strings', function( $strings ) {
global $post;
if ( ! isset( $post->post_content ) ) {
return $strings;
}
preg_match( '~\[wpforms id=\"(\d+)\"~', $post->post_content, $matches );
@slaFFik
slaFFik / ab-bp-retroactiveusers.php
Last active Feb 3, 2020 — forked from technosailor/ab-bp-retroactiveusers.php
Populate WordPress User Meta so that even users who have never logged in will display on the Members BP page
View ab-bp-retroactiveusers.php
<?php
/*
Plugin Name: Retroactive BP User Acticity
Plugin URI: https://gist.github.com/3953927
Description: Makes all BuddyPress users visible immediately on user creation and retroactively adjust users to allow for their display before logging in.
Author: Aaron Brazell
Version: 1.0
Author URI: http://technosailor.com
License: MIT
License URI: http://opensource.org/licenses/MIT
You can’t perform that action at this time.