Skip to content

Instantly share code, notes, and snippets.

Jason Coleman ideadude

View GitHub Profile
@ideadude
ideadude / my_update_pmpro_stripe_statement_descriptor.php
Last active Aug 4, 2020
Change the statement descriptor for Stripe charges and subscriptions.
View my_update_pmpro_stripe_statement_descriptor.php
<?php
/**
* Change the statement descriptor for Stripe charges and subscriptions.
* This is the message shown on the customer's credit card statement.
* Must contain at least one letter, 22 characters max.
*
* Requires PMPro 2.4.1+
*
* Note: If your descriptor includes invalid characters or
* more than 22 chacters, checkout will fail.
@ideadude
ideadude / my_pmpro_show_cvv.php
Created Jul 13, 2020
Remove CVV from the checkout page and don't require it.
View my_pmpro_show_cvv.php
<?php
/**
* Remove CVV from the checkout page and don't require it.
*/
// Removes the field from the checkout page.
function my_pmpro_show_cvv( $show ) {
return false;
}
add_filter( 'pmpro_show_cvv', 'my_pmpro_show_cvv' );
@ideadude
ideadude / my_pmpro_member_number_field.php
Last active Jul 13, 2020
Add a "member_number" field that only admins can edit using PMPro and Register Helper.
View my_pmpro_member_number_field.php
<?php
/**
* Add a "member_number" field that only admins can edit.
* Make sure PMPro and the Register Helper Add On are active.
* Copy this code into a Code Snippet or custom plugin.
*/
function my_pmpro_member_number_field() {
// Don't break if Register Helper is not loaded.
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) {
return false;
@ideadude
ideadude / shareasale_pmpro_affiliates.html
Created Jul 13, 2020
Share a Sale Tracking Code to use with PMPro Affiliates.
View shareasale_pmpro_affiliates.html
<img id='_SHRSL_img_1' src='https://www.shareasale.com/sale.cfm?tracking=!!ORDER_ID!!&amount=!!ORDER_AMOUNT!!&merchantID=XXXXX&transtype=sale' width='1' height='1'>
<script src='https://www.dwin1.com/19038.js' type='text/javascript' defer='defer'></script>
@ideadude
ideadude / pmprorh-init-buddypress-fields.php
Created Jul 2, 2020 — forked from pbrocks/pmprorh-init-buddypress-fields.php
Example of defining PMPro Register Helper Fields Synchronized to BuddyPress XProfile Fields
View pmprorh-init-buddypress-fields.php
<?php
/**
* Based on the Register Helper example.
* We've added a "buddypress" option for each field
* set to the XProfile name we used when setting up
* the fields in the BuddyPress extended profile.
* If the PMPro BuddyPress Add On is activated
* then the fields will be synchronized.
* Register Helper: https://www.paidmembershipspro.com/add-ons/pmpro-register-helper-add-checkout-and-profile-fields/
* PMPro BuddyPress: https://www.paidmembershipspro.com/add-ons/buddypress-integration/
@ideadude
ideadude / my_pmprowoo_is_purchasable.php
Created Jul 1, 2020
Change the default PMPro WooCommerce bahavior and make membership products not purchasable if a user already has any other membership level.
View my_pmprowoo_is_purchasable.php
<?php
/**
* Change the default PMPro WooCommerce bahavior
* and make membership products not purchasable
* if a user already has any other membership level.
*/
// First disable the core PMPro WC callaback and set up our own.
function my_pmprowoo_init() {
remove_filter( 'woocommerce_is_purchasable', 'pmprowoo_is_purchasable', 10, 2 );
add_filter( 'woocommerce_is_purchasable', 'my_pmprowoo_is_purchasable', 5, 2 );
@ideadude
ideadude / my_fix_wpelogin.php
Created Jun 29, 2020
Make sure to add the wpe-login parameter to the lostpassword URL.
View my_fix_wpelogin.php
<?php
/**
* Make sure to add the wpe-login parameter to the lostpassword URL.
*/
function my_fix_wpelogin( $url ) {
$url = add_query_arg( 'wpe-login', true, $url );
return $url;
}
add_filter( 'lostpassword_url', 'my_fix_wpelogin' );
@ideadude
ideadude / my_amlbofat_save_function.php
Created Jun 29, 2020
Assign additional membership levels based on fields at checkout.
View my_amlbofat_save_function.php
<?php
/**
* Assign additional membership levels based on fields at checkout.
* Requires PMPro, PMPro MMPU, and PMPro Register Helper.
* This is just an example. Be sure to change the field settings,
* field meta name, and membership levels to fit your needs.
*/
// Add a checkbox via Register Helper
function my_amlbofat_add_fields() {
@ideadude
ideadude / PMPRO_LICENSE_NAG.php
Created Jun 18, 2020
Disable the PMPro license nag.
View PMPRO_LICENSE_NAG.php
<?php
// Add this to your wp-config.php file.
define('PMPRO_LICENSE_NAG', false);
@ideadude
ideadude / pmpro_required_fields.css
Created Jun 11, 2020
CSS to show the word "Required" next to the asterisks on the checkout form.
View pmpro_required_fields.css
span.pmpro_asterisk:after { content: "Required" }
You can’t perform that action at this time.