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 | |
function pmpro_archive_redirect() { | |
$levels_to_check = array( | |
1, | |
2, | |
3, | |
); | |
if ( ( is_tax() || is_archive() || is_search() ) && function_exists( 'pmpro_hasMembershipLevel' ) ) { | |
if ( ! pmpro_hasMembershipLevel( $levels_to_check ) ) { | |
wp_redirect( pmpro_url( 'levels' ) ); |
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 membership directory by lastname first, then first name. | |
* | |
* 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_custom_directory_sql_parts( $parts ) { |
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 | |
/* | |
This shortcode will display the members list and additional content based on the defined attributes. | |
*/ | |
function pmpromd_shortcode($atts, $content=null, $code="") | |
{ | |
// $atts ::= array of attributes | |
// $content ::= text within enclosing form of shortcode element | |
// $code ::= the shortcode found, when == callback name | |
// examples: [pmpro_member_directory show_avatar="false" show_email="false" levels="1,2"] |
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 | |
global $pmpro_learndash_level_courses, $pmpro_learndash_my_courses; | |
function pmpro_learndash_course_visibility() { | |
global $pmpro_learndash_level_courses, $pmpro_learndash_my_courses; | |
if ( is_user_logged_in() && function_exists( 'pmpro_getMembershipLevelForUser' ) && class_exists( 'Learndash_Paidmemberships' ) && function_exists( 'learndash_user_get_enrolled_courses' ) ) { | |
global $current_user; | |
$levels = pmpro_getMembershipLevelForUser( $current_user->ID ); | |
if ( $levels ) { | |
$level_id = $levels->ID; | |
$pmpro_learndash_level_courses = Learndash_Paidmemberships::get_level_courses( $level_id ); |
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
<td> | |
<?php | |
// For use in a custom directory.php template after $auser has been defined. | |
$user_ids = pmprosm_getChildren( $auser->ID ); | |
if ( ! empty( $user_ids ) ) { | |
$user_list = new WP_User_Query( array( | |
'include' => $user_ids, | |
'orderby' => 'name', | |
'order' => 'ASC' | |
) ); |
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 | |
function pmpro_prorated_checkout_level( $level ) { | |
// 5 is the membership level ID. | |
if ( 5 === absint( $level->id ) ) { | |
$price_per_day = $level->initial_payment / 365.2425; // 365.2425 is the days in a year | |
// Get timestamp for end of year and current timestamp. | |
$end_date_timestamp = strtotime( 'first day of january next year' ); | |
$current_date_timestamp = time(); |
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 | |
function pmpro_invite_approval_message() { | |
if ( is_user_logged_in() ) { | |
global $current_user; | |
$user_id = $current_user->ID; | |
if ( ! PMPro_Approvals::isApproved( $user_id, 1 ) ) { // 1 is the membership level. | |
remove_filter( "pmpro_confirmation_message", "pmproio_pmpro_confirmation_message" ); | |
remove_filter('the_content', 'pmproio_the_content_account_page', 20, 1); | |
} | |
} |
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 | |
/** | |
* Plugin Name: My PMPro Directory Widget | |
* Description: Add widget to Member Directory page to filter results. | |
*/ | |
class My_PMPro_Directory_Widget extends WP_Widget { | |
/** | |
* Sets up the widget | |
*/ |
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 | |
// We have to put everything in a function called on init, so we are sure Register Helper is loaded. | |
function pmpro_register_field_peakbagger_init() { | |
// Don't break if Register Helper is not loaded. | |
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) { | |
return false; | |
} | |
pmprorh_add_checkout_box( 'contact', 'Contact Information' ); | |
pmprorh_add_checkout_box( 'emergency', 'Emergency Contact Information' ); |
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 | |
// We have to put everything in a function called on init, so we are sure Register Helper is loaded. | |
function pmpro_register_field_trialsofg_init() { | |
// Don't break if Register Helper is not loaded. | |
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) { | |
return false; | |
} | |
pmprorh_add_checkout_box( 'company', 'Company Information' ); | |
// Define the fields. |