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
<?php
add_action( 'forminator_quizzes_submit_before_set_fields', function($entry){
$entry->set_fields(
array(
array(
'name' => '_forminator_user_ip',
'value' => Forminator_Geo::get_user_ip(),
)
)
<?php
add_action( 'init', function (){
if( current_user_can('editor') ){
add_filter( 'map_meta_cap', function ( $caps, $cap, $user_id, $args ) {
$to_filter = [ 'edit_post', 'delete_post', 'edit_page', 'delete_page' ];
<?php
/**
* Show Forminator payment data on the front end using Forminator API
* Make sure to create an hidden filed to collect the user ID
*
*/
//Using this to protect the plugin
defined('ABSPATH') or die('What are you looking for?');
<?php
/**
* Print muse video ai using shortcode [muse-video-embed]
* use id to define the video and width for size, e.g: [muse-video-embed id="c41FczZ" width="800"]
*/
//Using this to protect the plugin
defined( 'ABSPATH' ) or die( 'What are you looking for?' );
<?php
add_filter( 'forminator_addon_googlesheet_form_submitted_data', function( $submitted_data ) {
global $wpdb;
$entry_id = $wpdb->get_var( "SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '{$wpdb->dbname}' AND TABLE_NAME = '{$wpdb->prefix}frmt_form_entry';" );
if( $entry_id ){
$submitted_data['hidden-1'] = ( $entry_id - 1 );
}
return $submitted_data;
});
<?php
/**
* Plugin Name: [Forminator Pro] - Google Analytics
* Plugin URI: https://premium.wpmudev.org/
* Description: Send custom events to Google Analytics Only (as of 1.12.1.1)
* Author: Alessandro Kaounas @ WPMUDEV
* Author URI: https://premium.wpmudev.org/
* Task: 0/11289012348292/1175295834728851
* License: GPLv2 or later
*/
<?php
add_filter('forminator_custom_form_submit_errors', 'my_custom_form_validation', 10, 3);
function my_custom_form_validation($submit_errors, $form_id, $field_data_array) {
// Skip if is not the correct form
if( (int) $form_id !== 49 ){
return;
}
<?php
/**
* Adding [Urgent] to email subject if free shipping method woocommerce
*/
add_filter('woocommerce_email_subject_new_order', 'change_admin_email_subject', 1, 2);
function change_admin_email_subject( $subject, $order ) {
global $woocommerce;
<?php
//Using this to protect the plugin
defined('ABSPATH') or die('What are you looking for?');
function wpmu_order_status_876(){
ob_start();
// Using this form to collect the data