Skip to content

Instantly share code, notes, and snippets.

View MaryOJob's full-sized avatar
🏠
Working remotely 😈

Mary Job MaryOJob

🏠
Working remotely 😈
View GitHub Profile
<?php //do not copy
/**
* This recipe will provide a basic implementation of the hCAPTCHA library on the checkout page.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
@kimwhite
kimwhite / my-pmpro-manager-admin-bar.php
Last active June 16, 2023 11:30
Allow Manager Role to see Admin Bar when using WooCommerce
<?php // do not copy this line.
/**
* When using WooCommerce and our Manager Role Add On, this will allow our Manager role to see the Admin Bar
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
<?php //do not copy
/**
* This recipe will add a 'Commission' column to the Affiliate, Report and CSV Export tables
*
* Note, change the value of $pmpro_affiliate_rate to your preferred commission rate.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
@kimwhite
kimwhite / my-pmpro-addon-package-access.php
Last active January 25, 2022 14:25
Give access to specific Addon Packages by Level
<?php // do not copy this line.
/**
* Give user's with a certain level ID 4 free access to all some Addon Packages content.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
@kimwhite
kimwhite / generate_member_number.php
Last active December 5, 2022 19:22 — forked from strangerstudios/generate_member_number.php
Code to generate incremental Member Number values for PMPro users/members.
<?php // do not copy this line.
/**
* This recipe creates Member Numbers
* Change the generate_member_number function if your member number needs to be in a certain format.
* Member numbers are generated when users are registered or when the membership account page is accessed for the first time.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
@ipokkel
ipokkel / block-restricted-email-addresses-pmpro-registration-checks.php
Created January 12, 2022 06:24
Block restricted specific email addresses from checking out for a membership.
<?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 block_restricted_email_addresses_pmpro_registration_checks( $value ) {
// set array of restricted email addresses.
@ipokkel
ipokkel / my-pmprorh-extra-fields-admin-email.php
Last active June 27, 2023 12:39
Add Register Helper fields to the admin checkout notification email.
<?php
/**
* Add Custom Registration Fields and their values to the Admin Checkout Notification Email.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
@andrewlimaza
andrewlimaza / prorate-pmpro-based-on-initial-payment.php
Created January 5, 2022 10:45
Prorate Paid Memberships Pro Checkouts based on initial payments only.
<?php
/**
* Prorate initial payments (only) for Paid Memberships Pro checkouts.
* This will prorate for any active members changing levels. If the level is the same price, it does not prorate to $0.
* If a member is 'downgrading' levels, set the price to $0. (i.e. $10 -> $5 level will set the initial payment to $0).
*
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function pmpro_prorate_levels_price( $level ) {
<?php //do not copy
/**
* This recipe unpublish all of a members posts after their membership has expired.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
@andrewlimaza
andrewlimaza / qr-code-pmpro-example.php
Last active May 11, 2022 13:26
QR Code example to return membership information.
<?php
/**
* Returns membership information when scanning QR Code on Membership Card Add On.
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_qr_code_example( $member, $option ){
if ( $option == 'other' ){