Skip to content

Instantly share code, notes, and snippets.

View verygoodplugins's full-sized avatar

Very Good Plugins verygoodplugins

View GitHub Profile
@verygoodplugins
verygoodplugins / wpf-woocommerce-sync-processing-orders.php
Created October 2, 2020 10:04
Makes WP Fusion send Enhanced Ecommerce data when a WooCommerce order is created in Pending status, instead of waiting for Processing
<?php
//
// Makes WP Fusion send Enhanced Ecommerce data when a WooCommerce order is created in Pending status, instead of waiting for Processing
//
function wpf_woocommerce_run_on_pending( $order_id ) {
if ( ! function_exists( 'wp_fusion' ) ) {
return;
@verygoodplugins
verygoodplugins / wpf-extend-http-timeout.php
Created July 19, 2020 08:02
Extends the HTTP timeout to 60 seconds
<?php
function wpf_extend_timeout( $args, $url ) {
$args['timeout'] = 60;
return $args;
}
@verygoodplugins
verygoodplugins / wpf-gravity-forms-salesforce-custom-object.php
Created July 7, 2020 05:35
Create a custom object in Salesforce after a Gravity Forms submission
<?php
/***********************************************************************
* Salesforce Create Inquiry
***********************************************************************/
function red_new_business_inquiry_submission( $entry, $form ) {
// Switch Salesforce integration to the Inquiry_Form__c object type
@verygoodplugins
verygoodplugins / hide-widget-from-logged-in-users.php
Last active May 29, 2020 13:48
Simple snippet for adding a checkbox to hide widgets from logged in users
<?php
// Widget form
function cust_widget_form( $widget, $return, $instance ) {
if( ! isset( $instance['logged_out_only'] ) ) {
$instance['logged_out_only'] = false;
} ?>
@verygoodplugins
verygoodplugins / wpf-skip-contact-creation-on-field.php
Created April 29, 2020 09:20
Conditionally disable WP Fusion from syncing new contacts to your CRM based on a user_meta field value
<?php
function skip_contact_creation( $user_meta, $user_id ) {
if ( isset( $user_meta['receive_press_releases'] ) && true != $user_meta['receive_press_releases'] ) {
$user_meta = null;
}
return $user_meta;
@verygoodplugins
verygoodplugins / wpf-delete-user-on-field-change.php
Last active June 29, 2023 11:15
Deletes WordPress user when the "role" field is loaded from the CRM with a value of "deleted"
<?php
// Deletes WordPress user when the "role" field is loaded from the CRM with a value of "deleted"
// Works when a webhook is received or a batch Pull User Meta operation is run.
function my_wpf_delete_user_by_field( $user_id, $user_meta ) {
if ( isset( $user_meta['role'] ) && $user_meta['role'] == 'deleted' && ! user_can( $user_id, 'manage_options' ) ) {
require_once( ABSPATH . 'wp-admin/includes/user.php' );
@verygoodplugins
verygoodplugins / wpf-learndash-require-enrolled.php
Created April 21, 2020 08:11
Modifies WP Fusion's course access permissions for LearnDash so users must be enrolled in the course to see the course page
<?php
// Check course access
function check_ld_access( $can_access, $user_id, $post_id ) {
if ( ! function_exists( 'sfwd_lms_has_access' ) ) {
return $can_access;
}
@verygoodplugins
verygoodplugins / wpf-sync-learndash-quiz-progress.php
Last active April 13, 2020 08:17
Sync LearnDash quiz results to custom fields in the CRM
<?php
// Register the quiz fields in the WPF settings
function wpf_add_learndash_quiz_fields( $meta_fields ) {
$args = array(
'post_type' => 'sfwd-quiz',
'nopaging' => true,
);
@verygoodplugins
verygoodplugins / wpf-allow-rss.php
Last active February 11, 2024 18:27
Bypass WP Fusion's content restriction on RSS feed content
<?php
function wpf_allow_rss( $can_access, $user_id, $post_id ) {
if ( is_feed() ) {
$can_access = true;
}
return $can_access;
@verygoodplugins
verygoodplugins / wpf-sync-multiple-subscription-renewal-dates.php
Last active November 4, 2021 07:20
Allows syncing the renewal dates from multiple WooCommerce subscriptions into multiple custom fields
<?php
function wpf_subscription_products_meta_fields( $fields ) {
if ( ! class_exists( 'WC_Subscriptions_Product' ) ) {
return;
}
$args = array(
'post_type' => 'product',