Skip to content

Instantly share code, notes, and snippets.

View kimcoleman's full-sized avatar

Kim Coleman kimcoleman

View GitHub Profile
@kimcoleman
kimcoleman / pmpro-sponsored-members-assign-to-parent.php
Last active May 1, 2024 18:07 — forked from greathmaster/pmpro-sponsored-members-assign-to-parent.php
Retroactively assign a user to a Parent account when using the Sponsored Members Add On.
/**
* Retroactively assign a user to a Parent account when using the Sponsored Members Add On.
* Enter the user ID of parent account in the "Assign to Parent Account" on the "Edit Profile" screen.
*
* Note: The user's active Membership Level must be the correct "Child" level for that Parent/Child relationship.
*
*/
function pmprosm_assign_child_members( $profileuser ) {
if ( function_exists( 'pmprosm_getSponsor' ) && current_user_can( 'edit_users' ) ) {
<?php //Do not copy this PHP tag into your code.
/**
* Define groups of levels and allow members to select from both levels at checkout.
* Useful for offering multiple pricing structures for membership (i.e. Monthly, Annually)
*
* Add this code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
// Define the groups of levels. array(1,2) means that levels 1 and 2 are in a group and options will be shown for both levels at checkout for those levels.
global $pmpro_level_groups;
@kimcoleman
kimcoleman / pmpro_show_spots_available.php
Last active April 12, 2024 06:54 — forked from andrewlimaza/pmpro_show_spots_available.php
Show number of spots available for a membership level Paid Memberships Pro.
<?php
/**
* This will show '0/X spots available.' on membership level if a limit is set from (https://www.paidmembershipspro.com/limit-number-members-membership-level/)
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* For help, post a support thread on www.paidmembershipspro.com
*/
function pmpro_show_spots_available( $expiration_text, $level ) {
global $wpdb;
@kimcoleman
kimcoleman / pmpro-tag-delete-inactive-users.php
Last active October 31, 2023 12:06 — forked from ideadude/tag_and_delete_inactive_users.php
Script to tag and delete inactive PMPro Members and users from WordPress.
<?php
/**
* Script to locate, tag, export, then delete inactive users in your Paid Memberships Pro / WordPress website.
*
* Once this snippet is in the site, admins can run the process by visiting /?delete_inactive_users=1 in the WordPress admin.
* Always back up user data before running any bulk delete script and remove this code after the process is done.
*/
function my_pmpro_tag_inactive_users() {
if ( ! defined( 'PMPRO_VERSION' ) ) {
exit;
@kimcoleman
kimcoleman / add-credit-card-image-to-checkout.php
Last active October 12, 2023 20:10 — forked from andrewlimaza/add-credit-card-image-to-checkout.php
Display credit card logos before the submit button on the Paid Memberships Pro Membership Checkout page.
<?php
/**
* Display credit card logos before the submit button on the Paid Memberships Pro Membership Checkout page.
*
* Download the icons from https://www.paidmembershipspro.com/add-credit-card-and-paypal-logos-to-checkout/
* Place the image file in the correct location according to your customizations structure.
*/
function pmpro_add_my_logos_to_checkout(){
global $pmpro_level;
@kimcoleman
kimcoleman / my_pmpro_payment_method.css
Last active October 12, 2023 19:48 — forked from strangerstudios/my_pmpro_payment_method.css
Adds credit card logos and a PayPal logo to the "Select Payment Method" box on membership checkout.
/* CSS Document */
#pmpro_payment_method span a {
background-position: left bottom;
background-size: contain;
background-repeat: no-repeat;
display: inline-block;
margin-left: 1%;
max-width: 300px;
padding-bottom: 60px;
text-align: left;
@kimcoleman
kimcoleman / pmpro-expire-soon-banner.php
Last active July 17, 2023 13:22 — forked from travislima/pmpro-expire-soon-banner.php
Create a banner that will display a message to soon to be expiring members
<?php
/**
* This code will display a renewal reminder notification banner at the top of your website for members whose membership
* level will expire within 7 days of the date they visit your site.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Note: When adding to your Customizations Plugin, be careful not to include the opening php tag on line 1 above.
*/
function pmpro_show_banner_renewal_message() {
global $pmpro_pages;
@kimcoleman
kimcoleman / memberlite-banner-expiration-notification.php
Last active July 17, 2023 13:20 — forked from travislima/memberlite-banner-expiration-notification.php
Display a banner that notifies users about their upcoming expiration - Memberlite method.
<?php
/**
* This code will display a renewal reminder notification banner at the top of your website for members whose membership
* level will expire within 7 days of the date they visit your site.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Note: When adding to your Customizations Plugin, be careful not to include the opening php tag on line 1 above.
*/
function memberlite_show_banner_renewal_message(){
global $pmpro_pages;
@kimcoleman
kimcoleman / my_pmpro_member_links.php
Last active April 10, 2023 12:51 — forked from strangerstudios/my_pmpro_member_links
Example of how to add links to the Member Links list on the Membership Account page.
@kimcoleman
kimcoleman / hide-confirm-email-password.php
Last active October 19, 2022 18:25 — forked from strangerstudios/gist:4027538
Hide the confirm email and confirm password fields from the Paid Memberships Pro checkout page.
<?php
/*
* Don't show confirm password or email fields 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/
*/
add_filter( 'pmpro_checkout_confirm_password', '__return_false' );