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
@kimwhite
kimwhite / my-pmpro-change-seat-text.php
Last active April 24, 2024 17:46
Group Add On Change seat or seats to something else
<?php // do not copy this line.
/**
* This recipe will change the working Seat to what ever you choose
*
* use with Group Account Add On. https://www.paidmembershipspro.com/add-ons/group-accounts/
*
* 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/
@ipokkel
ipokkel / hide-stripe-billing-address-fields.php
Last active April 12, 2024 12:29
Force remove Stripe billing fields on checkout and billing
<?php // Do NOT copy this line
function hide_address_on_billing_update_if_stripe() {
global $pmpro_pages, $gateway;
// Bail if necessary
if ( empty( $pmpro_pages ) || ( ! is_page( $pmpro_pages['checkout'] ) && ! is_page( $pmpro_pages['billing'] ) ) ) {
return;
}
// Filter out Stripe billing fields
if ( ! empty( $gateway ) && 'stripe' === $gateway ) {
@ipokkel
ipokkel / pmpro-restrict-all-cpt-posts.php
Last active March 28, 2024 16:48
Restrict all posts for a custom post type (CPT) automatically with PMPro but allow administrators access to the CPT #cpt #pmpro-cpt
<?php
/**
* This recipe restricts all content of a Custom Post Type (CPT)
* to members only.
*
* This recipe assumes your CPT name is "recipe".
* You should replace this with your CPT name for the filter name
* and the $my_cpt variable's value.
*
* You can add this recipe to your site by creating a custom plugin
@andrewlimaza
andrewlimaza / generate-username-from-email-pmpro.php
Last active March 28, 2024 07:31
Generate a username during checkout for user [Paid Memberships Pro]
<?php
/**
* Generate a username at PMPro checkout from email for users.
* Hide your 'username' field using custom CSS.
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_generate_username_at_checkout() {
// Make sure PMPro is installed and the function to get the level at checkout exists.
@ipokkel
ipokkel / pmpro-reveal-password.php
Last active March 20, 2024 17:54
Toggle the password visibility on PMPro Checkout, Login, and Signup Shortcode pages by clicking on the FontAwesome eye icon to reveal or hide the password.
<?php
/**
* Password visibility toggle with Fontawesome eye icon.
*
* Adds an eye icon which on click reveals the password.
* This also works for the Signup Shortcode Add On.
*
* This code recipe assumes that the Fontawesome font library is already enqueued.
*
* You can add this recipe to your site by creating a custom plugin
@andrewlimaza
andrewlimaza / pmpro-approvals-delete-deny.php
Created February 18, 2022 14:31
Delete User on PMPro Approvals Deny. Delete denied user.
<?php
/**
* Automatically delete user when their approval is denied.
* Add this code to your site by following: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function pmpro_approvals_delete_member_on_deny( $user_id, $level_id ) {
wp_delete_user( $user_id );
}
add_action( 'pmpro_approvals_after_deny_member', 'pmpro_approvals_delete_member_on_deny', 10, 2 );
<?php
/**
* Example of changing the group (location ) to add a user field to.
*
* "$where" locations available on the checkout page are:
* - after_pricing_fields
* - after_username
* - after_password
* - after_email
* - checkout_boxes
@andrewlimaza
andrewlimaza / add-invoice-details-to-email-pmpro.php
Created October 19, 2020 07:00
Add !!invoice_subtotal!! and !!invoice_tax!! to email templates Paid Memberships Pro.
<?php
/**
* This creates two variables !!invoice_subtotal!! and !!invoice_tax!! to email templates where the !!invoice_id!! is available.
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_add_invoice_details_to_email( $data, $email ) {
if ( isset( $data['invoice_id'] ) ) {
$invoice = new MemberOrder($data['invoice_id']);
$data['invoice_subtotal'] = isset( $invoice->subtotal ) ? pmpro_formatPrice( $invoice->subtotal ) : '';
@dparker1005
dparker1005 / checkout_levels_api_demo.php
Last active February 29, 2024 18:06
2 demos to demonstrate the PMPro checkout_levels API call.
<?php
// Copy from below here...
/*
* Add widget to checkout to get result of checkout_levels API call when button is pressed.
*/
function my_pmpro_test_checkout_levels_api() {
?>
<hr/>
<?php
/**
* This recipe will geocode the members based on their user account only.
* Run /wp-admin/?pmpromm_process_users=true to run the script.
*
* 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/
*/