Skip to content

Instantly share code, notes, and snippets.

View ipokkel's full-sized avatar

Theuns Coetzee ipokkel

View GitHub Profile
@ipokkel
ipokkel / pmpro-signup-shortcode-redirect-members-to-account.php
Created March 13, 2024 06:39
Redirect members to their account page from a page with the PMPro Signup Shortcode
<?php
/**
* Redirect users who are already members away from the PMPro Signup Shortcode.
*
* 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_pmprosus_redirect_members() {
@ipokkel
ipokkel / pmpro-email-change-subject-based-on-locale.php
Created March 12, 2024 07:12
Set a custom PMPro Email subject per locale.
<?php
/**
* Change the email subject based on the user's locale.
*
* 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_email_change_subject_based_on_locale( $subject, $email ) {
<?php
/**
* Redirect to the referrer after logout.
*
* 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 wp_redirect_to_referrer_after_logout() {
<?php
/**
* Change the email subject per template 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 pmpro_email_subject_per_template_per_level( $subject, $email ) {
@ipokkel
ipokkel / pmpro-directory-search-replace-state-abbreviations.php
Last active March 8, 2024 07:48
Replace state abbreviations for directory search, e.g. If user entered N.Y. replace it with NY.
<?php
/**
* Replace period abbreviated state abbreviations in the PMPro Member Directory search.
*
* 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_directory_search_replace_state_abbreviations( $query, $s ) {
<?php
/**
* Remove the extra fields from the admin checkout notification emails.
*
* 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_remove_extra_fields_from_email() {
<?php
/**
* Save the user's membership level name and the order date as comma separated values to the user meta.
*
* 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_save_level_and_checkout_date_to_user_meta( $user_id, $morder ) {
<?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;
<?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/
*/
<?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/
*/