Skip to content

Instantly share code, notes, and snippets.

View remcotolsma's full-sized avatar
🏢
Working @pronamic

Remco Tolsma remcotolsma

🏢
Working @pronamic
View GitHub Profile
@remcotolsma
remcotolsma / README.md
Last active December 21, 2023 14:13
WordPress development environment on Mac with Brew, Nginx, PHP 7, PHP-FPM, MariaDB, phpMyAdmin and more

WordPress development environment on Mac with Brew, Nginx, PHP 7, PHP-FPM, MariaDB, phpMyAdmin and more

Brew

http://brew.sh/

brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
@remcotolsma
remcotolsma / functions.php
Last active July 19, 2023 12:27
Customize order of Restrict Content Pro gateways.
<?php
add_filter(
'rcp_payment_gateways',
function( $gateways ) {
$order = [
'pronamic_pay_credit_card' => 0,
'pronamic_pay_direct_debit' => 1,
];
@remcotolsma
remcotolsma / test-1.html
Created July 13, 2023 08:05
Lotame tag test.
<link rel="preconnect" href="https://tags.crwdcntrl.net">
<link rel="preconnect" href="https://bcp.crwdcntrl.net">
<link rel="dns-prefetch" href="https://tags.crwdcntrl.net">
<link rel="dns-prefetch" href="https://bcp.crwdcntrl.net">
<script>
! function() {
var lotameClientId = '17301';
var lotameTagInput = {
data: {},
@remcotolsma
remcotolsma / pronamic-pay-select-change-last-subscription-phase-amount.sql
Created March 31, 2023 12:56
Pronamic Pay database queries to change the last subscription phase amount.
SELECT
post.ID AS post_id,
post.post_date,
post.post_content->>'$.source.key' AS source_key,
-- The '200' value represents the new amount.
JSON_REPLACE( post.post_content, '$.phases[last].amount.value', '200' ) AS post_content
FROM
wp_posts AS post
WHERE
post.post_type = 'pronamic_pay_subscr'
@remcotolsma
remcotolsma / gist:5884430
Last active February 23, 2023 01:27
Gravity Forms calculate number days between 2 date fields
<script type="text/javascript">
jQuery( document ).ready( function( $ ) {
var ms_one_day = 1000 * 60 * 60 * 24;
var form_id = '1';
var date_format = 'dd-mm-yy';
var field_date_start = $( '#input_' + form_id + '_1' );
var field_date_end = $( '#input_' + form_id + '_2' );
@remcotolsma
remcotolsma / functions.php
Created December 8, 2022 08:12
Combine WooCommerce order meta data in one meta data field.
<?php
add_action(
'woocommerce_after_order_object_save',
function( $order ) {
$data = [
$order->get_meta( 'meta 1' ),
$order->get_meta( 'meta 2' ),
$order->get_meta( 'meta 3' ),
$order->get_meta( 'meta 4' ),
@remcotolsma
remcotolsma / gravityforms-unique.php
Last active March 31, 2022 07:54
Gravity Forms check on unique email and categoryf field.
<?php
/**
* Hooks into the "gform_validation" filter to test whether or not a new lead is a duplicate of another lead
* based upon their fields.
*
* @param mixed $validation_result
*
* @return mixed $validation_result
*/
@remcotolsma
remcotolsma / index.php
Last active August 23, 2021 11:38
WordPress query loop in multiple Bootstrap columns and rows
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>FITsociety</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
@remcotolsma
remcotolsma / functions.php
Last active August 18, 2021 14:30
Extend Formidable Forms entries list with Pronamic Pay payment info/status.
<?php
/**
* Formidable Forms.
*
* @link https://github.com/Strategy11/formidable-forms/blob/v5.0.01/classes/controllers/FrmEntriesController.php#L31
* @link https://github.com/Strategy11/formidable-forms/blob/v5.0.01/classes/helpers/FrmEntriesListHelper.php#L289-L293
*/
$screen = 'formidable_page_formidable-entries';
@remcotolsma
remcotolsma / index.php
Created August 6, 2021 13:40
Display Pronamic Pay subscriptions that require follow-up payment
<?php
define( 'WP_USE_THEMES', false );
require '../wp-blog-header.php';
$args = array(
'post_type' => 'pronamic_pay_subscr',
'nopaging' => true,
'orderby' => 'post_date',