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
/** | |
* This query will retrieve all active memberships for users including MMPU orders | |
* You'll need to change the wp_ database prefix on lines 21 - 24 to match your database prefix. | |
*/ | |
SELECT | |
DISTINCT u.ID, | |
u.user_login, | |
u.user_email, | |
u.user_login, | |
u.user_nicename, |
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 | |
/** | |
* Set the QR code to link to a checkout with an invite code when someone scans a Q. | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_membership_card_qr_invite_code( $card_user, $option ) { | |
global $pmproio_invite_required_levels; | |
if ( $option == 'other' ) { | |
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 | |
// Copy from below here... | |
/** | |
* Send a welcome email for each user after CSV import. | |
*/ | |
global $pmproiufcsv_email; | |
$pmproiufcsv_email = array( | |
'subject' => sprintf('Welcome to %s', get_bloginfo('sitename')), //email subject, "Welcome to Sitename" |
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 | |
/** | |
* Replace a user's display name on directory and profile page with their full name. | |
* This requires the latest version (1.0+) of the Member Directory and Profile Pages Add On - https://www.paidmembershipspro.com/add-ons/member-directory/ | |
* | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_member_directory_change_display_name( $display_name, $user ) { | |
$first_name = isset( $user->first_name ) ? $user->first_name : get_user_meta( $user->ID, 'first_name', true ); | |
$last_name = isset( $user->last_name ) ? $user->last_name : get_user_meta( $user->ID, 'last_name', true ); |
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 | |
/** | |
* Load a page template for a user page based on level. | |
*/ | |
function pmpro_user_page_redirect_per_level() { | |
// Make sure user is logged in. | |
if ( ! is_user_logged_in() ) { | |
return; | |
} | |
// Make sure we are on a page. |
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 | |
// Copy from below here... | |
/* | |
* Add widget to checkout to get result of checkout_levels API call when button is pressed. | |
*/ | |
function my_pmpro_test_checkout_levels_api() { | |
?> | |
<hr/> |
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 the full URL of a file upload field to member export CSV. | |
* Adjust the 'my_image' value with the relevant Register Helper field key. | |
* You can add this code snippet to your WordPress site following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
// Add a custom column to the CSV export. | |
function my_pmpro_members_list_csv_extra_columns ( $columns ) { | |
$columns["uploaded"] = "my_pmpro_members_list_uploaded"; |
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 | |
/** | |
* Always redirect user to referrer after log in if no other redirects are set. | |
* | |
*/ | |
function login_redirect_to_referrer( $redirect_to, $request, $user ) { | |
// If already redirecting, do that. | |
if ( ! empty( $redirect_to ) ) { | |
return $redirect_to; |