Skip to content

Instantly share code, notes, and snippets.

Avatar

Jason Coleman ideadude

View GitHub Profile
@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 / pmpro-customizations.php
Last active Mar 11, 2020 — forked from strangerstudios/pmpro-customizations.php
Tax solution for British Columbia, Canada to be used with Paid Memberships Pro
View pmpro-customizations.php
<?php
/*
Plugin Name: PMPro Customizations
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Customizations for PMPro
Version: .2
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
/*
@ideadude
ideadude / directory.php
Created Jan 17, 2020 — forked from greathmaster/directory.php
Custom directory template. Alphabetical last name search, and meta key/value search.
View directory.php
<?php
/*
Custom directory template. Adds alphabetical last name query. For example you can use the URL:
http://www.example.com/membership-account/directory/?lt=A
if you want all the members with last names starting with 'A'.
Also includes meta key/value search. For example you can use the URL:
@ideadude
ideadude / my_init_membership_level_translate.php
Last active Dec 3, 2019 — forked from strangerstudios/my_init_membership_level_translate.php
Translate Membership Level Names and Descriptions with Paid Memberships Pro
View my_init_membership_level_translate.php
<?php
/*
* Filter membership level names and descriptions for translating.
*
* Add this code to a custom plugin or your active theme's functions.php file.
* Be sure to update the $pmpro_translated_levels array. Add a sub array for each locale.
* The sub array keys should be the membership level ids,
* and values should be an array with the name and description to translate to.
*
*/
@ideadude
ideadude / my_pmproec_after_validate_user.php
Last active Jul 4, 2019 — forked from strangerstudios/my_pmproec_after_validate_user.php
Redirect to the membership account page instead of the home page after email validation with the PMPro Email Confirmation add on.
View my_pmproec_after_validate_user.php
/**
* Redirect to the membership account page instead of the home page after email validation with the PMPro Email Confirmation add on.
* Add this code to a custom WordPress plugin. https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmproec_after_validate_user() {
if( is_user_logged_in() ) {
wp_safe_redirect( '/membership-account/' );
} else {
wp_safe_redirect( wp_login_url( '/membership-account/' ) );
}
@ideadude
ideadude / tids_transaction_ids.php
Created Jun 5, 2019 — forked from strangerstudios/tids_transaction_ids.php
Show and Search By Payment/Subscription Transaction IDs with Paid Memberships Pro
View tids_transaction_ids.php
<?php
/*
Payment/Subscription Transaction IDs Code
Add to your active theme's functions.php or a custom plugin.
*/
//Add Transaction IDs to Members List
function tids_pmpro_memberslist_extra_cols_header($theusers)
{
?>
@ideadude
ideadude / my_pmpro_registration_checks_restrict_email_addresses.php
Last active Apr 24, 2019 — forked from strangerstudios/my_pmpro_checkout_restrict_email_domain.php
Restrict Membership Signup by Email Domain (Useful for Education, Corporate, or Association Memberships)
View my_pmpro_registration_checks_restrict_email_addresses.php
<?php
/**
* Restrict Membership Signup by Email Domain
* Make sure to edit the $valid_domains array defined further below
* to include only the domains you'd like to allow.
*
* Add this code to a custom plugin. More info: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_registration_checks_restrict_email_addresses( $value ) {
$email = $_REQUEST['bemail'];
@ideadude
ideadude / my_pmpro_after_change_membership_level.php
Last active Mar 21, 2019 — forked from strangerstudios/my_pmpro_after_change_membership_level.php
Only allow users to use the trial level once with Paid Memberships Pro.
View my_pmpro_after_change_membership_level.php
<?php
/*
Only allow users to use the trial level once.
Add this code to your active theme's functions.php
or a custom plugin.
Be sure to change the $trial_level_id variable in multiple places.
*/
//get trial level ids
function my_pmpro_trial_level_ids() {
// edit this to be a comma separated list of your trial level ids
@ideadude
ideadude / pmpro-cpt.php
Last active Jul 22, 2020 — forked from strangerstudios/pmpro-cpt.php
Add the PMPro meta box to a CPT. Add this to your plugin/etc.
View pmpro-cpt.php
<?php
/**
* Add the PMPro meta box to a CPT
*/
function my_add_pmpro_meta_box_to_cpts() {
// Duplicate this row for each CPT. This one adds the meta boxes to 'product' CPTs.
add_meta_box('pmpro_page_meta', 'Require Membership', 'pmpro_page_meta', 'product', 'side' );
}
add_action( 'admin_menu', 'my_add_pmpro_meta_box_to_cpts', 20 );
@ideadude
ideadude / pmpro_loadTemplate_example.php
Last active Sep 20, 2018 — forked from strangerstudios/pmpro_loadTemplate_example.php
Example of a shortcode that uses pmpro_loadTemplate to grab it's template file.
View pmpro_loadTemplate_example.php
<?php
/*
[my_pmpro_addon] shortcode.
*/
function my_pmpro_addon_shortcode() {
//load template
$content = pmpro_loadTemplate( 'my_pmpro_addon' ); //will look for /wp-content/themes/your-theme/paid-memberships-pro/pages/my_pmpro_addon.php
//maybe tweak the content a bit
You can’t perform that action at this time.