This file contains 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 | |
/** | |
* Get the next payment date for a user's level inclusive of subscriptions and expiration dates. | |
* | |
* If the current user has a subscription for a passed level ID, return the next payment date for that subscription. | |
* Otherwise, if the user has an expiration date set for the level, return that. | |
* Otherwise, return null. | |
* | |
* @param int $level_id The level ID to check for. | |
* @return int|null The next payment date/expiration date as a timestamp or null. |
This file contains 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 my_coa_demo_pmpro_gettext_changes( $translated_text, $text, $domain ) { | |
if ( $domain == 'pmpro-shipping' ) { | |
if ( $text == 'Shipping Address' ) { | |
$translated_text = 'Mailing Address'; | |
} | |
} | |
return $translated_text; | |
} |
This file contains 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 | |
/** | |
* Shortcode to display a table of units, owners, and residents. | |
*/ | |
function condo_units_table_shortcode( $atts ) { | |
global $wpdb; | |
// Shortcode attributes with defaults | |
$atts = shortcode_atts( array( | |
'meta_key' => 'unit', // The usermeta key to retrieve unit numbers |
This file contains 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 my_coa_demo_add_custom_inline_style() { | |
echo '<style> | |
/* Custom CSS here */ | |
.pmpro_member_directory_before, | |
.pmpro_member_directory_after { | |
display: none; | |
} | |
.pmpro_member_directory .pmpro_member_directory-item.pmpro_card { | |
margin-top: 60px; |
This file contains 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 my_coa_demo_pmpro_add_memberslist_cols( $columns ) { | |
$columns['unit'] = 'Unit'; | |
$columns['condo_status'] = 'Condo Status'; | |
$columns['household_count'] = 'Household Members'; | |
$columns['household_pet_count'] = 'Household Pets'; | |
$columns['parking_spot_number'] = 'Parking Spot Number'; | |
return $columns; |
This file contains 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 my_coa_demo_template_redirect_lock_entire_site(){ | |
// If the user has a membership level, we don't need to lock down the site. | |
if ( ! function_exists( 'pmpro_hasMembershipLevel' ) || pmpro_hasMembershipLevel() ) { | |
return; | |
} | |
// If they have membership, return. | |
if ( pmpro_hasMembershipLevel() ) { | |
return; |
This file contains 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 | |
/** | |
* Redirection for the User Pages Add On. | |
* | |
* Note: This is only needed when you do not want to set the Top Level Page in Add On settings. | |
* If you have set a Top Level Page, the Add On has native logic for redirection. | |
*/ | |
function my_custom_user_page_template_redirect() { | |
// Exit early if not on the control page. | |
if ( ! is_page( 'clients' ) ) { |
This file contains 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 modify_pmpro_lesson_post_type_args($args, $post_type) { | |
// Target only the 'pmpro_lesson' post type | |
if ($post_type === 'pmpro_lesson') { | |
// Merge 'comments' (discussion) support into the 'supports' array | |
if (isset($args['supports']) && is_array($args['supports'])) { | |
$args['supports'][] = 'comments'; // Add 'comments' support | |
} else { | |
$args['supports'] = array('comments'); // Create the supports array if it doesn't exist | |
} |
This file contains 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 | |
/** | |
* Check how many posts a member has submitted to a specific form on page ID '48'. | |
* Hide the form if they have reached the submission limit for their Membership Level. | |
*/ | |
function my_pmpro_submission_limit_hide_ws_form( $content ) { | |
// Return early if PMPro is not active or the user is not logged in. | |
if ( ! function_exists( 'pmpro_has_membership_access' ) || ! is_user_logged_in() ) { | |
return $content; | |
} |
NewerOlder