Skip to content

Instantly share code, notes, and snippets.

View sc0ttkclark's full-sized avatar
🍕
Working hard reviewing and deploying code

Scott Kingsley Clark sc0ttkclark

🍕
Working hard reviewing and deploying code
View GitHub Profile
@sc0ttkclark
sc0ttkclark / my-pmpro-custom-field-types.php
Last active January 8, 2022 01:26
Register custom field types with Paid Memberships Pro
<?php
/**
* Register custom field types with Paid Memberships Pro.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
@sc0ttkclark
sc0ttkclark / pods-pro-tablepress-customize-labels.php
Created December 8, 2021 03:25
Pods Pro - TablePress Integration - Customize column values using templates with magic tags
<?php
/**
* Customize column values using templates with magic tags
*
* @param array $custom_column_templates The list of custom column templates to be used, with the field name as the key.
* @param string $pod_name The pod name.
* @param Pods $pod The Pods object.
* @param array $params The Pods::find() parameters to be used.
* @param array $table The TablePress information.
@sc0ttkclark
sc0ttkclark / pods-pro-tablepress-customize-labels.php
Last active December 8, 2021 03:23
Pods Pro - TablePress Integration - Customize column labels
<?php
/**
* Customize the TablePress columns to use.
*
* @param array $columns The list of columns to be used.
* @param string $pod_name The pod name.
* @param Pods $pod The Pods object.
* @param array $params The Pods::find() parameters to be used.
* @param array $table The TablePress information.
@sc0ttkclark
sc0ttkclark / prevent-pods-block-preload.php
Created December 6, 2021 20:03
Avoid preloading blocks in the block editor -- this prevents page timeouts with large sets of blocks.
<?php
// Avoid preloading blocks in the block editor -- this prevents page timeouts with large sets of blocks.
add_filter( 'pods_blocks_types_preload_block', '__return_false' );
@sc0ttkclark
sc0ttkclark / php-error.php
Created December 1, 2021 23:57
PHP Error debugging file in WP, to be placed in /wp-content/php-error.php
<?php
echo '<h1>Site PHP Error</h1>';
echo '<h2>Type</h2>';
var_dump( $error['type'] );
echo '<h2>Message</h2>';
echo '<pre>';
@sc0ttkclark
sc0ttkclark / my-pmpro-pods-account-details.php
Last active November 11, 2021 22:57
Show the PMPro Pods fields on the My Membership Account page under the Account Details (Profile) section. This functionality will be unnecessary in a future PMPro Pods Add On vesion.
<?php
/**
* Show the PMPro Pods fields on the My Membership Account page under the Account Details (Profile) section.
*
* This functionality will be unnecessary in a future PMPro Pods Add On vesion.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
@sc0ttkclark
sc0ttkclark / my-pmpro-learnpress-workaround.php
Created November 10, 2021 19:52
Fix LearnPress PMPro Add On compatibility issue with Email Template overrides.
<?php
/**
* Fix LearnPress PMPro Add On compatibility issue with Email Template overrides.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
@sc0ttkclark
sc0ttkclark / my-pmpro-wpgraphql-private-posts.php
Last active November 7, 2021 03:59
Integrate with WPGraphQL to check if the current user has access to certain post types.
<?php
/**
* Integrate with WPGraphQL to check if the current user has access to certain post types.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
@sc0ttkclark
sc0ttkclark / my-pmpro-invite-code-max-usage-1
Created October 28, 2021 18:29
For the Invite Only Add On, set the maximum times a code can be used to only once.
<?php
/**
* For the Invite Only Add On, set the maximum times a code can be used to only once.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
@sc0ttkclark
sc0ttkclark / .htaccess
Last active October 24, 2021 00:54
Handle .php files using the getfile in PMPro integration.
# Add this to your .htaccess code just like the normal getfile.php code.
# Follow instructions here first and then add the line: https://www.paidmembershipspro.com/locking-down-protecting-files-with-pmpro/
RewriteRule ^protected-directory/(.*)$ /wp-content/plugins/paid-memberships-pro/services/getfile.php [L]