Skip to content

Instantly share code, notes, and snippets.

View ipokkel's full-sized avatar

Theuns Coetzee ipokkel

View GitHub Profile
/* change select button colors for level 3 for non level 3 members */
body.pmpro-levels:not(.pmpro-body-has-level-3) #pmpro_level-3 .pmpro_level-select .pmpro_btn.pmpro_btn-select{
background-color: rgb(0, 165, 157);
border-color: rgb(0, 165, 157);
}
body.pmpro-levels:not(.pmpro-body-has-level-3) #pmpro_level-3 .pmpro_level-select .pmpro_btn.pmpro_btn-select:hover {
background-color: rgb(0, 200, 190);
border-color: rgb(0, 200, 190);
}
/* hide directory search form, company and company role */
body:not(.pmpro-body-has-level-2):not(.pmpro-body-has-level-3) form.pmpro_member_directory_search,
body:not(.pmpro-body-has-level-2):not(.pmpro-body-has-level-3) .pmpro_member_directory .pmpro_card .pmpro_member_profile_field-company,
body:not(.pmpro-body-has-level-2):not(.pmpro-body-has-level-3) .pmpro_member_directory .pmpro_card .pmpro_member_profile_field-company_role {
display: none;
}
/* show directory search form for level 2 and 3 members */
body.pmpro-body-has-level-2 form.pmpro_member_directory_search,
body.pmpro-body-has-level-3 form.pmpro_member_directory_search {
<?php
/**
* Cancel membership level and subscription at payment gateway when a member 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/
*/
function my_pmpro_cancel_subscription_on_denial( $user_id, $level_id ) {
@ipokkel
ipokkel / redirect-old-members-to-membership-account.php
Created May 21, 2025 10:23
Redirect old members to the membership account page on login.
<?php
/**
* Redirect old members to the membership account page on login.
*
* 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_login_redirect_old_members_to_membership_account( $redirect_to, $request, $user ) {
<?php
/**
* Flush WordPress user meta cache.
*
* Add the flushmetacache parameter to the admin URL to flush the user meta cache.
* e.g., http://your-site.com/wp-admin/admin.php?flushmetacache=1
*
* 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.
<?php
/**
* Change the "Choose a membership level" wording on the Paid Memberships Pro account 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/
*/
function my_pmpro_account_page_gettext_changes( $translated, $text, $domain ) {
global $pmpro_pages;
@ipokkel
ipokkel / my-pmprogroupacct-get-group-parent-id.php
Created May 13, 2025 10:10
Helper function to retrieve the group parent User ID of the latest group account a user subscribed to.
<?php
/**
* Helper function to get the parent ID of a group account for a given user.
*
* 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_pmprogroupacct_get_group_parent_id( $user_id ) {
@ipokkel
ipokkel / add_password_to_pmpro_checkout_email.php
Last active May 7, 2025 07:50 — forked from kimwhite/add_password_to_pmpro_checkout_email.php
Add Password to checkout email for Paid Memberships Pro.
<?php
/**
* Add the user's password to the checkout emails.
*
* Please be sure to take proper precautions when dealing with user's passwords and sending out emails.
* This is for demonstrative purposes.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
**/
function add_password_to_pmpro_checkout_email( $body, $email ) {
<?php
/**
* Set default values for specific checkbox group fields.
* This function hooks into the fields before they're added to a form
*
* Set your checkbox group field names and default values in the $defaults array.
*
* 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.
<?php
/**
* Automatically add paragraphs for set elements displayed on the member directory.
*
* 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_pmpromd_display_element_html( $value, $element, $pu, $displayed_levels ) {