Skip to content

Instantly share code, notes, and snippets.

View ipokkel's full-sized avatar

Theuns Coetzee ipokkel

View GitHub Profile
View pmpro-get-user-field-option-label.php
<?php
/**
* Helper function to get the label of an option value from a user field key if the user field has options.
*
* @param [mixed] $value String or numeric value of the option.
* @param [string] $field_name The name of the user field.
* @return $value The label of the option value if the user field has options, otherwise the original value.
*/
function my_pmpro_get_user_field_option_label( $value, $field_name ) {
global $pmpro_user_fields;
View add-instructions-to-pmpro-add-member-added-email-data.php
<?php
/**
* Add !!instructions!! email variable data to the "add_member_added"
* email data if the payment method is "check".
*
* 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/
*/
View pmpro-change-to-checkout-check-email-template.php
<?php
/**
* Switch the email template from "add_member_added" to "checkout_check"
* if the payment method is "check" when creating an order using Add Member from Admin.
*
* 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/
*/
View home-page-redirect-for-non-members.php
<?php
/**
* Redirect logged-in non-members to a custom page when they visit the home 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/
*/
// Let's redirect logged in users that are not members to the custom page when they visit the home page.
View login-redirect-for-non-members.php
<?php
/**
* Redirect non-members to a custom 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/
*/
@ipokkel
ipokkel / pmpro-account-bullets-list-recurring-levels.php
Last active February 20, 2024 10:55
List automatically renewing (recurring) membership level in the accounts bullet list.
View pmpro-account-bullets-list-recurring-levels.php
<?php
/**
* Add a list of recurring levels to the account page bullets.
*
* 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_account_bullets_list_recurring_levels() {
@ipokkel
ipokkel / set-custom-default-zoom-level-for-members-map.php
Created February 2, 2024 11:23
Set a default zoom value for the PMPro Membership Map. The default is 8, setting a lower value will zoom out and setting a higher value will zoom in.
View set-custom-default-zoom-level-for-members-map.php
<?php
/**
* Set a custom default zoom level for the Members Map Add On.
*
* 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_pmpromm_set_custom_map_default_zoom_level( $zoom ) {
View pmpro_change_pay_by_check.php
<?php
/**
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
* A simple gist that changes "Pay by Check" to "Pay by Cheque or Bank Transfer:".
* Copy the code below into your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_pay_by_check_gettext( $translated_text, $text, $domain ) {
switch ( $text ) {
case 'Pay by %s':
View custom-email-per-level-for-checkout-free.php
<?php
/**
* Example usage of the pmpro_email_filter hook to customize the checkout_free email per 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/
*/
function my_pmpro_email_filter_checkout_free_per_level( $email ) {
View pmpro-formatted-address-example.php
<?php
/**
* Example usage of the pmpro_formatted_address filter.
*
* 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_formatted_address_example( $address, $name, $address1, $address2, $city, $state, $zip, $country, $phone, $nl2br ) {