Skip to content

Instantly share code, notes, and snippets.

View ideadude's full-sized avatar

Jason Coleman ideadude

View GitHub Profile
@ideadude
ideadude / my_pmpro_registration_checks_restrict_email_addresses.php
Last active April 2, 2025 06:28 — forked from strangerstudios/my_pmpro_checkout_restrict_email_domain.php
Restrict Membership Signup by Email Domain (Useful for Education, Corporate, or Association Memberships)
<?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 / .gitignore
Created March 27, 2019 11:39
Default .gitignore file for PMPro Add On projects.
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
@ideadude
ideadude / .gitattributes
Created March 27, 2019 11:38
Default .gitattributes file for PMPro add on projects.
# Items to ignore when downloading a zip
.babelrc export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
package-lock.json export-ignore
package.json export-ignore
webpack.config.js export-ignore
@ideadude
ideadude / disable_pmpro_send_html.php
Last active May 25, 2020 08:53
Disable the PHPMailer Code for PMPro
/**
* Disable the custom PHPMailer Code for PMPro.
* This will sometimes fix issues with broken/scrambled emails.
* Add this code to a custom plugin. https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Notice we run on the wp_mail_content_type hook on priority 15 to make sure
* we run after PMPro sets up the hook here: https://github.com/strangerstudios/paid-memberships-pro/blob/dev/includes/email.php#L127-L137
*/
function my_disable_pmpro_send_html() {
remove_action('phpmailer_init', 'pmpro_send_html');
}
@ideadude
ideadude / my_pmpro_after_change_membership_level.php
Last active March 21, 2019 12:51 — forked from strangerstudios/my_pmpro_after_change_membership_level.php
Only allow users to use the trial level once with Paid Memberships Pro.
<?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 / custom_account_page_for_pmpro_and_memberlite.txt
Created February 21, 2019 18:24
Custom account page for PMPro and Memberlite. Copy this into the post body instead of the default [pmpro_account] shortcode.
[row]
[col medium="6"]
[pmpro_account section="profile"]
[/col]
[col medium="6"]
[pmpro_account section="membership"]
[/col]
[/row]
[row]
@ideadude
ideadude / my_require_cvv_for_reals.php
Last active February 15, 2019 13:26
Set CVV as a Required Field with PMPro
/**
* Set CVV as a Required Field with PMPro
* Add this code to a custom plugin. https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*
* NOTE: Doesn't yet work with all gateways.
* You'll need to make sure the gateway is set to require CVV/CVC
* and then add an elseif ( ... ) below to set the $CVV var
* if you see a valid gateway token/etc.
*/
function my_require_cvv_for_reals( $fields ) {
@ideadude
ideadude / pmpro-cpt.php
Last active June 19, 2023 22:43 — forked from strangerstudios/pmpro-cpt.php
Add the PMPro meta box to a CPT. Add this to your plugin/etc.
<?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_xof_currency_format.php
Created February 12, 2019 13:21
Add a XOF currency to Paid Memberships Pro
/**
* Add a XOF currency to Paid Memberships Pro
* Add this code into a custom plugin. https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function pmpro_xof_currency_format( $pmpro_currencies ) {
$pmpro_currencies['XOF'] = array(
'name' => __( 'West African Franc', 'paid-memberships-pro' ),
'decimals' => '2',
'thousands_separator' => ',',
'decimal_separator' => '.',
@ideadude
ideadude / membership_shortcode_login_message.txt
Created January 16, 2019 20:17
Use the PMPro membership shortcode to show a login link to logged out users.
[membership level="0"]
<!--this is shown to non-members and non-logged in visitors-->
<div class="pmpro_message pmpro_alert">
Already a member? Log In to unlock additional membership options.
</div>
[/membership]