Skip to content

Instantly share code, notes, and snippets.

View kimwhite's full-sized avatar

Kim White kimwhite

View GitHub Profile
<?php
/*
Add data from the pmpro_memberships_users table
The pmpro_members_list_csv_extra_columns passes an array of columns.
The keys of the array are the column headings. The values are callback functions to get the value for that row.
*/
//add the column to the export
function my_pmpro_members_list_csv_extra_columns ( $columns ) {
$columns["startdate"] = "my_pmpro_members_list_column_a";
@kimwhite
kimwhite / format_video_profile_field.php
Created October 29, 2024 13:30 — forked from kimcoleman/format_video_profile_field.php
Add a container to wrap a video oembed field and make it responsive.
<?php
/**
* Wrap the oembed video in a div so we can use custom CSS to make the video responsive inside the container.
* You must also add the following custom CSS to your site:
* .video-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; }
* .video-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
*/
function format_media_profile_field( $value, $original_value, $field_name ) {
// Define the fields that should use the 'media-container' class
$responsive_fields = array( 'video_link_1', 'video_link_2', 'video_link_3' );
@kimwhite
kimwhite / pmpro-approvals-denied-gets-set-level.php
Last active October 29, 2024 11:58 — forked from andrewlimaza/pmpro-approvals-delete-deny.php
Delete User on PMPro Approvals Deny. Delete denied user.
<?php // do not copy this line.
/**
* Automatically give user a set level when their approval is denied.
*
* 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 / mypmpro_member_directory_sql_search_where.php
Created October 21, 2024 19:31 — forked from dwanjuki/mypmpro_member_directory_sql_search_where.php
Exclude user meta from the member directory search sql query
<?php // copy from here
/*
* Exclude user meta from the member directory search sql query (added a custom user field too"
*
* 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 mypmpro_member_directory_sql_search_where( $sql_search_where, $s ) {
@kimwhite
kimwhite / my_show_userid_on_membership_card.php
Created October 21, 2024 18:04 — forked from dwanjuki/my_show_userid_on_membership_card.php
Show WordPress User ID on Membership Card
<?php
/**
* This recipe will add the member's WordPress User ID to your Membership Card
*
* 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_login_replace_welcome_text.php
Last active September 25, 2024 19:23 — forked from dwanjuki/my_pmpro_login_replace_welcome_text.php
Remove "welcome" text from PMPro login page
<?php
/**
* Using gettext to remove the "welcome" text from the PMPro login 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 / hide-braintree-billing-address-fields.php
Last active September 19, 2024 13:44 — forked from ipokkel/hide-stripe-billing-address-fields.php
Force remove BrainTree billing fields on checkout and billing
<?php // Do NOT copy this line
function hide_address_on_billing_update_if_braintree() {
global $pmpro_pages, $gateway;
// Bail if necessary
if ( empty( $pmpro_pages ) || ( ! is_page( $pmpro_pages['checkout'] ) && ! is_page( $pmpro_pages['billing'] ) ) ) {
return;
}
// Filter out BrainTree billing fields
if ( ! empty( $gateway ) && 'braintree' === $gateway ) {
<?php // do not copy this line.
/**
* This recipe will redirect non-members from your blog page if all of the post are protected and you have hidden from non-memberts.
*
* 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-custom-email-varialbe.php
Created September 9, 2024 18:06
This recipe creates an email variable for the current date.
<?
/**
* This recipe creates an email variable for the current date.
* !!current_date!! will show the current date in the confirmation 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/
*/
@kimwhite
kimwhite / one_time_trial_delay_pmpro_registration_checks.php
Last active September 5, 2024 13:12 — forked from travislima/one_time_trial_delay_pmpro_registration_checks.php
Offer one-time trials using the Subscription Delays Add On - updated for an array of Level IDs
<?php
/**
* This code stores data when a user checks out for a level. Updated for an array of Level IDs
* If that user tries to checkout for the same level, the Subscription Delay is removed.
* The user is instead charged for their first subscription payment at checkout.
*
*/
// Record when users gain the trial level.
function one_time_trial_save_trial_level_used( $level_id, $user_id ) {