Skip to content

Instantly share code, notes, and snippets.

View kimwhite's full-sized avatar

Kim White kimwhite

View GitHub Profile
@kimwhite
kimwhite / pmpro_allow_access_for_admins.php
Last active September 11, 2023 18:31 — forked from andrewlimaza/pmpro_allow_access_for_admins.php
Allow admins, administrator, administrators access to all restricted posts in WordPress with Paid Memberships Pro - when using Divi editor also
<?php
/**
* This code snippet allows Editors without any PMPro membership level to access any restricted content.
* Add this code to your PMPro Customizations plugin -
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function pmmpro_allow_access_for_editors($hasaccess, $mypost, $myuser, $post_membership_levels){
//If user is an admin allow access.
@kimwhite
kimwhite / unset-and-hide-billing-state-field.php
Last active August 9, 2022 20:27 — forked from ipokkel/unset-and-hide-billing-state-field.php
PMPro - Remove state from required billing fields and hide it the state field.
<?php // do not copy this line.
/**
* Remove state and phone from required billing fields and hide it the state field.
*
* 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 / change_text_example.php
Last active August 4, 2022 19:03 — forked from andrewlimaza/change_text_example.php
gettext change level cost text
<?php
<?php // do not copy this line.
/**
* This recipe will change the text "Expiration" to "Renew"
*
* 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 allows you to restrict partial user email addresses during checkout.
* You will be able to specify that all @paidmembershipspro.com email addresses are allowed to sign up, without
* having to enter each user's full email address.
*
* 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 / pmpro-bbpress-addon-package-integration.php
Last active June 21, 2022 21:31 — forked from greathmaster/pmpro-bbpress-addon-package-integration.php
Glue code for PMPro Add On Packages and PMPro bbPress. Allows you to sell access to individual forums by using the PMPro Add On Packages
<?php // do not copy this line.
/**
* This recipe Allows you to sell access to individual forums by using the PMPro Add On Packages
* Please test and make sure this meets your needs.
*
* 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 line.
/**
* Sponsored Members setup with child seat costs at checkout.
* SPONSOR SEAT + 4 seats 19.95 each
* + 5 to 19 @ 17.95
* + 20 to 39 @ $15.95
* + 40 to 79 @ 14.95
*
* 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.
@kimwhite
kimwhite / my_pmpro_registration_checks.php
Last active July 19, 2024 15:25 — forked from strangerstudios/my_pmpro_registration_checks.php
Require a certain level before registering for another level with Paid Memberships Pro.
<?php // do not copy this line.
/**
* This recipe Requires a certain level before registering for another level.
*
* 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/
*
* Edit lines 19,20,33,34 with your site levels. Update message line 22
@kimwhite
kimwhite / pmpro_move_name_fields.php
Created June 1, 2022 13:44 — forked from femiyb/pmpro_move_name_fields.php
Move Name And Last Name fields
<?php
/**
* Add the following code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Move Email And Confirm Email fields before password
*/
function pmpro_move_name_fields() {
global $pmpro_pages;
if(is_page($pmpro_pages['checkout'])) {
@kimwhite
kimwhite / prevent_oembed.php
Last active May 20, 2022 20:35 — forked from dparker1005/prevent_oembed.php
Prevent oembeds from running on a particular page. KEEP Label as url link
<?php
// Copy from below here...
/*
* Prevent oembeds from running on a particular page.
* Can clear oembed cache with steps here: https://siteorigin.com/clearing-oembed-cache/
*/
function my_pmpro_prevent_oembed($result, $url, $args) {
if ( strpos( $_SERVER['REQUEST_URI'] , '/directory/') !== false ) {
@kimwhite
kimwhite / pmpro_set_enddates.sql
Last active May 16, 2022 13:35 — forked from ideadude/pmpro_set_enddates.sql
Set an enddate for active subscriptions with PMPro
# BACKUP FIRST
# This SQL query will set the expiration date
# to 2023-02-01 for ALL active membership including users with active subscriptions who are marked NEVER.
# a different current enddate.
# BACKUP FIRST
UPDATE wp_pmpro_memberships_users
SET enddate = '2023-02-01 00:00:00'
WHERE status = 'active'