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 / 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 / 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 / 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',
@remcotolsma
remcotolsma / search-wp-hooks.sh
Created April 13, 2021 09:02
Quick search your project file for WordPress filters and actions.
grep --recursive --include="*.php" --exclude-dir={bower_components,deploy,node_modules,vendor,wordpress,wp-content} --ignore-case "apply_filters" .
grep --recursive --include="*.php" --exclude-dir={bower_components,deploy,node_modules,vendor,wordpress,wp-content} --ignore-case "do_action" .
@remcotolsma
remcotolsma / single-vacancy.php
Created March 17, 2021 10:56
Pronamic WordPress EasyCruit plugin display vacancy appetizer
<?php
$vacancy_appetizer = '';
$xml_string = \simplexml_load_string( \get_post_meta( \get_the_ID(), '_easycruit_vacancy_xml', true ) );
if ( ! empty( $xml_string ) ) {
$vacancy_appetizer = \strval( $xml_string->Versions->Version->Appetizer );
}
@remcotolsma
remcotolsma / orbis-query-companies-number-hosting-subscriptions.sql
Last active November 27, 2020 09:07
Query companies and the number of hosting subscriptions and users.
SELECT
company.name,
company_subscriptions.number_support_subbscriptions,
company_users.number_company_users
FROM
orbis_companies AS company
LEFT JOIN
(
SELECT
subscription.company_id,
@remcotolsma
remcotolsma / orbis-query-subscriptions-over-50-quota.sql
Last active July 14, 2020 13:32
Query subscriptions over 50% time quota.
SELECT
company.id AS company_id,
company.name AS company_name,
subscription.id AS subscription_id,
subscription.name AS subscription_name,
product.id AS product_id,
product.name AS product_name,
product.time_per_year,
SUM( timesheet.number_seconds ) AS registered_time,
100 / product.time_per_year * SUM( timesheet.number_seconds ) AS time_percentage,