This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Unset some contact methods that we won't use. | |
*/ | |
function my_edit_contactmethods( $contactmethods ) { | |
unset($contactmethods['yim']); | |
unset($contactmethods['aim']); | |
unset($contactmethods['jabber']); | |
return $contactmethods; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Add a hidden field in Ninja Forms to capture Membership Level (if user is logged in). | |
* | |
* For Ninja Forms older than version 3 | |
*/ | |
function pmpro_register_ninja_form_level_field() { | |
$argsMl = array( | |
'name' => 'Membership Level', | |
'display_function' => 'collect_membership_level_display', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Redirects members-only content to the Membership Levels page if a user is logged out or not a member. | |
*/ | |
function my_template_redirect_require_membership_access() { | |
if ( function_exists( 'pmpro_has_membership_access' ) && ! pmpro_has_membership_access() ) { | |
wp_redirect( pmpro_url( 'levels' ) ); | |
exit; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Redirects members-only content to the Membership Levels page on the Main Network Site | |
* if a user is logged out or not a member. | |
*/ | |
function my_template_redirect_network_require_membership_access() { | |
if ( ! pmpro_has_membership_access() ) { | |
wp_redirect( network_site_url( 'levels' ) ); | |
exit; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Filter the pmpro_pages_custom_template_path later to add our custom file for checkout.php. | |
* | |
*/ | |
function pmpro_custom_override_checkout_page( $templates, $page_name, $type, $where, $ext ) { | |
if ( ( $page_name === 'checkout' ) && file_exists( dirname(__FILE__) . '/pmpro-multiple-memberships-per-user/checkout.php' ) ) { | |
array_splice( $templates, 1, 0, dirname(__FILE__) . '/pmpro-multiple-memberships-per-user/checkout.php' ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BACKUP FIRST | |
# This will remove any expiration date on | |
# every member in your database. | |
# BACKUP FIRST | |
UPDATE wp_pmpro_memberships_users | |
SET enddate = '0000-00-00 00:00:00' | |
WHERE status = 'active' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Sort the Member Directory by "companyname". | |
* Update the shortcode to include [pmpro_member_directory order_by="umc.meta_value"] | |
* | |
*/ | |
function my_pmpro_member_directory_sql( $sqlQuery ) { | |
global $wpdb; | |
$sqlQuery = str_replace("WHERE mu.status", "LEFT JOIN $wpdb->usermeta umc ON umc.user_id = u.ID AND umc.meta_key = 'companyname' WHERE mu.status", $sqlQuery); | |
return $sqlQuery; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Make sure Billing Address fields are required. | |
* | |
* 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_required_billing_fields( $fields ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* BCC an additional email on the Member Invoice emails | |
*/ | |
function my_pmpro_email_headers_bcc_on_invoice_email( $headers, $email ) { | |
if ( strpos( $email->template, 'invoice' ) !== false ) { | |
//add bcc | |
$headers[] = "Bcc:" . "[email protected]"; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Register Helper "Phone" Field for RedWolfCY | |
*/ | |
function redwolfcy_pmprorh_init() { | |
//don't break if Register Helper is not loaded | |
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) { | |
return false; | |
} | |