Skip to content

Instantly share code, notes, and snippets.

Kim Coleman kimcoleman

Block or report user

Report or block kimcoleman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kimcoleman
kimcoleman / invalid_email_addresses_pmpro_registration_checks.php
Last active Aug 6, 2019
Exclude specific email domains from membership signup.
View invalid_email_addresses_pmpro_registration_checks.php
<?php
/**
* Exclude specific email domains from membership signup.
* Make sure to edit the $invalid_domains array defined further below
* to include only the domains you'd like to block.
*
*/
function invalid_email_addresses_pmpro_registration_checks( $value ) {
$email = $_REQUEST['bemail'];
@kimcoleman
kimcoleman / pmpro_show_spots_available.php
Last active Jul 19, 2019 — forked from andrewlimaza/pmpro_show_spots_available.php
Show number of spots available for a membership level Paid Memberships Pro.
View pmpro_show_spots_available.php
<?php
/**
* This will show '0/X spots available.' on membership level if a limit is set from (https://www.paidmembershipspro.com/limit-number-members-membership-level/)
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* For help, post a support thread on www.paidmembershipspro.com
*/
function pmpro_show_spots_available( $expiration_text, $level ) {
global $wpdb;
@kimcoleman
kimcoleman / simple_checkout_email_only_signup.php
Created Jul 3, 2019
Only require Email Address to create user.
View simple_checkout_email_only_signup.php
<?php
/**
* Only require Email Address to create user.
* This recipe requires Paid Memberships Pro and the Register Helper Add On.
*
* Note: this recipe depends on a future patch to Paid Memberships Pro core plugin in order to function.
*/
/**
* Hide the Account Information Section
@kimcoleman
kimcoleman / simple_paid_checkout_signup.php
Last active Jul 3, 2019
Simplify paid level checkouts by removing Account Information section and generating username and password.
View simple_paid_checkout_signup.php
<?php
/**
* Simplify paid level checkouts by removing Account Information section and generating username and password.
* You must be capturing full Billing Information for this recipe to work.
*/
/**
* Hide the Account Information Section
*/
function simple_checkout_hide_account_information_section( $skip_account_fields, $current_user ) {
@kimcoleman
kimcoleman / one_time_trial_delay_pmpro_registration_checks.php
Last active Jun 21, 2019
Offer one-time trials using the Subscription Delays Add On
View one_time_trial_delay_pmpro_registration_checks.php
/**
* This code stores data when a user checks out for a level.
* If that user tries to checkout for the same level, the Subscription Delay is removed.
* The user is charged for their first subscription payment at checkout.
*
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*
*/
// Record when users gain the trial level.
@kimcoleman
kimcoleman / show_disallowed_level_names_content_filter.php
Created Jun 6, 2019
Reveal the level name for a disallowed level in the PMPro content message on restricted content.
View show_disallowed_level_names_content_filter.php
<?php
/**
* Reveal the level name for a disallowed level in the PMPro content message on restricted content.
*
*/
function show_disallowed_level_names_content_filter( $r, $post_membership_levels_ids, $post_membership_levels_names ) {
return true;
}
add_filter( 'pmpro_membership_content_filter_disallowed_levels', 'show_disallowed_level_names_content_filter', 10, 3 );
@kimcoleman
kimcoleman / hidden_level_content_pmpro_text_filter.php
Created Jun 6, 2019
Show a unique message on content restricted for a hidden membership level.
View hidden_level_content_pmpro_text_filter.php
<?php
/**
* Show a unique message on content restricted for a hidden membership level.
*
*/
function hidden_level_content_pmpro_text_filter( $text ) {
global $post;
$access = pmpro_has_membership_access( $post->ID, NULL, true );
$level_ids = $access[1];
@kimcoleman
kimcoleman / my_pmpro_reports_extras.php
Last active Jun 4, 2019 — forked from strangerstudios/my_pmpro_reports_extras
Add a Custom Report to the Memberships > Reports Screen in Paid Memberships Pro.
View my_pmpro_reports_extras.php
<?php
/**
* Add a Custom Report to the Memberships > Reports Screen in Paid Memberships Pro.
*
* For each report, add a line like:
* global $pmpro_reports;
* $pmpro_reports['slug'] = 'Title';
*
* For each report, also write two functions:
* pmpro_report_{slug}_widget() to show up on the report homepage.
@kimcoleman
kimcoleman / pmproc_create_random_orders.php
Created May 29, 2019
Create random orders across a time period for all active members on your site. Useful for demos.
View pmproc_create_random_orders.php
/**
* Create random orders for all members.
* visit /wp-admin/?create_random_orders=1 to generate orders, then remove this code
* Warning, this can time out or slow your server if you have many members or a long timeframe.
*/
function pmproc_create_random_orders() {
global $wpdb;
if ( empty( $_REQUEST['create_random_orders'] ) ) {
return;
@kimcoleman
kimcoleman / hide_gallery_events_filter_post_types.php
Last active Jun 3, 2019
Hide the 'gallery' CPT from searches and archives if membership is required to access.
View hide_gallery_events_filter_post_types.php
<?php
/**
* Hide the 'gallery' CPT from searches and archives if membership is required to access.
*
*/
function hide_gallery_events_filter_post_types( $post_types ) {
$post_types[] = 'gallery';
return $post_types;
}
add_filter( 'pmpro_search_filter_post_types', 'hide_gallery_events_filter_post_types' );
You can’t perform that action at this time.