Skip to content

Instantly share code, notes, and snippets.

View ipokkel's full-sized avatar

Theuns Coetzee ipokkel

View GitHub Profile
@ipokkel
ipokkel / pmpromd-mask-phone-for-non-members.php
Created February 28, 2025 12:27
Mask a custom user field value displayed in the Member Directory for non-members .
<?php
/**
* Mask the phone number displayed in the member directory for non-members.
*
* 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_mask_phone_for_non_members( $value, $element, $pu, $displayed_levels ) {
<?php
/**
* Replace <h2> with <h5> in the no access message HTML.
*
* 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 h2_to_h5_no_access_message_html( $no_access_message_html, $level_ids ) {
@ipokkel
ipokkel / allow-post-access-for-specific-users-only.php
Last active February 24, 2025 10:40
Restrict post access to only certain members that has access to a members only post.
<?php
/**
* Allow post access for specific members (users) only.
*
* 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 allow_post_access_for_specific_users_only( $hasaccess, $post, $user, $levels ) {
<?php
/**
* Change the wording of the Register link for the MemberLite theme.
*
* 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_change_memberlite_register_wording( $translated_text, $text, $domain ) {
@ipokkel
ipokkel / change-register-memberlite-theme.php
Created February 5, 2025 12:16 — forked from andrewlimaza/change-register-memberlite-theme.php
Change "Register" to "Sign Up" in Memberlite WordPress theme.
<?php
/**
* Change 'Register' wording in Memberlite theme to 'Sign Up'
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_change_memberlite_wording( $translated_text, $text, $domain ) {
switch( $translated_text ) {
case 'Register':
$translated_text = __( 'Sign Up', 'memberlite' );
break;
<?php
/**
* This recipe will hide the discount code field on the checkout page if no discount codes
* have been created for that specific 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/
*/
<?php
/**
* Remove punctuation from Level Cost Text for "now. starting".
*
* 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_pmprosd_level_cost_text_punctuation( $cost, $level, $tags, $short ) {
@ipokkel
ipokkel / my-pmpro-show-renew-link-when-level-expires-in-x-days.php
Created December 19, 2024 10:01
Show renewal link X days before expiration by hooking into pmpro_member_action_links. This is an alternative method to the one used in this guide: https://www.paidmembershipspro.com/schedule-renew-link-display/
<?php
/**
* A simple example to show you how to change an error message for checkout on Paid Memberships Pro.
*
* 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 pmpro_change_error_message( $translated_text, $text, $domain ) {
@ipokkel
ipokkel / my-pmpro-change-user-fields-to-level-only.php
Created December 13, 2024 09:59
Set specific user fields to only show for some levels. This can be used to make individual fields level specific if the fields were created via settings in a field group that displays for all levels.
<?php
/**
* Change user fields to level only.
*
* 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_change_user_fields_to_level_only( $field, $where ) {