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 / aatherapy_pmprorh_init.php
Created Sep 24, 2019
Register Helper Custom Fields for aatherapy.org
View aatherapy_pmprorh_init.php
<?php
// Register Helper Custom Fields for PMPro
function aatherapy_pmprorh_init() {
//don't break if Register Helper is not loaded
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) {
return false;
}
//define the fields
$fields = array();
@kimcoleman
kimcoleman / my_pmpro_checkout_level_extend_memberships.php By default PMPro will only "extend" a membership level if you checkout for the same level. This code will make it so PMPro extends any expiring level with any new expiring level. E.g. if you change from a annual plan to a monthly plan it will add 30 days to the end of your existing membership.
View my_pmpro_checkout_level_extend_memberships.php
<?php
/*
If checking out for ANY level with an expiration, add remaining days to the enddate.
Pulled in from: https://gist.github.com/3678054
*/
function my_pmpro_checkout_level_extend_memberships($level)
{
global $pmpro_msg, $pmpro_msgt, $current_user;
//does this level expire? are they an existing members with an expiration date?
@kimcoleman
kimcoleman / teae_duplicate_usermeta_to_xprofile.php
Created Sep 9, 2019
Duplicate TEAE usermeta fields to xProfile Fields
View teae_duplicate_usermeta_to_xprofile.php
<?php
/**
* Duplicate TEAE usermeta fields to xProfile Fields
*
*/
function teae_duplicate_usermeta_to_xprofile( ) {
global $wpdb;
$fields = array(
'alternate_phone'=>'261',
'body_number_(jal/sal)_1'=>'205',
@kimcoleman
kimcoleman / my_restricted_pages_require_user_login.php
Last active Sep 9, 2019
Restrict specific pages in your WordPress site for logged in users only.
View my_restricted_pages_require_user_login.php
<?php
/**
* Restrict specific pages in your WordPress site for logged in users only.
*
*/
function my_restricted_pages_require_user_login() {
global $current_user;
// Allow logged in users.
if ( is_user_logged_in() ) {
@kimcoleman
kimcoleman / my_pmpro_pages_shortcode_account.php
Created Sep 5, 2019
Use a custom Membership Account Page template with PMPro.
View my_pmpro_pages_shortcode_account.php
<?php
/**
* Use a custom Membership Account Page template with PMPro.
*
*/
function my_pmpro_pages_shortcode_account( $content ) {
ob_start();
include( plugin_dir_path(__FILE__) . 'templates/account.php' );
$temp_content = ob_get_contents();
ob_end_clean();
@kimcoleman
kimcoleman / redirect_bbpress_no_access_levels_page.php
Created Aug 30, 2019
Redirect users without access to a single bbPress forum to the Membership Levels page.
View redirect_bbpress_no_access_levels_page.php
<?php
/**
* Redirect users without access to a single bbPress forum to the Membership Levels page.
*
*/
function redirect_bbpress_no_access_levels_page( $redirect_to, $forum_id ) {
global $pmpro_pages;
$redirect_to = get_permalink( $pmpro_pages['levels'] );
@kimcoleman
kimcoleman / my_require_user_login.php
Created Aug 29, 2019
Restrict your WordPress site for logged in users only.
View my_require_user_login.php
<?php
/**
* Restrict your WordPress site for logged in users only.
*
*/
function my_require_user_login() {
global $current_user;
// Allow logged in users.
if ( is_user_logged_in() ) {
@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
You can’t perform that action at this time.