Skip to content

Instantly share code, notes, and snippets.

View patrickfreitasdev's full-sized avatar

Patrick de Freitas patrickfreitasdev

  • WPMU DEV
  • Perth | Australia
View GitHub Profile
View forminator-user-email.php
<?php
add_filter(
'forminator_custom_form_user_registration_before_insert',
function ($new_user_data) {
add_action('user_register', 'wpmudev_forminator_filter_user_register_email', 10, 2);
return $new_user_data;
}
);
View forminator-custom-li-html.php
<?php
add_action( 'wp_footer', function(){
global $post;
if( ! $post instanceof WP_Post || ! has_shortcode( $post->post_content, 'forminator_form' ) ) {
return;
}
?>
<script type="text/javascript">
jQuery( document ).ready( function($) {
View wpmudev-upload-mapping-custom-field.php
<?php
/**
* Plugin Name: [Forminator] Upload mapping to ACF image field
* Description: Solves a bug that prevents upload field mapping to ACF image field through post data form
* Author: Prashant Singh @ WPMUDEV
* Author URI: https://premium.wpmudev.org
* License: GPLv2 or later
*/
if (!defined('ABSPATH')) {
View forminator-validate-minimum-phone-field-characters.php
<?php
/**
* Plugin Name: [Forminator] - Add support for limit minimum Forminator phone fields characters
* Description: [Forminator] - Add support for limit minimum Forminator phone fields characters
* Based on https://gist.github.com/wpmudev-sls/b20040d0f49fb822553194fd0a34d5ff
* Author: Thobk @ WPMUDEV | Patrick Freitas @ WPMUDEV
* Author URI: https://premium.wpmudev.org
* License: GPLv2 or later
*/
if ( ! defined( 'ABSPATH' ) ) { exit; } elseif ( defined( 'WP_CLI' ) && WP_CLI ) { return; }
View sample-inline-css.html
<div>
<div style="display: block; background-color: #ddd; color: black; padding: 10px;">
Name:
</div>
<div style="display: block; color: black; padding: 10px 20px;">{name-1}</div>
<div style="display: block; background-color: #ddd; color: black; padding: 10px;">
Email:
</div>
<div style="display: block; color: black; padding: 10px 20px;">{email-1}</div>
View cookie-forminator-submit.php
View allow-subsite-admin-edit-user.php
<?php
//Based on https://thereforei.am/2011/03/15/how-to-allow-administrators-to-edit-users-in-a-wordpress-network/
function mc_admin_users_caps( $caps, $cap, $user_id, $args ){
foreach( $caps as $key => $capability ){
if( $capability != 'do_not_allow' )
continue;
View defender-legacy-ip-detection.php
<?php
add_action( 'plugins_loaded', function(){
if ( ! defined( 'DEFENDER_VERSION' ) ) {
return; // Defender is not installed/enabled.
}
if ( ! class_exists( 'Defender_Legacy_IP_Detection' ) ) {
class Defender_Legacy_IP_Detection {
use WP_Defender\Traits\IP;
View assign-new-user.php
<?php
/**
** Script to assign post to new user when Post Data field and user registration are used together.
**/
if (!defined('ABSPATH'))
{
exit;
View custom-email-html.php
<?php
// Use [pmu_mail_render] shortcode
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
add_action(
'wp_ajax_forminator_save_builder',