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
Created October 9, 2019 19:29
Update Gravity Forms currency EUR.
<?php
/**
* Update Gravity Forms currency EUR.
*
* @link https://www.pronamic.nl/2012/04/gravity-forms-euro-teken-voor-bedrag/
* @link https://docs.gravityforms.com/gform_currencies/#1-update-euro
*/
\add_filter(
'gform_currencies',
@remcotolsma
remcotolsma / test.php
Created August 29, 2019 14:20
Providers and slots GEO query WordPress.
<?php
$providers_query = new WP_Query(
array(
'post_type' => 'provider',
'tax_query' => array(
array(
'taxonomy' => 'country',
'field' => 'slug',
'terms' => 'nl',
@remcotolsma
remcotolsma / index.php
Created July 31, 2019 08:55
Holiday Media widgets test WordPress
<?php
define( 'WP_USE_THEMES', false );
require '../wp-blog-header.php';
/**
* Holiday Media.
*
* @link https://gitlab.com/pronamic-plugins/holiday-media-booking-widget/blob/develop/holiday-media-booking-widget.php
@remcotolsma
remcotolsma / rcp-update-2-to-3-fixer.php
Last active July 23, 2019 09:09
Restrict Content Pro update 2 to 3 fixer
<?php
define( 'WP_USE_THEMES', false );
require '../../../../wp-blog-header.php';
global $wpdb;
$query = new WP_Query(
array(
@remcotolsma
remcotolsma / lookup-query-henk.sql
Last active June 12, 2019 12:54
Lookup query Henk.
SELECT
t.*,
d.*
FROM
(
SELECT
`company_code`,
`company_name` as `CompanyName`,
`period_start_date` as `Begindatum`,
`period_end_date` as `Einddatum`,
@remcotolsma
remcotolsma / dita-addresses-to-json.php
Created May 21, 2019 09:55
Dita adresses to JSON
<?php
$addresses = array();
foreach ( $data as $item ) {
$addresses[] = (object) array(
'company' => 'First Company',
'address' => 'First Address',
'city' => 'First City',
'postcode' => 'First Postal',
@remcotolsma
remcotolsma / tbs-posts-accommodation-ids.sql
Created February 8, 2019 10:24
Tommy Booking Support WordPress posts accommodation ID's.
SELECT
wp_posts.ID,
wp_posts.post_title,
wp_postmeta.meta_value
FROM
wp_posts
LEFT JOIN
wp_postmeta
ON (
wp_posts.ID = wp_postmeta.post_id
@remcotolsma
remcotolsma / index.php
Created January 28, 2019 09:10
Check if all files within a range are in a directory.
<?php
global $argv;
$dir = __DIR__;
if ( isset( $argv[1] ) ) {
$dir = $argv[1];
}
@remcotolsma
remcotolsma / functions.php
Last active January 25, 2019 15:00
WordPress query to retrieve active Pronamic Pay subscriptions for current user.
<?php
/**
* WordPress query to retrieve active Pronamic Pay subscriptions for current user.
*
* @link https://github.com/ApiGen/ApiGen
* @link https://github.com/woocommerce/woocommerce/wiki/wc_get_orders-and-WC_Order_Query
* @link https://github.com/woocommerce/woocommerce/wiki/wc_get_products-and-WC_Product_Query
*/
@remcotolsma
remcotolsma / pronamic-pay-export-payments-gravityforms-entries.sql
Last active January 3, 2019 14:28
Export completed Pronamic Pay payments with Gravity Forms entries.
SELECT
post.ID,
post.post_title,
post.post_date,
post.post_status,
MAX( IF( meta.meta_key = "_pronamic_payment_description", meta.meta_value, NULL ) ) AS payment_description,
MAX( IF( meta.meta_key = "_pronamic_payment_entrance_code", meta.meta_value, NULL ) ) AS payment_entrance_code,
MAX( IF( meta.meta_key = "_pronamic_payment_language", meta.meta_value, NULL ) ) AS payment_language ,
MAX( IF( meta.meta_key = "_pronamic_payment_amount", meta.meta_value, NULL ) ) AS payment_amount,
MAX( IF( meta.meta_key = '_pronamic_payment_currency', meta.meta_value, NULL ) ) AS payment_currency,