Skip to content

Instantly share code, notes, and snippets.

View kimwhite's full-sized avatar

Kim White kimwhite

View GitHub Profile
@kimwhite
kimwhite / pmpro_after_change_author_level_update_posts.php
Last active September 27, 2021 17:44 — forked from strangerstudios/pmpro_after_change_author_level_update_posts.php
Unpublish an author's posts or cpt when their membership is cancelled.
<?php function pmpro_after_change_author_level_update_posts( $level_id, $user_id ) {
//get the user roles
$usermeta = get_userdata($user_id);
$user_roles = $usermeta->roles;
//check if the user is an author and is cancelling
if ( in_array( 'author', $user_roles ) && $level_id == 0 ) {
//get the user's posts
$args = array(
'author' => $user_id,
@kimwhite
kimwhite / pmpro-approvals-custom-message-data.php
Last active September 20, 2021 20:50 — forked from ipokkel/pmpro-approvals-custom-message-data.php
Create a custom message email variable for PMPro Approvals Add On.
<?php
/**
* This recipe adds a custom message per membership level to PMPro_Approvals email data.
*. ADDED - Custom Shortcode to add to Subject Line !!custom_subject!!
* This recipe assumes that the !!custom_approved_message!! variable was added to the
* Approvals - Approved Email template, and
* the !!custom_denied_message!! variable was added to the
* Approvals - Denied Email template.
*
* You can add this recipe to your site by creating a custom plugin
@kimwhite
kimwhite / pmpro-move-company-bililng.php
Last active September 10, 2021 15:27 — forked from ronalfy/pmpro-move-company-bililng.php
Paid Memberships Pro - Move custom Field to Billing
<?php
/**
* Move custom date field above address 1 line.
*/
function pmpro_move_custom_to_billing() {
if ( is_page( 'membership-checkout' ) && wp_script_is( 'jquery', 'done' ) ) {
?>
<script>
jQuery( '#date_of_birth_div' ).prependTo( '.pmpro_checkout-field-baddress1' );
</script>
@kimwhite
kimwhite / change_text_pmpro_card.php
Last active September 2, 2021 17:46 — forked from andrewlimaza/change_text_pmpro_advanced_levels.php
Change text for 'Return To Account' for PMPro Membership Card Page
<?php
/**
* Change text for the Return To Home and Return to Account for PMPro Advanced Levels add-on.
* Add the following code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function pmpro_change_text_for_card( $translated_text, $text, $domain ){
switch ( $translated_text ) {
@kimwhite
kimwhite / my-pmpro-confirmation-url.php
Created September 1, 2021 14:07 — forked from ipokkel/my-pmpro-confirmation-url.php
Redirect certain levels to a custom confirmation page after checkout.
<?php
/**
* This recipe will redirect free level (1) to the levels page after registering
*
* 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/
*/
function my_pmpro_confirmation_url( $url, $user_id, $level ) {
@kimwhite
kimwhite / pmpro-group-discount-order-csv-export.php
Created August 27, 2021 13:27 — forked from greathmaster/pmpro-group-discount-order-csv-export.php
Add the group code column to the Order CSV export
<?php
//Add the group code column to the Order CSV export
//Set up the column header and callback function
function my_pmpro_orders_csv_extra_columns($columns)
{
$columns["group_code"] = "my_extra_order_column_notes";
return $columns;
}
@kimwhite
kimwhite / my_pmprorh_init.php
Last active August 24, 2021 17:03 — forked from ipokkel/my_pmprorh_init.php
Sample RH custom fields
<?php
/*
Plugin Name: PMPro Customizations
Plugin URI: https://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Customizations for my Paid Memberships Pro Setup
Version: .1
Author: Paid Memberships Pro
Author URI: https://www.paidmembershipspro.com
*/
@kimwhite
kimwhite / my_pmpro_members_list_sql.php
Last active August 24, 2021 12:28 — forked from strangerstudios/my_pmpro_members_list_sql.php
Add ability to search on specific user and user meta fields to the PMPro members list page.
<?php // This is a fork that ensures results will export
/*
Add ability to search on specific user and user meta fields
in the members list page.
e.g. last_name:coleman will search for users with last_name LIKE %coleman%
Some common PMPro-related user and user meta fields:
* first_name, last_name, user_login
* pmpro_bfirstname, pmpro_blastname, pmpro_baddress1, pmpro_bcity, pmpro_bstate, pmpro_bcountry, pmpro_bphone
@kimwhite
kimwhite / my_pmpro_add_name_checkout_hints.php
Last active August 20, 2021 13:44 — forked from dparker1005/my_pmpro_add_name_checkout_hints.php
Adds a hint to the first and last name fields at checkout.
<?php // do not copy this line.
/**
* This recipe will let you add hints to default WordPress fields (also child sponsor fields)
*
* 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
/**
* This recipe will change the word 'seat' to 'account'
*
* 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/
*/