Skip to content

Instantly share code, notes, and snippets.

View kimcoleman's full-sized avatar

Kim Coleman kimcoleman

View GitHub Profile
@kimcoleman
kimcoleman / simple_checkout_name_email_only_signup.php
Last active October 19, 2022 08:46
Only require First Name, Last Name and Email address - works best for Free membership checkouts and when your paid checkout does not require Billing Address.
<?php
/**
* Only require First Name, Last Name and Email address to create user.
* This recipe requires Paid Memberships Pro and the Register Helper Add On.
*/
/**
* Hide the Account Information Section
*/
function simple_checkout_hide_account_information_section( $skip_account_fields, $current_user ) {
@kimcoleman
kimcoleman / coursecats_pmpro_login_redirect_url.php
Created March 26, 2019 18:04
Redirect members after login to 'dashboard' page slug or custom page as defined by Advanced Custom Fields.
<?php
/*
* Redirect members after login to 'dashboard' page slug or custom page as defined by ACF.
*/
function coursecats_pmpro_login_redirect_url( $redirect_to, $request, $user ) {
// If logged in and a member, redirect them.
if ( ! empty( $user->ID ) && function_exists( 'pmpro_hasMembershipLevel' ) && pmpro_hasMembershipLevel( NULL, $user->ID ) ) {
$pmp_login_redirect_permalink = "dashboard";
@kimcoleman
kimcoleman / memberlite_sass_classes.scss
Created April 15, 2019 15:25
Starter move to use Sass for Memberlite in place of header <style> tag.
/* Named colors are accessed from theme mods and selectors from "memberlite_defaults" global */
$bgcolor_site_navigation_elements {
background: $bgcolor_site_navigation;
}
$color_site_navigation_elements {
color: $color_site_navigation;
}
$color_link_color_elements {
@kimcoleman
kimcoleman / pmpro_two_column_checkout_sections.php
Created April 18, 2019 13:59
Add some divs to create 2 columns for Billing Address and Payment Information Fields at membership checkout.
<?php
/**
* Add some divs to create 2 columns for Billing Address and Payment Information Fields at membership checkout.
*/
function pmpro_checkout_columns_divs_after_user_fields() {
echo '<div class="row"><div class="medium-6 columns">';
}
add_action( 'pmpro_checkout_after_user_fields', 'pmpro_checkout_columns_divs_after_user_fields', 1 );
@kimcoleman
kimcoleman / pmpro_checkout_columns_for_movedo_theme.php
Last active April 23, 2019 15:55
For Movedo theme: Add some divs to create 2 columns for Billing Address and Payment Information Fields at membership checkout.
<?php
/**
* Add some divs to create 2 columns for Billing Address and Payment Information Fields at membership checkout.
*/
function pmpro_checkout_columns_divs_after_user_fields() {
echo '<div class="grve-row"><div class="grve-column wpb_column grve-column-1-2">';
}
add_action( 'pmpro_checkout_after_user_fields', 'pmpro_checkout_columns_divs_after_user_fields', 1 );
@kimcoleman
kimcoleman / grace_period_discount_pmpro_checkout_level.php
Last active October 27, 2020 03:11
Allow members to renew at a discounted rate if they have expired within 3 months.
<?php
/*
* Allow members to renew at a discounted rate if they have expired within 3 months.
*
*/
/*
* Allow members to renew at a discounted rate if they have expired within 3 months.
*
*/
function grace_period_discount_pmpro_checkout_level( $level ) {
@kimcoleman
kimcoleman / custom_member_badges_fields.php
Last active April 19, 2019 14:57
Creates custom fields for admins to assign member "badge" icons. Display these icon badges on the Profile page.
<?php
/**
* Creates custom fields for admins to assign member "badge" icons. Display these icon badges on the Profile page.
*
* Include this custom CSS to display the icons on the member's frontend Profile page:
* https://gist.github.com/kimcoleman/83f8d089ae35fd9d4cc05cb11fd66e79
*
*/
function custom_member_badges_fields() {
@kimcoleman
kimcoleman / custom_member_badges_fields.css
Created April 19, 2019 14:57
Custom CSS to display Register Helper checkbox fields as Font Awesome Icons on the Profile page.
/* Custom CSS to pair with this recipe: https://gist.github.com/kimcoleman/391a537ffabf1d2f0c3027e988b291ea */
<style>
.pmpro_member_directory_php_developer,
.pmpro_member_directory_javascript_developer,
.pmpro_member_directory_mysql_developer {
display: inline-block;
padding: 15px;
font-size: 0;
}
.pmpro_member_directory_php_developer strong:after,
@kimcoleman
kimcoleman / my_pmpro_authorizenet_post_url.php
Last active April 7, 2021 03:54 — forked from strangerstudios/my_pmpro_authorizenet_post_url.php
Point the Authorize.net integration to a different end point (e.g. to use an Authorize.net mirror API)
<?php
/*
* Point the Authorize.net integration for PMPro to a different end point (e.g. to use an Authorize.net mirror API)
*
*/
function my_pmpro_authorizenet_post_url( $url, $environment ) {
if ($environment == "sandbox") {
$url = 'https://domain.com/path-to-the-sandbox-endpoint/';
} else {
$url = 'https://domain.com/path-to-the-live-endpoint/';
@kimcoleman
kimcoleman / restrict_gallery_cpt_level_3.sql
Last active March 29, 2021 02:59
Example SQL to add restriction on CPT 'gallery' for Level ID 3